Esempio n. 1
0
 /**
  * Populates the outputGeometryList with the geometry of the inputGeomtryList that are in the
  * frustum of the given camera
  *
  * @param inputGeometryList The list containing all geometry to check against the camera frustum
  * @param camera the camera to check geometries against
  * @param outputGeometryList the list of all geometries that are in the camera frustum
  */
 public static void getGeometriesInCamFrustum(
     GeometryList inputGeometryList, Camera camera, GeometryList outputGeometryList) {
   for (int i = 0; i < inputGeometryList.size(); i++) {
     Geometry g = inputGeometryList.get(i);
     int planeState = camera.getPlaneState();
     camera.setPlaneState(0);
     if (camera.contains(g.getWorldBound()) != Camera.FrustumIntersect.Outside) {
       outputGeometryList.add(g);
     }
     camera.setPlaneState(planeState);
   }
 }
Esempio n. 2
0
 /**
  * Populates the outputGeometryList with the geometry of the inputGeomtryList that are in the
  * radius of a light. The array of camera must be an array of 6 cameara initialized so they
  * represent the light viewspace of a pointlight
  *
  * @param inputGeometryList The list containing all geometry to check against the camera frustum
  * @param cameras the camera array to check geometries against
  * @param outputGeometryList the list of all geometries that are in the camera frustum
  */
 public static void getGeometriesInLightRadius(
     GeometryList inputGeometryList, Camera[] cameras, GeometryList outputGeometryList) {
   for (int i = 0; i < inputGeometryList.size(); i++) {
     Geometry g = inputGeometryList.get(i);
     boolean inFrustum = false;
     for (int j = 0; j < cameras.length && inFrustum == false; j++) {
       Camera camera = cameras[j];
       int planeState = camera.getPlaneState();
       camera.setPlaneState(0);
       inFrustum = camera.contains(g.getWorldBound()) != Camera.FrustumIntersect.Outside;
       camera.setPlaneState(planeState);
     }
     if (inFrustum) {
       outputGeometryList.add(g);
     }
   }
 }
Esempio n. 3
0
  public void generateRenderSet(
      Geometry[] globalGeomList,
      Set<Geometry> renderSet,
      Camera cam,
      BoundingBox parentBox,
      boolean isRoot) {
    tempBox.setCenter(parentBox.getCenter());
    tempBox.setXExtent(parentBox.getXExtent());
    tempBox.setYExtent(parentBox.getYExtent());
    tempBox.setZExtent(parentBox.getZExtent());

    if (!isRoot) {
      findChildBound(tempBox, getSide());
    }

    tempBox.setCheckPlane(0);
    cam.setPlaneState(0);
    Camera.FrustumIntersect result = cam.contains(tempBox);
    if (result != Camera.FrustumIntersect.Outside) {
      if (length != 0) {
        int start = getOffset();
        int end = start + length;
        for (int i = start; i < end; i++) {
          renderSet.add(globalGeomList[i]);
        }
      }

      if (child == null) return;

      FastOctnode node = child;

      float x = tempBox.getCenter().x;
      float y = tempBox.getCenter().y;
      float z = tempBox.getCenter().z;
      float ext = tempBox.getXExtent();

      while (node != null) {
        if (result == Camera.FrustumIntersect.Inside) {
          node.generateRenderSetNoCheck(globalGeomList, renderSet, cam);
        } else {
          node.generateRenderSet(globalGeomList, renderSet, cam, tempBox, false);
        }

        tempBox.getCenter().set(x, y, z);
        tempBox.setXExtent(ext);
        tempBox.setYExtent(ext);
        tempBox.setZExtent(ext);

        node = node.next;
      }
    }
  }