sim.portrayal3d.simple
Class BranchGroupPortrayal3D

java.lang.Object
  extended by sim.portrayal3d.SimplePortrayal3D
      extended by sim.portrayal3d.simple.PrimitivePortrayal3D
          extended by sim.portrayal3d.simple.BranchGroupPortrayal3D
All Implemented Interfaces:
java.io.Serializable, Portrayal, Portrayal3D

public class BranchGroupPortrayal3D
extends PrimitivePortrayal3D

Loads a Lightwave 3D scene file (.lwo or .lws extension) or a Wavefront object file (.obj extension) into a BranchGroup, then attaches this as a portrayal. All scene elements and attributes are loaded (fog, sound, etc. as well). Generally all geometry in the scene is loaded as a Shape3D. If an Appearance is specified in the constructor, it is applied to all Shape3D objects in the scene. Else they are left with the appearance specified in the file.

You can also use other loaders for other scene file formats. NCSA Portfolio contains a large number of them, but it's not quite open source (free for academic, research, or internal business use). See the MASON website for a link to download and use the NCSA Portfolio library.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class sim.portrayal3d.simple.PrimitivePortrayal3D
group
 
Fields inherited from class sim.portrayal3d.SimplePortrayal3D
DEFAULT_APPEARANCE
 
Constructor Summary
BranchGroupPortrayal3D(javax.media.j3d.BranchGroup scene)
          Constructs a BranchGroupPortrayal3D with the given scene file loader without changing its appearance, scale, or transform.
BranchGroupPortrayal3D(javax.media.j3d.BranchGroup scene, javax.media.j3d.Appearance a)
          Constructs a BranchGroupPortrayal3D with the given scene file loader without transforming it or scaling it, but changing its appearance (unless the appearance is null).
BranchGroupPortrayal3D(javax.media.j3d.BranchGroup scene, double scale)
          Constructs a BranchGroupPortrayal3D with the given scene file loader without changing its appearance, but scaling it.
BranchGroupPortrayal3D(javax.media.j3d.BranchGroup scene, double scale, javax.media.j3d.Appearance a)
          Constructs a BranchGroupPortrayal3D with the given scene file loader by scaling it and changing its appearance (unless the appearance is null).
BranchGroupPortrayal3D(javax.media.j3d.BranchGroup scene, javax.media.j3d.Transform3D transform)
          Constructs a BranchGroupPortrayal3D with the given scene file loader without changing its appearance, but transforming it.
BranchGroupPortrayal3D(javax.media.j3d.BranchGroup scene, javax.media.j3d.Transform3D transform, javax.media.j3d.Appearance a)
          Constructs a BranchGroupPortrayal3D with the given scene file loader by transforming it and changing its appearance (unless the appearance is null).
 
Method Summary
static javax.media.j3d.BranchGroup getBranchGroupForFile(java.lang.String filename)
           
static javax.media.j3d.BranchGroup getBranchGroupForResource(java.lang.Class c, java.lang.String resourceName)
           
static javax.media.j3d.BranchGroup getBranchGroupForURL(java.net.URL url)
           
 javax.media.j3d.TransformGroup getModel(java.lang.Object obj, javax.media.j3d.TransformGroup j3dModel)
          We suggest that if you wish to override this to change the appearance or scale or transform of the underlying model, do the changes first and THEN call super.getModel(obj, j3dModel).
protected  int numShapes()
          Unused: returns 0 always.
 
Methods inherited from class sim.portrayal3d.simple.PrimitivePortrayal3D
getAppearance, getShape, setAppearance, setPickable, setScale, setShape3DFlags, setTransform
 
Methods inherited from class sim.portrayal3d.SimplePortrayal3D
appearanceForColor, appearanceForColors, appearanceForImage, clearPickableFlags, getCurrentDisplay, getCurrentFieldPortrayal, getCurrentGUIState, getInspector, getName, getStatus, isSelected, polygonAttributes, setAppearanceFlags, setCurrentDisplay, setCurrentFieldPortrayal, setPickableFlags, setPickableFlags, setSelected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BranchGroupPortrayal3D

public BranchGroupPortrayal3D(javax.media.j3d.BranchGroup scene)
Constructs a BranchGroupPortrayal3D with the given scene file loader without changing its appearance, scale, or transform.


BranchGroupPortrayal3D

public BranchGroupPortrayal3D(javax.media.j3d.BranchGroup scene,
                              double scale)
Constructs a BranchGroupPortrayal3D with the given scene file loader without changing its appearance, but scaling it.


BranchGroupPortrayal3D

public BranchGroupPortrayal3D(javax.media.j3d.BranchGroup scene,
                              javax.media.j3d.Transform3D transform)
Constructs a BranchGroupPortrayal3D with the given scene file loader without changing its appearance, but transforming it.


BranchGroupPortrayal3D

public BranchGroupPortrayal3D(javax.media.j3d.BranchGroup scene,
                              javax.media.j3d.Appearance a)
Constructs a BranchGroupPortrayal3D with the given scene file loader without transforming it or scaling it, but changing its appearance (unless the appearance is null).


BranchGroupPortrayal3D

public BranchGroupPortrayal3D(javax.media.j3d.BranchGroup scene,
                              double scale,
                              javax.media.j3d.Appearance a)
Constructs a BranchGroupPortrayal3D with the given scene file loader by scaling it and changing its appearance (unless the appearance is null).


BranchGroupPortrayal3D

public BranchGroupPortrayal3D(javax.media.j3d.BranchGroup scene,
                              javax.media.j3d.Transform3D transform,
                              javax.media.j3d.Appearance a)
Constructs a BranchGroupPortrayal3D with the given scene file loader by transforming it and changing its appearance (unless the appearance is null).

Method Detail

getBranchGroupForResource

public static javax.media.j3d.BranchGroup getBranchGroupForResource(java.lang.Class c,
                                                                    java.lang.String resourceName)
                                                             throws java.lang.IllegalArgumentException,
                                                                    java.io.FileNotFoundException
Throws:
java.lang.IllegalArgumentException
java.io.FileNotFoundException

getBranchGroupForURL

public static javax.media.j3d.BranchGroup getBranchGroupForURL(java.net.URL url)
                                                        throws java.lang.IllegalArgumentException,
                                                               java.io.FileNotFoundException
Throws:
java.lang.IllegalArgumentException
java.io.FileNotFoundException

getBranchGroupForFile

public static javax.media.j3d.BranchGroup getBranchGroupForFile(java.lang.String filename)
                                                         throws java.lang.IllegalArgumentException,
                                                                java.io.FileNotFoundException
Throws:
java.lang.IllegalArgumentException
java.io.FileNotFoundException

getModel

public javax.media.j3d.TransformGroup getModel(java.lang.Object obj,
                                               javax.media.j3d.TransformGroup j3dModel)
Description copied from class: PrimitivePortrayal3D
We suggest that if you wish to override this to change the appearance or scale or transform of the underlying model, do the changes first and THEN call super.getModel(obj, j3dModel). Be sure to also set the appearance/scale/transform of the model the first time (that is, when j3dModel is null) as well as when something interesting changes necessitating an update.

Specified by:
getModel in interface Portrayal3D
Overrides:
getModel in class PrimitivePortrayal3D

numShapes

protected int numShapes()
Unused: returns 0 always.

Specified by:
numShapes in class PrimitivePortrayal3D