Ejemplo n.º 1
0
  public String toStringVerbose(int indent) {
    String str = "------------------".substring(0, indent) + toString() + "\n";
    if (child == null) return str;

    FastOctnode children = child;
    while (children != null) {
      str += children.toStringVerbose(indent + 1);
      children = children.next;
    }

    return str;
  }
Ejemplo n.º 2
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;
      }
    }
  }
Ejemplo n.º 3
0
  private void generateRenderSetNoCheck(
      Geometry[] globalGeomList, Set<Geometry> renderSet, Camera cam) {
    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;
    while (node != null) {
      node.generateRenderSetNoCheck(globalGeomList, renderSet, cam);
      node = node.next;
    }
  }