|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsim.portrayal.FieldPortrayal
sim.portrayal3d.FieldPortrayal3D
sim.portrayal3d.grid.ObjectGridPortrayal3D
public class ObjectGridPortrayal3D
Portrays ObjectGrid2D and ObjectGrid3D in 3D space. A (0,0) or (0,0,0) object is centered on the origin. 2D fields are spread through the XY plane and are presumed to have Z=0.
You should be aware that ObjectGrid3DPortrayal3D is slow, especially if objects change a lot at given locations. This is because it has to update all the objects on a per location basis rather than on a per object basis. This is a worst-case scenario for Java3D.
Note for Java3D users: We experimented with a number of approaches to dealing with this. One approach was to use shared groups and only portray an object once, then use links to draw it in many locations. This has two subapproaches: you can wrap the link in a BranchGroup and replace it and the BranchGroup when the object changes at that location; or you can just change the link directly. The first approach is very slow (building BranchGroups isn't efficient). The second approach has promise, but there are grievous bugs in Java3D's handling of links which generate all sorts of race conditions with array bounds exceptions and null pointer exceptions etc. internal to Java3D when you change the SharedGroup that a link is pointing to. Ultimately we just gave up and used BranchGroups wrapping whole new submodels, entire copies for each location. Memory inefficient, but it's the fastest method we have figured out which doesn't break with stupid Sun bugs. It's also fairly simple to grok. Sorry.
Field Summary |
---|
Fields inherited from class sim.portrayal.FieldPortrayal |
---|
classPortrayals, field, immutableField, portrayalForAll, portrayalForNonNull, portrayalForNull, portrayalForRemainder, portrayals |
Constructor Summary | |
---|---|
ObjectGridPortrayal3D()
|
Method Summary | |
---|---|
LocationWrapper |
completedWrapper(LocationWrapper w,
com.sun.j3d.utils.picking.PickIntersection pi,
com.sun.j3d.utils.picking.PickResult pr)
Given the provided PickIntersection and the PickResult it came from, fill in w the location of the picked object, and return it. |
protected javax.media.j3d.TransformGroup |
createModel()
Returns a tree structure of the form InternalTransformGroup[model info]. |
void |
setField(java.lang.Object field)
Sets the field, and sets the dirtyField flag to true. |
protected void |
updateModel(javax.media.j3d.TransformGroup globalTG)
Returns a tree structure of the form InternalTransformGroup[model info]. |
Methods inherited from class sim.portrayal3d.FieldPortrayal3D |
---|
getCurrentDisplay, getCurrentGUIState, getDefaultPortrayal, getDefaultTransform, getModel, getTransform, polygonAttributes, resetTransform, rotateX, rotateY, rotateZ, scale, scale, setCurrentDisplay, setTransform, transform, translate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface sim.portrayal.Portrayal |
---|
getInspector, getName, getStatus, setSelected |
Constructor Detail |
---|
public ObjectGridPortrayal3D()
Method Detail |
---|
protected javax.media.j3d.TransformGroup createModel()
FieldPortrayal3D
...where InternalTransformGroup is an identity transformgroup whose transform will be modified elsewhere (create it but don't play with it).
createModel
in class FieldPortrayal3D
protected void updateModel(javax.media.j3d.TransformGroup globalTG)
FieldPortrayal3D
...where InternalTransformGroup is an identity transformgroup whose transform will be modified elsewhere (don't play with it). By default, this function does nothing. Override it to update the model when it's called.
updateModel
in class FieldPortrayal3D
public void setField(java.lang.Object field)
FieldPortrayal
setField
in class FieldPortrayal
public LocationWrapper completedWrapper(LocationWrapper w, com.sun.j3d.utils.picking.PickIntersection pi, com.sun.j3d.utils.picking.PickResult pr)
FieldPortrayal3D
completedWrapper
in class FieldPortrayal3D
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |