Package sim.portrayal3d.simple
Class BranchGroupPortrayal3D
java.lang.Object
sim.portrayal3d.SimplePortrayal3D
sim.portrayal3d.simple.PrimitivePortrayal3D
sim.portrayal3d.simple.BranchGroupPortrayal3D
- All Implemented Interfaces:
Portrayal
,Portrayal3D
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.
-
Field Summary
Fields inherited from class sim.portrayal3d.simple.PrimitivePortrayal3D
group
Fields inherited from class sim.portrayal3d.SimplePortrayal3D
DEFAULT_APPEARANCE
-
Constructor Summary
ConstructorDescriptionBranchGroupPortrayal3D
(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, 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.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, 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
Modifier and TypeMethodDescriptionstatic javax.media.j3d.BranchGroup
getBranchGroupForFile
(String filename) static javax.media.j3d.BranchGroup
getBranchGroupForResource
(Class c, String resourceName) static javax.media.j3d.BranchGroup
getBranchGroupForURL
(URL url) javax.media.j3d.TransformGroup
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
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
-
Constructor Details
-
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 Details
-
getBranchGroupForResource
public static javax.media.j3d.BranchGroup getBranchGroupForResource(Class c, String resourceName) throws IllegalArgumentException, FileNotFoundException -
getBranchGroupForURL
public static javax.media.j3d.BranchGroup getBranchGroupForURL(URL url) throws IllegalArgumentException, FileNotFoundException -
getBranchGroupForFile
public static javax.media.j3d.BranchGroup getBranchGroupForFile(String filename) throws IllegalArgumentException, FileNotFoundException -
getModel
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 interfacePortrayal3D
- Overrides:
getModel
in classPrimitivePortrayal3D
-
numShapes
protected int numShapes()Unused: returns 0 always.- Specified by:
numShapes
in classPrimitivePortrayal3D
-