java left logo
java middle logo
java right logo
 

Home arrow Other API Tips
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4091
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
Using OrientedShape3D class E-mail
User Rating: / 2
PoorBest 

OritentedShape3D objects are used to perform the same function as the Billboard Behavior of the previous section. The major differences between these two choices are that OrientedShape3D object work for applications with more than one view where Billboards don't, and OrientedShape3D objects can be a shared object while Billboards can't.

This program shows how to use the OrientedShape3D class. As you see, The OrientedShape3D is not a behavior,but a Shape.

public BranchGroup createSceneGraph(SimpleUniverse su) {

    // Create the root of the branch graph
    BranchGroup objRoot = new BranchGroup();

    Vector3f translate = new Vector3f();
    Transform3D T3D = new Transform3D();
    TransformGroup positionTG = null;
    OrientedShape3D orientedShape3D = null;
    
    Geometry treeGeom = createTree();

    //specify the position of the trees
    float[][] position = {
         0.0f0.0f, -2.0f},
         {-13.0f0.0f23.0f},
         1.0f0.0f, -3.5f}
    };
 
    // for the positions in the array create a OS3D
    for (int i = 0; i < position.length; i++){
         translate.set(position[i]);
         T3D.setTranslation(translate);
         positionTG = new TransformGroup(T3D);

         orientedShape3D = new OrientedShape3D();
         orientedShape3D.addGeometry(treeGeom);

         objRoot.addChild(positionTG);
         positionTG.addChild(orientedShape3D);
    }
}

 Related Tips

 
< Prev   Next >

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.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.