Package org.xj3d.impl.core.eventmodel
Class DefaultFrameStateManager
java.lang.Object
org.xj3d.impl.core.eventmodel.DefaultFrameStateManager
- All Implemented Interfaces:
FrameStateManager
,SceneGraphTraversalSimpleObserver
public class DefaultFrameStateManager
extends Object
implements FrameStateManager, SceneGraphTraversalSimpleObserver
A generalised implementation of the frame state manager interface that can
be used with any renderer.
- Version:
- $Revision: 1.5 $
- Author:
- Justin Couch, Alan Hudson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SceneGraphTraverser
Traverser used to handle added/removed nodes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a listener that is interested in knowing when the end of this frame is reached.void
clear()
Force clearing all state from this manager now.void
Clear all registered added nodes now.void
Clear all registered added scenes nowvoid
Clear all registered removed nodes now.void
Clear all registered added scenes nowvoid
Notification that the current frame is finished.Get the added bindable nodes from this last frame.Get the added extern proto instances.Get the added externally synchronised nodes from this last frame.getAddedNodes
(int type) Get all the added nodes of the named type.org.j3d.util.ObjectArray
Get the scenes that have inserted during this last frame.Get the added scripts from this last frame.Get the added Sensors.Get the added terrain sources from this last frame.Get the added nodes with URL fields that will need to have their content loaded for the first time.Get the list of nodes that require view-dependent updates.Get all the removed bindable nodes.Get the removed externally synchronised nodes from this last frame.getRemovedNodes
(int type) Get all the removed nodes of the named type.org.j3d.util.ObjectArray
Get the removed scenes.Get all the removed script nodes.Get the removed sensors.Get the removed nodes from this last frame of this specified type.Get the list of nodes that require view-dependent updates.void
listenFor
(int[] types) Instruct the state manager that you're interested in keeping track of nodes that have been added or removed of the given list of types.void
observedNode
(VRMLNodeType parent, VRMLNodeType child, int field, boolean used) Notification of a child node.void
Register an externproto declaration as having been loaded this frame.void
registerAddedNode
(VRMLNode node) Register a node that has been added this frame.void
registerAddedNodes
(VRMLNode[] nodes) Register nodes that have been added this frame.void
Register an execution space that has been added in this frame.void
registerRemovedNode
(VRMLNode node) Register a node that has been removed this frame.void
registerRemovedNodes
(VRMLNode[] nodes) Register nodes that have been removed this frame.void
Register an execution space that has been removed in this frame.void
removeListenFor
(int[] types) Remove a type or types(s) that were previously registered as something to listen for.void
setErrorReporter
(org.j3d.util.ErrorReporter reporter) Register an error reporter with the manager so that any errors generated by the loading of script code can be reported in a nice, pretty fashion.
-
Field Details
-
traverser
Traverser used to handle added/removed nodes
-
-
Constructor Details
-
DefaultFrameStateManager
public DefaultFrameStateManager()Create a new state manager instance.
-
-
Method Details
-
addEndOfThisFrameListener
Add a listener that is interested in knowing when the end of this frame is reached. When this end of frame is reached, the listener will be removed from the internal list. A listener may call this method to register itself more than once in this frame. The manager will automatically remove duplicates and ensure each listener is called only once each frame.- Specified by:
addEndOfThisFrameListener
in interfaceFrameStateManager
- Parameters:
l
- The listener to add
-
setErrorReporter
public void setErrorReporter(org.j3d.util.ErrorReporter reporter) Register an error reporter with the manager so that any errors generated by the loading of script code can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.- Specified by:
setErrorReporter
in interfaceFrameStateManager
- Parameters:
reporter
- The instance to use or null
-
listenFor
public void listenFor(int[] types) Instruct the state manager that you're interested in keeping track of nodes that have been added or removed of the given list of types. These are the primary node types.- Specified by:
listenFor
in interfaceFrameStateManager
- Parameters:
types
- An array of types to listen for
-
removeListenFor
public void removeListenFor(int[] types) Remove a type or types(s) that were previously registered as something to listen for. If one or more of the values were not previously registered we ignore that value.- Specified by:
removeListenFor
in interfaceFrameStateManager
- Parameters:
types
- An array of types to remove
-
clear
public void clear()Force clearing all state from this manager now. This is used to indicate that a new world is about to be loaded and everything should be cleaned out now.- Specified by:
clear
in interfaceFrameStateManager
-
frameFinished
public void frameFinished()Notification that the current frame is finished. This should never be called by user code (node implementations). The only caller should be the rendering traversal code that is specific to each engine.- Specified by:
frameFinished
in interfaceFrameStateManager
-
registerRemovedNode
Register a node that has been removed this frame. The caller should make sure the reference count has already been decremented before calling this method.- Specified by:
registerRemovedNode
in interfaceFrameStateManager
- Parameters:
node
- The reference to the node that has been removed
-
registerRemovedNodes
Register nodes that have been removed this frame. The caller should make sure the reference count has already been decremented before calling this method.- Specified by:
registerRemovedNodes
in interfaceFrameStateManager
- Parameters:
nodes
- The reference to the nodes that has been removed
-
registerAddedNode
Register a node that has been added this frame. The caller should make sure the reference count has already been decremented before calling this method.- Specified by:
registerAddedNode
in interfaceFrameStateManager
- Parameters:
node
- The reference to the node that has been removed
-
registerAddedNodes
Register nodes that have been added this frame. The caller should make sure the reference count has already been decremented before calling this method.- Specified by:
registerAddedNodes
in interfaceFrameStateManager
- Parameters:
nodes
- The reference to the nodes that has been removed
-
registerAddedScene
Register an execution space that has been added in this frame.- Specified by:
registerAddedScene
in interfaceFrameStateManager
- Parameters:
space
- The space that has been added this frame
-
registerRemovedScene
Register an execution space that has been removed in this frame.- Specified by:
registerRemovedScene
in interfaceFrameStateManager
- Parameters:
space
- The space that has been added this frame
-
registerAddedExternProto
Register an externproto declaration as having been loaded this frame. This will be automatically registered as a URL node.- Specified by:
registerAddedExternProto
in interfaceFrameStateManager
- Parameters:
proto
- The proto declaration instance to add
-
clearRemovedNodes
public void clearRemovedNodes()Clear all registered removed nodes now.- Specified by:
clearRemovedNodes
in interfaceFrameStateManager
-
clearAddedNodes
public void clearAddedNodes()Clear all registered added nodes now.- Specified by:
clearAddedNodes
in interfaceFrameStateManager
-
clearAddedScenes
public void clearAddedScenes()Clear all registered added scenes now- Specified by:
clearAddedScenes
in interfaceFrameStateManager
-
clearRemovedScenes
public void clearRemovedScenes()Clear all registered added scenes now- Specified by:
clearRemovedScenes
in interfaceFrameStateManager
-
getRemovedNodes
Get all the removed nodes of the named type. This shall return an array all the time regardless of whether there is something to process or not. If there is nothing to process, the list shall be empty.- Specified by:
getRemovedNodes
in interfaceFrameStateManager
- Parameters:
type
- The TypeConstant primary type to get the list for- Returns:
- The list of nodes that need to be processed
-
getRemovedScripts
Get all the removed script nodes.- Specified by:
getRemovedScripts
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getRemovedSensors
Get the removed sensors.- Specified by:
getRemovedSensors
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getRemovedViewDependents
Get the list of nodes that require view-dependent updates.- Specified by:
getRemovedViewDependents
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getRemovedBindables
Get all the removed bindable nodes. This shall return an array all the time regardless of whether there is something to process or not. If there is nothing to process, the list shall be empty.- Specified by:
getRemovedBindables
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getRemovedScenes
public org.j3d.util.ObjectArray getRemovedScenes()Get the removed scenes.- Specified by:
getRemovedScenes
in interfaceFrameStateManager
- Returns:
- The list of scenes that need to be processed
-
getRemovedTerrains
Get the removed nodes from this last frame of this specified type. This shall return an array all the time regardless of whether there is something to process or not. If there is nothing to process, the list shall be empty.- Specified by:
getRemovedTerrains
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getRemovedExtSynchronizedNodes
Get the removed externally synchronised nodes from this last frame. This shall return an array all the time regardless of whether there is something to process or not. If there is nothing to process, the list shall be empty.- Specified by:
getRemovedExtSynchronizedNodes
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getAddedNodes
Get all the added nodes of the named type. This shall return an array all the time regardless of whether there is something to process or not. If there is nothing to process, the list shall be empty.- Specified by:
getAddedNodes
in interfaceFrameStateManager
- Parameters:
type
- The TypeConstant primary type to get the list for- Returns:
- The list of nodes that need to be processed
-
getAddedSensors
Get the added Sensors.- Specified by:
getAddedSensors
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getAddedScenes
public org.j3d.util.ObjectArray getAddedScenes()Get the scenes that have inserted during this last frame. The scenes are the guts of an externproto or inline node that will need fitting into the processing mechanism. This shall return an array all the time regardless of whether there is something to process or not. If there is nothing to process, the list shall be empty. The contents of the array shall be instances ofVRMLExecutionSpace
.- Specified by:
getAddedScenes
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getAddedUrlNodes
Get the added nodes with URL fields that will need to have their content loaded for the first time. This list should not include scripts.- Specified by:
getAddedUrlNodes
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getAddedScripts
Get the added scripts from this last frame.- Specified by:
getAddedScripts
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getAddedViewDependents
Get the list of nodes that require view-dependent updates.- Specified by:
getAddedViewDependents
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getAddedBindables
Get the added bindable nodes from this last frame. This shall return an array all the time regardless of whether there is something to process or not. If there is nothing to process, the list shall be empty.- Specified by:
getAddedBindables
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getAddedTerrains
Get the added terrain sources from this last frame. This shall return an array all the time regardless of whether there is something to process or not. If there is nothing to process, the list shall be empty.- Specified by:
getAddedTerrains
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getAddedExtSynchronizedNodes
Get the added externally synchronised nodes from this last frame. This shall return an array all the time regardless of whether there is something to process or not. If there is nothing to process, the list shall be empty.- Specified by:
getAddedExtSynchronizedNodes
in interfaceFrameStateManager
- Returns:
- The list of nodes that need to be processed
-
getAddedExternProtos
Get the added extern proto instances.- Specified by:
getAddedExternProtos
in interfaceFrameStateManager
- Returns:
- The list of templates that need to be processed
-
observedNode
Notification of a child node.- Specified by:
observedNode
in interfaceSceneGraphTraversalSimpleObserver
- Parameters:
parent
- The parent node of this nodechild
- The child node that is being observedfield
- The index of the child field in its parent nodeused
- true if the node reference is actually a USE
-