@Override protected void doTask() { // ensure all cameras can see the far side of the skybox float out_radius = (float)skybox.getGeometry().getBoundingSphere().getRadius(); float in_radius = out_radius/(float)Math.sqrt(3); float median_diagonal = in_radius + out_radius; for (int i = 0, j = mCameras.size(); i < j; ++i) if(mCameras.get(i).getFarPlane() < median_diagonal) { mCameras.get(i).setFarPlane(median_diagonal); } } };
/** * 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(); } }
@Test public void testApplySphere() { Sphere sphere = new Sphere(1, 4, 2, false, false, false, false); sphere.getGeometry().getBoundingSphere(); visitor.apply(sphere); assertNull(visitor.getPickedObject()); }
@Test public void testApplyInstrumentedSphere() { InstrumentedSphere sphere = new InstrumentedSphere(1, 4, 2, false, false, false, false); sphere.getGeometry().getBoundingSphere(); sphere.setFrustumTest(false); sphere.setInFrustum(true); visitor.apply(sphere); assertEquals(sphere, visitor.getPickedObject()); }
BoundingSphere bsphere = o.getGeometry().getBoundingSphere(); bsphere.calculateBounds(o.getGeometry()); bsphere.transform(o.getModelMatrix());
mGeometry.getBoundingSphere().transform(getModelMatrix()); mGeometry.getBoundingSphere().drawBoundingVolume(camera, vpMatrix, projMatrix, vMatrix, mMMatrix);
/** * 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(); }
BoundingSphere bsphere = o.getGeometry().getBoundingSphere(); bsphere.calculateBounds(o.getGeometry()); bsphere.transform(o.getModelMatrix());
mGeometry.getBoundingSphere().transform(getModelMatrix()); mGeometry.getBoundingBox().drawBoundingVolume(camera, vpMatrix, projMatrix, vMatrix, mMMatrix); if (mGeometry.hasBoundingSphere()) mGeometry.getBoundingSphere().drawBoundingVolume(camera, vpMatrix, projMatrix, vMatrix, mMMatrix);