当前位置: 首页>>代码示例>>Java>>正文


Java Frustum类代码示例

本文整理汇总了Java中com.badlogic.gdx.math.Frustum的典型用法代码示例。如果您正苦于以下问题:Java Frustum类的具体用法?Java Frustum怎么用?Java Frustum使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Frustum类属于com.badlogic.gdx.math包,在下文中一共展示了Frustum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: retrieve

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
public void retrieve(Array<OctreeObject> returnObjects, Frustum frustum, boolean checkObjectsToo) {
  if (haveNodes()) {
    for(OctreeNode node : nodes) {
      if (frustum.boundsInFrustum(node.getBounds())) {
        node.retrieve(returnObjects, frustum, checkObjectsToo);
      }
    }
  }

  if (checkObjectsToo) {
    for (OctreeObject object : objects) {
      object.getBoundingBox(tempBox);
      if (frustum.boundsInFrustum(tempBox)) {
        returnObjects.add(object);
      }
    }
  } else {
    returnObjects.addAll(objects);
  }

}
 
开发者ID:macbury,项目名称:ForgE,代码行数:22,代码来源:OctreeNode.java

示例2: getFrustum

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
public Frustum getFrustum()
{
	if(needUpdateFrustum)
	{
		updateFrustum();
	}
	
	return frustum;
}
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:10,代码来源:BaseCamera.java

示例3: retriveNodes

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
public void retriveNodes(Array<OctreeNode> outNodes, Frustum frustum) {
  if (haveNodes()) {
    for(OctreeNode node : nodes) {
      node.retriveNodes(outNodes, frustum);
    }
  } else {
    if (frustum.boundsInFrustum(this.getBounds())) {
      outNodes.add(this);
    }
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:12,代码来源:OctreeNode.java

示例4: cullledOctree

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
public static void cullledOctree(ShapeRenderer renderer, OctreeNode rootNode, Frustum frustum) {
  nodes.clear();
  rootNode.retriveNodes(nodes, frustum);
  for (OctreeNode node : nodes) {
    draw(renderer, node.getBounds());
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:8,代码来源:DebugShape.java

示例5: normalOrDebugFrustrum

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
/**
 * Return debug frustum if have or return normal frustrum
 * @return
 */
@Override
public Frustum normalOrDebugFrustrum() {
  if (haveDebugFrustrum()) {
    return debugFrustrum;
  } else {
    return frustum;
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:13,代码来源:GameCamera.java

示例6: DebugFrustrum

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
public DebugFrustrum(Frustum copy, Matrix4 invProjectionView) {
  super();
  for (int i = 0; i < copy.planes.length; i++) {
    planes[i] = new Plane(copy.planes[i].getNormal(), copy.planes[i].getD());
  }

  for (int i = 0; i < copy.planePoints.length; i++) {
    planePoints[i] = new Vector3(copy.planePoints[i].x, copy.planePoints[i].y, copy.planePoints[i].z);
  }

  update(invProjectionView);
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:13,代码来源:DebugFrustrum.java

示例7: analyze

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
@Override
public DirectionalResult analyze (Frustum frustum, Vector3 direction) {
  bb.inf();
  for(int i = 0; i < frustum.planePoints.length; i++) {
    bb.ext(frustum.planePoints[i]);
  }

  bb.getCenter(sphere.center);
  sphere.radius = bb.getDimensions(tmpV).len() * 0.65f;

  // Position at sphere center
  tmpV.set(sphere.center);

  // Move back from 1.5*radius
  tmpV2.set(direction);
  tmpV2.scl(sphere.radius*1.5f);

  result.direction.set(direction);
  result.position.set(tmpV.sub(tmpV2));
  result.near = 0.5f*sphere.radius;
  result.far = 2.5f*sphere.radius+0.5f;
  result.up.set(direction.y, direction.z,direction.x);
  result.viewportWidth = sphere.radius;
  result.viewportHeight = sphere.radius;

  return result;
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:28,代码来源:BoundingSphereDirectionalAnalyzer.java

示例8: allGridsInFrustrumFast

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
public boolean allGridsInFrustrumFast(BoundingBox boundingBox, Frustum frustum) {
    for (Vector3 p : boundingBox.getCorners()) {
        if (!frustum.pointInFrustum(p)) {
            return false;
        }
    }

    return true;
}
 
开发者ID:neuroradiology,项目名称:TinyVoxel,代码行数:10,代码来源:Bundle.java

示例9: getFrustum

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
public Frustum getFrustum() {
    return this.camera.frustum;
}
 
开发者ID:opensourcegamedev,项目名称:SpaceChaos,代码行数:4,代码来源:CameraWrapper.java

示例10: areaInFrustum

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
public boolean areaInFrustum(Area area, Frustum frustum) {
	return frustum.boundsInFrustum(area.minBlockX + Area.HALF_SIZE_BLOCKS, Area.MAX_Y / 2f,
			area.minBlockZ + Area.HALF_SIZE_BLOCKS, Area.HALF_SIZE_BLOCKS, Area.MAX_Y / 2f, Area.HALF_SIZE_BLOCKS);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:5,代码来源:WorldRenderer.java

示例11: areaInFrustum

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
public boolean areaInFrustum(Area area, Frustum frustum) {
  return frustum.boundsInFrustum(area.minBlockX + Area.HALF_SIZE_BLOCKS, Area.MAX_Y / 2f, area.minBlockZ + Area.HALF_SIZE_BLOCKS, Area.HALF_SIZE_BLOCKS, Area.MAX_Y / 2f, Area.HALF_SIZE_BLOCKS);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:4,代码来源:WorldRenderer.java

示例12: setFrustums

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
public void setFrustums(PerspectiveCamera cam) {
    Frustum bigFrustum = cam.frustum;
    nearBotLeft.set(bigFrustum.planePoints[0]);
    nearBotRight.set(bigFrustum.planePoints[1]);
    nearTopRight.set(bigFrustum.planePoints[2]);
    nearTopLeft.set(bigFrustum.planePoints[3]);
    farBotLeft.set(bigFrustum.planePoints[4]);
    farBotRight.set(bigFrustum.planePoints[5]);
    farTopRight.set(bigFrustum.planePoints[6]);
    farTopLeft.set(bigFrustum.planePoints[7]);

    ndw.set(nearBotRight).sub(nearBotLeft).scl(1f / sizex);
    ndh.set(nearTopLeft).sub(nearBotLeft).scl(1f / sizey);
    fdw.set(farBotRight).sub(farBotLeft).scl(1f / sizex);
    fdh.set(farTopRight).sub(farBotRight).scl(1f / sizey);


    for (int x = 0; x < sizex; x++) {
        temp.set(ndw).scl(x);
        tempNearBotLeft.set(nearBotLeft);
        tempNearBotLeft.add(temp);

        planePoints[0].set(tempNearBotLeft);
        planePoints[1].set(tempNearBotLeft).add(ndw);
        planePoints[2].set(tempNearBotLeft).add(ndw).add(ndh);
        planePoints[3].set(tempNearBotLeft).add(ndh);

        temp.set(fdw).scl(x);
        tempFarBotLeft.set(farBotLeft);
        tempFarBotLeft.add(temp);

        planePoints[4].set(tempFarBotLeft);
        planePoints[5].set(tempFarBotLeft).add(fdw);
        planePoints[6].set(tempFarBotLeft).add(fdw).add(fdh);
        planePoints[7].set(tempFarBotLeft).add(fdh);
        verticalPlanes[0][x].set(planePoints[0], planePoints[4], planePoints[3]);
        verticalPlanes[1][x].set(planePoints[5], planePoints[1], planePoints[6]);
    }
    for (int y = 0; y < sizey; y++) {
        tempNearBotLeft.set(nearBotLeft);
        temp.set(ndh).scl(y);
        tempNearBotLeft.set(tempNearBotLeft);
        tempNearBotLeft.add(temp);

        planePoints[0].set(tempNearBotLeft);
        planePoints[1].set(tempNearBotLeft).add(ndw);
        planePoints[2].set(tempNearBotLeft).add(ndw).add(ndh);
        planePoints[3].set(tempNearBotLeft).add(ndh);

        tempFarBotLeft.set(farBotLeft);

        temp.set(fdh).scl(y);
        tempFarBotLeft.set(tempFarBotLeft);
        tempFarBotLeft.add(temp);
        planePoints[4].set(tempFarBotLeft);
        planePoints[5].set(tempFarBotLeft).add(fdw);
        planePoints[6].set(tempFarBotLeft).add(fdw).add(fdh);
        planePoints[7].set(tempFarBotLeft).add(fdh);
        horizontalPlanes[0][y].set(planePoints[2], planePoints[3], planePoints[6]);
        horizontalPlanes[1][y].set(planePoints[4], planePoints[0], planePoints[1]);
    }
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:63,代码来源:LightGrid.java

示例13: getFrustum

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
public Frustum getFrustum() {
    return frustum;
}
 
开发者ID:mstojcevich,项目名称:Radix,代码行数:4,代码来源:GameRenderer.java

示例14: onRender

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
@Override
public void onRender(float interpolation) {
	Camera camera = viewportContext.getPerspectiveCamera();
	Frustum frustum = camera.frustum;

	billboardSpriteBatch.begin(camera);

	for (Entity entity : entityManager.getAllWith(BillboardComponent.class)) {
		BillboardComponent billboard = entity.get(BillboardComponent.class);
		PositionComponent position = entity.get(PositionComponent.class);
		BoundingSphereComponent bounds = entity.get(BoundingSphereComponent.class);

		if (bounds != null) {
			if (!frustum.sphereInFrustum(bounds.bounds.center, bounds.bounds.radius))
				continue;
		} else {
			if (!frustum.pointInFrustum(position.lastPosition))
				continue;
		}

		EntityUtils.getInterpolatedPosition(entity, interpolation, renderPosition);

		BillboardSpriteBatch.Type billboardType =
				(billboard.isAxisAligned ? BillboardSpriteBatch.Type.ScreenAligned :
				 BillboardSpriteBatch.Type.Spherical);

		float difference = (billboard.height / 2.0f) + Y_COORD_OFFSET;
		if (difference > 0.0f)
			renderPosition.y += difference;
		renderPosition.x += 0.35f;

		if (billboard.texture != null)
			billboardSpriteBatch.draw(
					billboardType, billboard.texture,
					renderPosition.x, renderPosition.y, renderPosition.z,
					billboard.width, billboard.height
			);
		else
			billboardSpriteBatch.draw(
					billboardType, billboard.atlas.get(billboard.tileIndex),
					renderPosition.x, renderPosition.y, renderPosition.z,
					billboard.width, billboard.height
			);
	}

	billboardSpriteBatch.end();
}
 
开发者ID:gered,项目名称:tiles3-basic-example,代码行数:48,代码来源:BillboardRenderSystem.java

示例15: getFrustum

import com.badlogic.gdx.math.Frustum; //导入依赖的package包/类
public Frustum getFrustum() {
  return frustum;
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:4,代码来源:FrustrumOctreeQuery.java


注:本文中的com.badlogic.gdx.math.Frustum类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。