Use a clipping plane

From JReality Wiki
Jump to: navigation, search

Source file: ClippingPlaneExample

JavaDoc: ClippingPlane

Run as Java webstart

jReality supports clipping planes. This example demonstrates how to add a clipping plane to a scene in such a way that it can be manipulated with a rotate tool.

Note that clipping planes can be either local or global. Use the method setLocal(true) to set a clipping plane to only effect the geometry below its position. [As of June 17, 2009 only JOGL backend supports local clipping planes.]

Global clipping planes are identified at the beginning of the rendering process and applied to the whole scene as if they were attached the root node of the scene.

Warning: The position of a clipping plane is controlled by the transformation which is current at its position in the scene graph. Therefore, the use of local clipping planes is complicated by the fact that the motion of the clipping plane will, by default, be inherited by the scene graph which you are clipping, so usually you will have to undo the relative motion of the clipping plane. This can be done for example by registering a TransformationListener on the clipping plane's t transformation; this listener then applies the inverse of this transformation to the child of the clipping plane node. See the class de.jreality.geometry.SliceBoxFactory for gory details.

Previous: Use a geometry merge factory Developer Tutorial: Contents Next: Use a slice box