public boolean hasBoundingVolume() { return mGeometry.hasBoundingBox() || mGeometry.hasBoundingSphere(); }
/** * The reload method is called whenever the OpenGL context needs to be re-created. When the OpenGL context was lost, * the vertex, uv coord, index etc data needs to be re-uploaded. */ public void reload() { if (!mIsContainerOnly) { mGeometry.reload(); } for (int i = 0, j = mChildren.size(); i < j; i++) { mChildren.get(i).reload(); } if (mGeometry.hasBoundingBox() && getBoundingBox().getVisual() != null) { getBoundingBox().getVisual().reload(); } if (mGeometry.hasBoundingSphere() && mGeometry.getBoundingSphere().getVisual() != null) { mGeometry.getBoundingSphere().getVisual().reload(); } }
/** * Returns a {@link BoundingBox} for this Object3D and creates it if needed. * Utilizes children's bounding values to calculate its own {@link BoundingBox}. * * @return */ public BoundingBox getBoundingBox() { if (getNumChildren() > 0 && !mGeometry.hasBoundingBox()) { Vector3 min = new Vector3(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE); Vector3 max = new Vector3(-Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE); for (int i = 0; i < getNumChildren(); i++) { Object3D child = getChildAt(i); updateMaxMinCoords(min, max, child); } if (mGeometry.getVertices() != null) { updateMaxMinCoords(min, max, this); } mGeometry.setBoundingBox(new BoundingBox(min, max)); } return mGeometry.getBoundingBox(); }
if (mFrustumTest && mGeometry.hasBoundingBox()) { BoundingBox bbox = getBoundingBox(); if (!camera.getFrustum().boundsInFrustum(bbox)) {
if (mGeometry.hasBoundingBox()) { getBoundingBox().transform(getModelMatrix()); if (mFrustumTest && mGeometry.hasBoundingBox()) { BoundingBox bbox = getBoundingBox(); if (!camera.getFrustum().boundsInFrustum(bbox)) { if (mGeometry.hasBoundingBox()) { getBoundingBox().drawBoundingVolume(camera, vpMatrix, projMatrix, vMatrix, mMMatrix);
public boolean hasBoundingVolume() { return mGeometry.hasBoundingBox() || mGeometry.hasBoundingSphere(); }
/** * The reload method is called whenever the OpenGL context needs to be re-created. When the OpenGL context was lost, * the vertex, uv coord, index etc data needs to be re-uploaded. */ public void reload() { if (!mIsContainerOnly) { mGeometry.reload(); } for (int i = 0, j = mChildren.size(); i < j; i++) mChildren.get(i).reload(); if (mGeometry.hasBoundingBox() && mGeometry.getBoundingBox().getVisual() != null) mGeometry.getBoundingBox().getVisual().reload(); if (mGeometry.hasBoundingSphere() && mGeometry.getBoundingSphere().getVisual() != null) mGeometry.getBoundingSphere().getVisual().reload(); }
if (mGeometry.hasBoundingBox()) mGeometry.getBoundingBox().transform(getModelMatrix()); if (mGeometry.hasBoundingSphere()) mGeometry.getBoundingSphere().transform(getModelMatrix()); if (mFrustumTest && mGeometry.hasBoundingBox()) { BoundingBox bbox = mGeometry.getBoundingBox(); if (!camera.getFrustum().boundsInFrustum(bbox)) { if (mGeometry.hasBoundingBox()) mGeometry.getBoundingBox().drawBoundingVolume(camera, vpMatrix, projMatrix, vMatrix, mMMatrix); if (mGeometry.hasBoundingSphere())