191

Using special-purpose groups
SharedGroup example code

  • Build one or more shapes to share
    Shape3D myShape = new Shape3D( myGeom, myAppear );

  • Create a SharedGroup and add the shapes to it
    SharedGroup myShared = new SharedGroup( );
    myShared.addChild( myShape );

  • Compile the SharedGroup for maximum performance
    myShared.compile( );

  • Use Link nodes to point to the group from another group
    Link myLink = new Link( myShared );
    TransformGroup myGroup = new TransformGroup( );
    myGroup.addChild( myLink );