javax.media.j3d
Class GeometryStructure

java.lang.Object
  extended by javax.media.j3d.J3dStructure
      extended by javax.media.j3d.GeometryStructure

 class GeometryStructure
extends J3dStructure

A geometry structure is a object that organizes geometries and bounds.


Field Summary
private  BHNode[] bhNodeArr
          The array of BHNode, a data pool, for passing data between GS and BHTrees.
private  int bhNodeBlockSize
           
private  int bhNodeCount
           
private  int bhNodeMax
           
private  BHTree[] bhTreeArr
          Binary Hull Tree structure for handling geometry atoms.
private  int bhTreeBlockSize
           
private  int bhTreeCount
           
private  int bhTreeMax
           
(package private)  WakeupIndexedList collideEntryList
           
(package private)  WakeupIndexedList collideExitList
           
private  java.lang.Object collideListLock
          A lock object to prevent concurrent collideEntryList, collideExitList using toArray() in BehaviorStructure buildTree() while clearMirror() is invoked in GeometryStructure removeNode()
(package private)  WakeupIndexedList collideMovementList
           
private  Vector3d localeTrans
           
private  MRSWLock lock
          A multiple read single write Lock to sychronize access into this GeometryStructure.
(package private)  boolean reEvaluateWakeupCollisionGAs
           
(package private)  UpdateTargets targets
          used during Transform Processing
private  boolean transformMsg
           
private  java.lang.Object visLock
          A lock object to prevent concurrent getVisibleBHTree query.
(package private)  WakeupIndexedList wakeupOnCollisionEntry
           
(package private)  WakeupIndexedList wakeupOnCollisionExit
           
(package private)  WakeupIndexedList wakeupOnCollisionMovement
           
 
Fields inherited from class javax.media.j3d.J3dStructure
messageList, msgList, nMessage, threadData, threadType, universe, updateThread
 
Constructor Summary
GeometryStructure(VirtualUniverse u)
          Constructor.
 
Method Summary
private  void addToBhNodeArr(BHNode bhNode)
           
(package private)  void addWakeupOnCollision(WakeupOnCollisionEntry w)
           
(package private)  void addWakeupOnCollision(WakeupOnCollisionExit w)
           
(package private)  void addWakeupOnCollision(WakeupOnCollisionMovement w)
           
(package private)  void checkDuplicateEvent(WakeupOnCollisionMovement wmove, Bounds bound, BHLeafInterface hitNode)
          Check for duplicate WakeupOnCollisionMovement event.
(package private)  void cleanup()
          Release resource associate with this structure before GC We need to clear all those IndexedUnorderSet/WakeupIndexedList so that the listIdx associate with IndexedObject reset to -1.
private  void clearBhNodeArr()
           
(package private)  BHLeafInterface collide(Locale locale, int accurancyMode, UnorderList geomAtoms, Bounds bound, BoundingLeafRetained boundingLeaf, NodeRetained armingNode, WakeupCriterion cond)
          check if either the geomAtoms[] or bound or boundingLeaf collide with BHTree.
private  int getBHTreeIndex(Locale locale)
           
private  int getOrAddBHTreeIndex(Locale locale)
           
(package private)  boolean getVisibleBHTrees(RenderBin rBin, BoundingBox frustumBBox, Locale locale, long referenceTime, boolean stateChanged, int visibilityPolicy)
           
private  void insertNodes(java.lang.Object[] nodes)
           
(package private)  GeometryAtom[] pickAll(Locale locale, PickShape shape)
           
(package private)  GeometryAtom pickAny(Locale locale, PickShape shape)
           
private  void processBoundsChanged(java.lang.Object[] nodes, boolean transformChanged)
           
(package private)  void processCollisionDetection()
          This method test all wakeupOnCollision list and trigger the condition if collision occurs.
(package private)  void processMessages(long referenceTime)
          This gets overriden by the structure
private  void processSwitchChanged(J3dMessage m)
          This processes a switch change.
private  void processTransformChanged(UpdateTargets targets)
           
private  void processVisibleChanged(java.lang.Object valueObj, GeometryAtom[] gaArr)
           
(package private)  void removeNodes(J3dMessage m)
          This is used by MasterControl to process any unused message for final cleanup.
(package private)  void removeWakeupOnCollision(WakeupOnCollisionEntry wentry)
           
(package private)  void removeWakeupOnCollision(WakeupOnCollisionExit wexit)
           
(package private)  void removeWakeupOnCollision(WakeupOnCollisionMovement wmovement)
           
(package private)  void resetConditionMet()
          This prevents wakeupCondition sent out message and set conditionMet to true but the BehaviorStructure/BehaviorScheduler is not fast enough to process the message and reset conditionMet to false when view deactivate/unregister.
 
Methods inherited from class javax.media.j3d.J3dStructure
addMessage, clearMessages, getMessages, getNumMessage, getUpdateThreadData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targets

UpdateTargets targets
used during Transform Processing


lock

private MRSWLock lock
A multiple read single write Lock to sychronize access into this GeometryStructure. To prevent deadlock a call to read/write lock must end with a read/write unlock respectively.


visLock

private java.lang.Object visLock
A lock object to prevent concurrent getVisibleBHTree query.


collideListLock

private java.lang.Object collideListLock
A lock object to prevent concurrent collideEntryList, collideExitList using toArray() in BehaviorStructure buildTree() while clearMirror() is invoked in GeometryStructure removeNode()


