Package sim.portrayal3d.simple
Class Shape3DPortrayal3D
java.lang.Object
sim.portrayal3d.SimplePortrayal3D
sim.portrayal3d.simple.PrimitivePortrayal3D
sim.portrayal3d.simple.Shape3DPortrayal3D
- All Implemented Interfaces:
Portrayal
,Portrayal3D
- Direct Known Subclasses:
ValuePortrayal3D
A simple portrayal for displaying Shape3D objects. You can find Shape3D objects,
or CompressedGeometry objects (which you can make into a Shape3D in its constructor)
all over the web.
Important note: CompressedGeometry cannot have any appearances set: it ignores all of them and only uses what's defined in the geometry itself. That's Java3D for you.
Some examples (be sure to import javax.media.j3d.*; import com.sun.j3d.utils.geometry.*; import java.awt.Font.*;)
- A seagull comes with MASON: new Shape3DPortrayal3D(new Shape3D(new sim.app.crowd3d.GullCG()));
- A box with six colored sides: new Shape3DPortrayal3D(new ColorCube());
- Some 3D text: new Shape3DPortrayal3D(new Shape3D(new Text3D(new Font3D(new Font("SansSerif", Font.PLAIN, 9), new FontExtrusion()), "Hello, World!")));
-
Field Summary
Fields inherited from class sim.portrayal3d.simple.PrimitivePortrayal3D
group
Fields inherited from class sim.portrayal3d.SimplePortrayal3D
DEFAULT_APPEARANCE
-
Constructor Summary
ConstructorDescriptionShape3DPortrayal3D
(javax.media.j3d.Geometry geometry) Constructs a Shape3DPortrayal3D with the given geometry and a default (flat opaque white) appearance.Shape3DPortrayal3D
(javax.media.j3d.Geometry geometry, Color color) Constructs a Shape3DPortrayal3D with the given geometry and a flat opaque appearance of the given color.Shape3DPortrayal3D
(javax.media.j3d.Geometry geometry, Image image) Constructs a Shape3DPortrayal3D with the given geometry and (opaque) image.Shape3DPortrayal3D
(javax.media.j3d.Geometry geometry, javax.media.j3d.Appearance appearance) Constructs a Shape3DPortrayal3D with the given geometry and appearance.Shape3DPortrayal3D
(javax.media.j3d.Shape3D shape) Constructs a Shape3DPortrayal3D with the given shape and a default (flat opaque white) appearance.Shape3DPortrayal3D
(javax.media.j3d.Shape3D shape, Color color) Constructs a Shape3DPortrayal3D with the given shape and a flat opaque appearance of the given color.Shape3DPortrayal3D
(javax.media.j3d.Shape3D shape, Image image) Constructs a Shape3DPortrayal3D with the given shape and (opaque) image.Shape3DPortrayal3D
(javax.media.j3d.Shape3D shape, javax.media.j3d.Appearance appearance) Constructs a Shape3DPortrayal3D with the given shape and appearance. -
Method Summary
Methods inherited from class sim.portrayal3d.simple.PrimitivePortrayal3D
getAppearance, getModel, 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
-
Shape3DPortrayal3D
public Shape3DPortrayal3D(javax.media.j3d.Shape3D shape) Constructs a Shape3DPortrayal3D with the given shape and a default (flat opaque white) appearance. -
Shape3DPortrayal3D
Constructs a Shape3DPortrayal3D with the given shape and a flat opaque appearance of the given color. -
Shape3DPortrayal3D
Constructs a Shape3DPortrayal3D with the given shape and (opaque) image. -
Shape3DPortrayal3D
public Shape3DPortrayal3D(javax.media.j3d.Shape3D shape, javax.media.j3d.Appearance appearance) Constructs a Shape3DPortrayal3D with the given shape and appearance. -
Shape3DPortrayal3D
public Shape3DPortrayal3D(javax.media.j3d.Geometry geometry) Constructs a Shape3DPortrayal3D with the given geometry and a default (flat opaque white) appearance. -
Shape3DPortrayal3D
Constructs a Shape3DPortrayal3D with the given geometry and a flat opaque appearance of the given color. -
Shape3DPortrayal3D
Constructs a Shape3DPortrayal3D with the given geometry and (opaque) image. -
Shape3DPortrayal3D
public Shape3DPortrayal3D(javax.media.j3d.Geometry geometry, javax.media.j3d.Appearance appearance) Constructs a Shape3DPortrayal3D with the given geometry and appearance.
-
-
Method Details
-
numShapes
protected int numShapes()Description copied from class:PrimitivePortrayal3D
Returns the number of shapes handled by this primitive or Shape3D. Shape3D objects only have a single shape. Cylinder has three shapes (BODY=0, TOP=1, BOTTOM=2), while Cone has two shapes (BODY=0, CAP=1) and Sphere has a single shape (BODY=0).- Specified by:
numShapes
in classPrimitivePortrayal3D
-
getShape
protected javax.media.j3d.Shape3D getShape(javax.media.j3d.TransformGroup j3dModel, int shapeNumber) Description copied from class:PrimitivePortrayal3D
Returns the shape by the given index. Cylinder has three shapes (BODY=0, TOP=1, BOTTOM=2), while Cone has two shapes (BODY=0, CAP=1) and Sphere has a single shape (BODY=0). Useful for use in for-loops in combination with numShapes().- Overrides:
getShape
in classPrimitivePortrayal3D
-