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 SceneGraphTraverserTraverser used to handle added/removed nodes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a listener that is interested in knowing when the end of this frame is reached.voidclear()Force clearing all state from this manager now.voidClear all registered added nodes now.voidClear all registered added scenes nowvoidClear all registered removed nodes now.voidClear all registered added scenes nowvoidNotification 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.ObjectArrayGet 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.ObjectArrayGet 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.voidlistenFor(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.voidobservedNode(VRMLNodeType parent, VRMLNodeType child, int field, boolean used) Notification of a child node.voidRegister an externproto declaration as having been loaded this frame.voidregisterAddedNode(VRMLNode node) Register a node that has been added this frame.voidregisterAddedNodes(VRMLNode[] nodes) Register nodes that have been added this frame.voidRegister an execution space that has been added in this frame.voidregisterRemovedNode(VRMLNode node) Register a node that has been removed this frame.voidregisterRemovedNodes(VRMLNode[] nodes) Register nodes that have been removed this frame.voidRegister an execution space that has been removed in this frame.voidremoveListenFor(int[] types) Remove a type or types(s) that were previously registered as something to listen for.voidsetErrorReporter(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:
addEndOfThisFrameListenerin 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:
setErrorReporterin 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:
listenForin 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:
removeListenForin 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:
clearin 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:
frameFinishedin 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:
registerRemovedNodein 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:
registerRemovedNodesin 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:
registerAddedNodein 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:
registerAddedNodesin 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:
registerAddedScenein 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:
registerRemovedScenein 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:
registerAddedExternProtoin interfaceFrameStateManager- Parameters:
proto- The proto declaration instance to add
-
clearRemovedNodes
public void clearRemovedNodes()Clear all registered removed nodes now.- Specified by:
clearRemovedNodesin interfaceFrameStateManager
-
clearAddedNodes
public void clearAddedNodes()Clear all registered added nodes now.- Specified by:
clearAddedNodesin interfaceFrameStateManager
-
clearAddedScenes
public void clearAddedScenes()Clear all registered added scenes now- Specified by:
clearAddedScenesin interfaceFrameStateManager
-
clearRemovedScenes
public void clearRemovedScenes()Clear all registered added scenes now- Specified by:
clearRemovedScenesin 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:
getRemovedNodesin 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:
getRemovedScriptsin interfaceFrameStateManager- Returns:
- The list of nodes that need to be processed
-
getRemovedSensors
Get the removed sensors.- Specified by:
getRemovedSensorsin interfaceFrameStateManager- Returns:
- The list of nodes that need to be processed
-
getRemovedViewDependents
Get the list of nodes that require view-dependent updates.- Specified by:
getRemovedViewDependentsin 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:
getRemovedBindablesin interfaceFrameStateManager- Returns:
- The list of nodes that need to be processed
-
getRemovedScenes
public org.j3d.util.ObjectArray getRemovedScenes()Get the removed scenes.- Specified by:
getRemovedScenesin 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:
getRemovedTerrainsin 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:
getRemovedExtSynchronizedNodesin 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:
getAddedNodesin 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:
getAddedSensorsin 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:
getAddedScenesin 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:
getAddedUrlNodesin interfaceFrameStateManager- Returns:
- The list of nodes that need to be processed
-
getAddedScripts
Get the added scripts from this last frame.- Specified by:
getAddedScriptsin interfaceFrameStateManager- Returns:
- The list of nodes that need to be processed
-
getAddedViewDependents
Get the list of nodes that require view-dependent updates.- Specified by:
getAddedViewDependentsin 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:
getAddedBindablesin 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:
getAddedTerrainsin 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:
getAddedExtSynchronizedNodesin interfaceFrameStateManager- Returns:
- The list of nodes that need to be processed
-
getAddedExternProtos
Get the added extern proto instances.- Specified by:
getAddedExternProtosin interfaceFrameStateManager- Returns:
- The list of templates that need to be processed
-
observedNode
Notification of a child node.- Specified by:
observedNodein 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
-