public void setShowBoundingVolume(boolean showBoundingVolume) { if (showBoundingVolume) { getBoundingBox(); } this.mShowBoundingVolume = showBoundingVolume; }
private void updateMaxMinCoords(Vector3 min, Vector3 max, Object3D child) { Vector3 maxVertex = child.getBoundingBox().getMax(); if (maxVertex.x > max.x) { max.x = maxVertex.x; } if (maxVertex.y > max.y) { max.y = maxVertex.y; } if (maxVertex.z > max.z) { max.z = maxVertex.z; } Vector3 minVertex = child.getBoundingBox().getMin(); if (minVertex.x < min.x) { min.x = minVertex.x; } if (minVertex.y < min.y) { min.y = minVertex.y; } if (minVertex.z < min.z) { min.z = minVertex.z; } }
@Override public IBoundingVolume getTransformedBoundingVolume() { IBoundingVolume volume = null; volume = getBoundingBox(); calculateModelMatrix(null); volume.transform(mMMatrix); return volume; } }
/** * 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(); } }
BoundingBox bbox = getBoundingBox(); if (!camera.getFrustum().boundsInFrustum(bbox)) { mIsInFrustum = false;
getBoundingBox().transform(getModelMatrix()); BoundingBox bbox = getBoundingBox(); if (!camera.getFrustum().boundsInFrustum(bbox)) { mIsInFrustum = false; getBoundingBox().drawBoundingVolume(camera, vpMatrix, projMatrix, vMatrix, mMMatrix);