|
How to use ModelClip nodes |
|
|
ModelClip nodes can clip visual objects in arbitrary ways. A ModelClip object
defines a set of six clipping planes of arbitrary orientations in the local
coordinate system. The clipping planes define halfspaces for which vertices are
culled from rendering.
public class ModelClipExample extends JFrame {
public ModelClipExample() {
...
}
public BranchGroup createSceneGraph() {
BranchGroup objRoot = new BranchGroup();
TransformGroup objSpin=new TransformGroup();
objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objRoot.addChild(objSpin);
objSpin.addChild(new ColorCube(0.4));
Alpha rotationAlpha=new Alpha(-1,4000);
RotationInterpolator rotator=new RotationInterpolator(rotationAlpha,objSpin);
//a bounding sphere specifies a region a behavior is active
BoundingSphere bounds=new BoundingSphere();
rotator.setSchedulingBounds(bounds);
objSpin.addChild(rotator);
//create a ModelClip object and set the clip planes
ModelClip modelClip = new ModelClip();
modelClip.setInfluencingBounds(bounds);
boolean enables[] = {true, true, false, false, false, false};
modelClip.setEnables(enables);
modelClip.setPlane(0, new Vector4d(1, 0, 0, -0.1));
modelClip.setPlane(1, new Vector4d(0,1,0,-0.1));
objRoot.addChild(modelClip);
return objRoot;
}
public static void main(String[] args){
...
}
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.