bhTreeArr

private BHTree[] bhTreeArr
Binary Hull Tree structure for handling geometry atoms. Do not change the following private variables to public, their access need to synchronize via lock.


bhTreeCount

private int bhTreeCount

bhTreeMax

private int bhTreeMax

bhTreeBlockSize

private int bhTreeBlockSize

bhNodeArr

private BHNode[] bhNodeArr
The array of BHNode, a data pool, for passing data between GS and BHTrees. Do not change the following private variables to public, their access need to synchronize via lock.


bhNodeCount

private int bhNodeCount

bhNodeMax

private int bhNodeMax

bhNodeBlockSize

private int bhNodeBlockSize

localeTrans

private Vector3d localeTrans

collideEntryList

WakeupIndexedList collideEntryList

collideExitList

WakeupIndexedList collideExitList

collideMovementList

WakeupIndexedList collideMovementList

wakeupOnCollisionEntry

WakeupIndexedList wakeupOnCollisionEntry

wakeupOnCollisionExit

WakeupIndexedList wakeupOnCollisionExit

wakeupOnCollisionMovement

WakeupIndexedList wakeupOnCollisionMovement

reEvaluateWakeupCollisionGAs

boolean reEvaluateWakeupCollisionGAs

transformMsg

private boolean transformMsg
Constructor Detail

GeometryStructure

GeometryStructure(VirtualUniverse u)
Constructor.

Method Detail

processMessages

void processMessages(long referenceTime)
Description copied from class: J3dStructure
This gets overriden by the structure

Specified by:
processMessages in class J3dStructure

getBHTreeIndex

private int getBHTreeIndex(Locale locale)

getOrAddBHTreeIndex

private int getOrAddBHTreeIndex(Locale locale)

clearBhNodeArr

private void clearBhNodeArr()

addToBhNodeArr

private void addToBhNodeArr(BHNode bhNode)

processVisibleChanged

private void processVisibleChanged(java.lang.Object valueObj,
                                   GeometryAtom[] gaArr)

insertNodes

private void insertNodes(java.lang.Object[] nodes)

removeNodes

void removeNodes(J3dMessage m)
Description copied from class: J3dStructure
This is used by MasterControl to process any unused message for final cleanup. DON'T decrememt message count in the method, as it is done by MasterControl.

Specified by:
removeNodes in class J3dStructure

processBoundsChanged

private void processBoundsChanged(java.lang.Object[] nodes,
                                  boolean transformChanged)

processTransformChanged

private void processTransformChanged(UpdateTargets targets)

getVisibleBHTrees

boolean getVisibleBHTrees(RenderBin rBin,
                          BoundingBox frustumBBox,
                          Locale locale,
                          long referenceTime,
                          boolean stateChanged,
                          int visibilityPolicy)

pickAll

GeometryAtom[] pickAll(Locale locale,
                       PickShape shape)

pickAny

GeometryAtom pickAny(Locale locale,
                     PickShape shape)

addWakeupOnCollision

void addWakeupOnCollision(WakeupOnCollisionEntry w)

addWakeupOnCollision

void addWakeupOnCollision(WakeupOnCollisionExit w)

addWakeupOnCollision

void addWakeupOnCollision(WakeupOnCollisionMovement w)

removeWakeupOnCollision

void removeWakeupOnCollision(WakeupOnCollisionEntry wentry)

removeWakeupOnCollision

void removeWakeupOnCollision(WakeupOnCollisionExit wexit)

removeWakeupOnCollision

void removeWakeupOnCollision(WakeupOnCollisionMovement wmovement)

processCollisionDetection

void processCollisionDetection()
This method test all wakeupOnCollision list and trigger the condition if collision occurs.


checkDuplicateEvent

void checkDuplicateEvent(WakeupOnCollisionMovement wmove,
                         Bounds bound,
                         BHLeafInterface hitNode)
Check for duplicate WakeupOnCollisionMovement event. We don't want to continue deliver event even though the two colliding object did not move but this Geometry update thread continue to run due to transform change in others shape not in collision.


collide

BHLeafInterface collide(Locale locale,
                        int accurancyMode,
                        UnorderList geomAtoms,
                        Bounds bound,
                        BoundingLeafRetained boundingLeaf,
                        NodeRetained armingNode,
                        WakeupCriterion cond)
check if either the geomAtoms[] or bound or boundingLeaf collide with BHTree. Only one of geomAtoms, bound, boundingLeaf is non-null. If accurancyMode is USE_GEOMETRY, object geometry is used, otherwise object bounding box is used for collision detection. In case of GROUP & BOUND, the armingNode is used to tell whether the colliding Group is itself or not. Also in case GROUP, geomAtoms is non-null if USE_GEOMETRY. If cond != null, it must be instanceof WakeupOnCollisionMovement


resetConditionMet

void resetConditionMet()
This prevents wakeupCondition sent out message and set conditionMet to true but the BehaviorStructure/BehaviorScheduler is not fast enough to process the message and reset conditionMet to false when view deactivate/unregister.


processSwitchChanged

private void processSwitchChanged(J3dMessage m)
This processes a switch change.


cleanup

void cleanup()
Description copied from class: J3dStructure
Release resource associate with this structure before GC We need to clear all those IndexedUnorderSet/WakeupIndexedList so that the listIdx associate with IndexedObject reset to -1.

Specified by:
cleanup in class J3dStructure


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.