|
Using Billboard class to Implement billboad in Java 3D World |
|
|
The term "billboard" used in computer graphics context refers to the technique
of automatically rotating a planar visual object such that it is always facing
the viewer.In Java 3D, the billboard technique is implemented in a subclass of
the Behavior Class, thus the phrase "billboard behavior" used in Java 3D
literature.
Here is the Billboard usage recipe:
- create a target TransformGroup with ALLOW_TRANSFORM_WRITE capability
- create a Billboard object referencing the target TransformGroup
- supply a scheduling bounds (or bounding leaf) for the Billboard object
- assemble the scene graph
public BranchGroup createSceneGraph(SimpleUniverse su) {
BranchGroup objRoot = new BranchGroup();
...
// Create a TransformGroup object
TransformGroup TGR = new TransformGroup();
// Set the proper capability
TGR.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
// Create a Billboard object referencing to the TransformGroup object
Billboard billboard = new Billboard(TGR);;
BoundingSphere bSphere = new BoundingSphere();
//Set the scheduling bounds
billboard.setSchedulingBounds(bSphere);
// assemble scene graph
objRoot.addChild(TGT);
objRoot.addChild(billboard);
TGT.addChild(TGR);
TGR.addChild(createTree());
...
return objRoot;
}
|
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.