public class ObjectGridPortrayal3D extends FieldPortrayal3D
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.
classPortrayals, field, immutableField, portrayalForAll, portrayalForNonNull, portrayalForNull, portrayalForRemainder, portrayals
Constructor and Description |
---|
ObjectGridPortrayal3D() |
Modifier and Type | Method and Description |
---|---|
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].
|
getCurrentDisplay, getCurrentGUIState, getDefaultPortrayal, getDefaultTransform, getModel, getObjectLocation, getTransform, polygonAttributes, resetTransform, rotateX, rotateY, rotateZ, scale, scale, setCurrentDisplay, setObjectLocation, setTransform, transform, translate
getDefaultNullPortrayal, getField, getInspector, getName, getPortrayalForAll, getPortrayalForNonNull, getPortrayalForNull, getPortrayalForObject, getPortrayalForRemainder, getStatus, isDirtyField, isImmutableField, reset, setDirtyField, setImmutableField, setPortrayalForAll, setPortrayalForClass, setPortrayalForNonNull, setPortrayalForNull, setPortrayalForObject, setPortrayalForRemainder, setSelected, setSelected
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInspector, getName, getStatus, setSelected
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