Java 类com.badlogic.gdx.math.Frustum 实例源码

项目:ForgE    文件:OctreeNode.java   
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);
  }

}
项目:GDX-Engine    文件:BaseCamera.java   
public Frustum getFrustum()
{
    if(needUpdateFrustum)
    {
        updateFrustum();
    }

    return frustum;
}
项目:ForgE    文件:OctreeNode.java   
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);
    }
  }
}
项目:ForgE    文件:DebugShape.java   
public static void cullledOctree(ShapeRenderer renderer, OctreeNode rootNode, Frustum frustum) {
  nodes.clear();
  rootNode.retriveNodes(nodes, frustum);
  for (OctreeNode node : nodes) {
    draw(renderer, node.getBounds());
  }
}
项目:ForgE    文件:GameCamera.java   
/**
 * Return debug frustum if have or return normal frustrum
 * @return
 */
@Override
public Frustum normalOrDebugFrustrum() {
  if (haveDebugFrustrum()) {
    return debugFrustrum;
  } else {
    return frustum;
  }
}
项目:ForgE    文件:DebugFrustrum.java   
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);
}
项目:ForgE    文件:BoundingSphereDirectionalAnalyzer.java   
@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;
}
项目:TinyVoxel    文件:Bundle.java   
public boolean allGridsInFrustrumFast(BoundingBox boundingBox, Frustum frustum) {
    for (Vector3 p : boundingBox.getCorners()) {
        if (!frustum.pointInFrustum(p)) {
            return false;
        }
    }

    return true;
}
项目:SpaceChaos    文件:CameraWrapper.java   
public Frustum getFrustum() {
    return this.camera.frustum;
}
项目:Cubes_2    文件:WorldRenderer.java   
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);
}
项目:Cubes_2    文件:WorldRenderer.java   
public boolean areaInFrustum(int areaX, int areaZ, int ySection, Frustum frustum) {
    return frustum.boundsInFrustum((areaX * Area.SIZE_BLOCKS) + Area.HALF_SIZE_BLOCKS,
            (ySection * Area.SIZE_BLOCKS) + Area.HALF_SIZE_BLOCKS,
            (areaZ * Area.SIZE_BLOCKS) + Area.HALF_SIZE_BLOCKS, Area.HALF_SIZE_BLOCKS, Area.HALF_SIZE_BLOCKS,
            Area.HALF_SIZE_BLOCKS);
}
项目:Cubes    文件:WorldRenderer.java   
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);
}
项目:Cubes    文件:WorldRenderer.java   
public boolean areaInFrustum(int areaX, int areaZ, int ySection, Frustum frustum) {
  return frustum.boundsInFrustum((areaX * Area.SIZE_BLOCKS) + Area.HALF_SIZE_BLOCKS, (ySection * Area.SIZE_BLOCKS) + Area.HALF_SIZE_BLOCKS, (areaZ * Area.SIZE_BLOCKS) + Area.HALF_SIZE_BLOCKS, Area.HALF_SIZE_BLOCKS, Area.HALF_SIZE_BLOCKS, Area.HALF_SIZE_BLOCKS);
}
项目:nhglib    文件:LightGrid.java   
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]);
    }
}
项目:Radix    文件:GameRenderer.java   
public Frustum getFrustum() {
    return frustum;
}
项目:tiles3-basic-example    文件:BillboardRenderSystem.java   
@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();
}
项目:ForgE    文件:FrustrumOctreeQuery.java   
public Frustum getFrustum() {
  return frustum;
}
项目:ForgE    文件:FrustrumOctreeQuery.java   
public void setFrustum(Frustum frustum) {
  this.frustum = frustum;
}
项目:ForgE    文件:OrtographicGameCamera.java   
@Override
public Frustum normalOrDebugFrustrum() {
  return debugFrustrum == null ? frustum : debugFrustrum;
}
项目:ingress-indonesia-dev    文件:as.java   
public final Frustum f()
{
  return this.a.f();
}
项目:ingress-indonesia-dev    文件:ac.java   
public final Frustum f()
{
  return this.a.frustum;
}
项目:ingress-indonesia-dev    文件:ao.java   
public final Frustum f()
{
  return this.d.frustum;
}
项目:ForgE    文件:DirectionalAnalyzer.java   
/**
 * Compute the good orthographicCamera dimension based on the frustum.
 * Be careful, direction must be normalized.
 * @param frustum Frustum of the main camera
 * @param direction Direction of the directional light
 */
public DirectionalResult analyze(Frustum frustum, Vector3 direction);
项目:ForgE    文件:ICamera.java   
Frustum normalOrDebugFrustrum();
项目:ingress-indonesia-dev    文件:f.java   
public abstract Frustum f();