Class dnx.lr.Scene
All Packages Class Hierarchy This Package Previous Next Index
Class dnx.lr.Scene
java.lang.Object
|
+----dnx.util.DNXObject
|
+----dnx.util.DNXInstancedObject
|
+----dnx.util.DNXJavaStyleObservable
|
+----dnx.lr.Scene
- public class Scene
- extends DNXJavaStyleObservable
The "Scene" holds a scene graph. This is sort of the "master"
object for the VRML world. A scene contains Node objects describing
what's in the scene; however, each node object contains a SceneContext
backpointer rather than a Scene backpointer. The SceneContext is
a sanitized version of the Scene; this allows nodes to do only
the operations on a Scene that they're "supposed to" do.
A Scene is an DNXObservable in the sense that certain global scene
changes (SceneObserverEvents) can get noticed by the registered
observers. For example, if one of the Nodes requests that the
NavigationInfo be changed, the Scene will generate a SceneObserverEvent
and propagate it to any observers, e.g. a browser, which will change
the viewer between walk, fly, examine, etc.
-
DELIVER_EVENTS_PASS
-
-
FRAME_UPDATE_PASS
-
-
GLOBAL_PASS
-
-
NO_PASS
-
-
RECONCILE_VIEW_POSITIONS_PASS
-
-
REDISPLAY_PASS
-
-
Scene()
-
-
Scene(ReadAction)
-
-
Scene(ReadAction, boolean)
- Read in and create a new scene.
-
Scene(SceneContents)
- Create a live scene from a SceneContents object (a 'frozen' scene)
The SceneContents is not copied.
-
Scene(SceneContents, boolean)
- Create a live scene from a SceneContents object (a 'frozen' scene)
The SceneContents is not copied.
-
addRoute(Route)
-
-
addSyncNode(Node)
- Sync nodes are nodes that get a synchronization event after all normal
events have been processed.
-
addTimeSensor(Node)
-
-
addTopLevelNode(Node)
-
-
areEventsEnabled()
- Return whether event delivery is enabled.
-
beginFrame(long)
-
-
beginFrameUpdate()
-
-
beginGlobalPass()
-
-
beginReconcileViewPositions()
-
-
beginRedisplay()
-
-
bindNode(Node)
- Same as bindNodeInstance (node.getUniquifiedInstance()).
-
bindNodeInstance(NodeInstance)
- Bind a node instance.
-
countTopLevelNodes()
- Return the number of top-level nodes.
-
debugPrint()
-
-
deleteAllTopLevelNodes()
-
-
deleteRoute(Route)
-
-
deleteTopLevelNode(Node)
-
-
deliverEvents()
- Process all queued up events.
-
disableEvents()
- Disable event delivery.
-
discardEvents()
- Throw out any pending events.
-
doGlobalPass(RenderState)
-
-
enableEvents()
- Enable event delivery.
-
endFrame()
-
-
endFrameUpdate()
-
-
endGlobalPass()
-
-
endReconcileViewPositions()
-
-
endRedisplay()
-
-
enumerateNodesByName(String)
- Return an enumeration of all nodes in the main scene context
with the given name.
-
firstNodeWithName(String)
- Return a node in the main scene context the given name, if
such a node exists.
-
getBoundNodeInstance(Class)
- Get the currently bound node instance of a specified type;
returns null if no node of that type is bound.
-
getBoundNodeInstance(String)
- Get the currently bound node of a specified type (e.g.
-
getCurrentFrameRate()
- Return the current frame rate (in frames/second), if known
(otherwise 0).
-
getCurrentPass()
-
-
getCurrentSpeed()
- Return the speed at which the viewpoint is moving (in
meters/second), if known (otherwise 0).
-
getMediaFetcher()
- Get the currently installed media fetcher.
-
getRootNode()
- Return the root node of the scene -- self explanatory.
-
getRootNodeInstance()
- Return the root node instance of the scene -- self explanatory.
-
getRoute(Node, int, Node, int)
-
-
getSceneContext()
- Return the scene context corresponding to this scene.
-
getSceneURL()
- Return the URL from which the scene was described.
-
getTime()
- Return the current time in the scene.
-
getWorldInfo()
- Return an array of information strings; returns null if
there is no info.
-
getWorldName()
- Get the name of the world described by the scene; it will
have been set using setWorldName.
-
hasFakeGroupRootNode()
-
-
inFrame()
- Return whether we are currently processing a scene frame.
-
isBound(Node)
- See if a node is bound (i.e.
-
isBound(NodeInstance)
- See if a node instance is bound (i.e.
-
isOnBindingStack(Node)
- See if an instance of a node is somewhere on its respective binding
stack.
-
isOnBindingStack(NodeInstance)
- See if a node instance is somewhere on its respective binding
stack.
-
isStopped()
- Return whether the scene has been stopped with stop().
-
print(PrintAction)
- Print out the scene.
-
processEvents()
-
-
processSyncNodes()
-
-
processTimeSensors(double)
-
-
queueBypassingEvent(Field, Node, int)
- Queue a "bypassing" event to be delivered to a node.
-
removeSyncNode(Node)
-
-
removeTimeSensor(Node)
-
-
resetTime()
- Reset the time to zero.
-
resetTime(double)
- Reset the time to a specified value.
-
restart()
- Restart a scene; calls the restart() method on the nodes in the
scene.
-
setMediaFetcher(MediaFetcher)
- Set the media fetcher for the scene; the media fetcher is an
interface used by nodes to get image, audio, and other media.
-
setRootFromContents()
-
-
setWorldInfo(String[])
- Set the world information strings.
-
setWorldName(String)
- Set the name of the world described by the scene; this is
called from a WorldInfo node.
-
stop()
- Stop a scene; calls the stop() method on the nodes in the scene.
-
swapQueues()
-
-
unbindNode(Node)
- Unbind a node.
-
updateObservers(Object)
-
NO_PASS
public final static int NO_PASS
FRAME_UPDATE_PASS
public final static int FRAME_UPDATE_PASS
RECONCILE_VIEW_POSITIONS_PASS
public final static int RECONCILE_VIEW_POSITIONS_PASS
GLOBAL_PASS
public final static int GLOBAL_PASS
DELIVER_EVENTS_PASS
public final static int DELIVER_EVENTS_PASS
REDISPLAY_PASS
public final static int REDISPLAY_PASS
Scene
public Scene()
Scene
public Scene(ReadAction a,
boolean setRoot) throws MalformedURLException, IOException, VRMLSyntaxException
- Read in and create a new scene. The ReadAction specifies where
to read the VRML from, and can come from any of a number of sources
(URL, input stream, etc.).
@see ReadAction
Scene
public Scene(ReadAction a) throws MalformedURLException, IOException, VRMLSyntaxException
Scene
public Scene(SceneContents contents)
- Create a live scene from a SceneContents object (a 'frozen' scene)
The SceneContents is not copied.
Scene
public Scene(SceneContents contents,
boolean setRoot)
- Create a live scene from a SceneContents object (a 'frozen' scene)
The SceneContents is not copied. If setRoot is false,
don't actually set the root node yet. (Setting the root node
causes various SceneObserverEvents to get sent out, and you may
want to set things up after creating the scene so that these
events can be properly processed.)
updateObservers
public void updateObservers(Object obj)
- Overrides:
- updateObservers in class DNXJavaStyleObservable
enableEvents
public void enableEvents()
- Enable event delivery.
disableEvents
public void disableEvents()
- Disable event delivery.
areEventsEnabled
public boolean areEventsEnabled()
- Return whether event delivery is enabled.
setMediaFetcher
public void setMediaFetcher(MediaFetcher m)
- Set the media fetcher for the scene; the media fetcher is an
interface used by nodes to get image, audio, and other media.
getMediaFetcher
public MediaFetcher getMediaFetcher()
- Get the currently installed media fetcher.
getSceneContext
public SceneContext getSceneContext()
- Return the scene context corresponding to this scene.
setRootFromContents
public void setRootFromContents()
getRootNode
public Node getRootNode()
- Return the root node of the scene -- self explanatory.
getRootNodeInstance
public NodeInstance getRootNodeInstance()
- Return the root node instance of the scene -- self explanatory.
addTopLevelNode
public void addTopLevelNode(Node node)
deleteAllTopLevelNodes
public void deleteAllTopLevelNodes()
deleteTopLevelNode
public void deleteTopLevelNode(Node node)
countTopLevelNodes
public int countTopLevelNodes()
- Return the number of top-level nodes.
hasFakeGroupRootNode
public boolean hasFakeGroupRootNode()
getWorldName
public String getWorldName()
- Get the name of the world described by the scene; it will
have been set using setWorldName.
getWorldInfo
public String[] getWorldInfo()
- Return an array of information strings; returns null if
there is no info.
setWorldName
public void setWorldName(String name)
- Set the name of the world described by the scene; this is
called from a WorldInfo node.
setWorldInfo
public void setWorldInfo(String info[])
- Set the world information strings.
getCurrentSpeed
public float getCurrentSpeed()
- Return the speed at which the viewpoint is moving (in
meters/second), if known (otherwise 0).
getCurrentFrameRate
public float getCurrentFrameRate()
- Return the current frame rate (in frames/second), if known
(otherwise 0).
getSceneURL
public URL getSceneURL()
- Return the URL from which the scene was described. This can
be null (i.e. the scene came from a generic InputStream).
isBound
public synchronized boolean isBound(NodeInstance inst)
- See if a node instance is bound (i.e. on the top of its
respective binding stack).
isOnBindingStack
public synchronized boolean isOnBindingStack(NodeInstance inst)
- See if a node instance is somewhere on its respective binding
stack.
isBound
public synchronized boolean isBound(Node node)
- See if a node is bound (i.e. an instance of it is on the top of its
respective binding stack).
isOnBindingStack
public synchronized boolean isOnBindingStack(Node node)
- See if an instance of a node is somewhere on its respective binding
stack.
bindNodeInstance
public synchronized void bindNodeInstance(NodeInstance inst)
- Bind a node instance.
bindNode
public void bindNode(Node node)
- Same as bindNodeInstance (node.getUniquifiedInstance()).
unbindNode
public synchronized boolean unbindNode(Node node)
- Unbind a node. Returns true if the node was previously at the
top of its binding stack. (There is no unbindNodeInstance() because
its semantics could not be defined consistently given the VRML 2.0
spec's bindable-node behavior. If you want to remove the node
instance at the top of the stack, call getActualNode() and then
call unbindNode() on the result.)
getBoundNodeInstance
public synchronized NodeInstance getBoundNodeInstance(Class nodeClass)
- Get the currently bound node instance of a specified type;
returns null if no node of that type is bound.
getBoundNodeInstance
public synchronized NodeInstance getBoundNodeInstance(String nodeTypeName)
- Get the currently bound node of a specified type (e.g. "NavigationInfo",
"Fog"); returns null if no node of that type is bound.
restart
public void restart()
- Restart a scene; calls the restart() method on the nodes in the
scene.
stop
public void stop()
- Stop a scene; calls the stop() method on the nodes in the scene.
isStopped
public boolean isStopped()
- Return whether the scene has been stopped with stop().
firstNodeWithName
public Node firstNodeWithName(String name)
- Return a node in the main scene context the given name, if
such a node exists. Note that there may be more than one node
with the same name; use enumerateNodesByName() if you want
all of them. Note also that this will not return nodes in
sub-contexts (e.g. inside of loaded inlines or in prototypes).
enumerateNodesByName
public Enumeration enumerateNodesByName(String name)
- Return an enumeration of all nodes in the main scene context
with the given name. Note that this will not return nodes in
sub-contexts (e.g. inside of loaded inlines or in prototypes).
print
public void print(PrintAction a)
- Print out the scene. This prints out the root node and subgraph
thereof, and any prototypes and routes.
debugPrint
public void debugPrint()
beginFrame
public void beginFrame(long time)
endFrame
public void endFrame()
beginFrameUpdate
public void beginFrameUpdate()
endFrameUpdate
public void endFrameUpdate()
beginReconcileViewPositions
public void beginReconcileViewPositions()
endReconcileViewPositions
public void endReconcileViewPositions()
beginGlobalPass
public void beginGlobalPass()
endGlobalPass
public void endGlobalPass()
beginRedisplay
public void beginRedisplay()
endRedisplay
public void endRedisplay()
doGlobalPass
public void doGlobalPass(RenderState state)
deliverEvents
public synchronized void deliverEvents()
- Process all queued up events. Called at the end of each
render/process-events cycle. (When executing a VRML world in a
browser, we continually loop through this cycle.) The times
passed to the frame call must be in non-decreasing order; resetTime()
may be used to 'replay' a scene.
discardEvents
public synchronized void discardEvents()
- Throw out any pending events.
resetTime
public synchronized void resetTime(double time)
- Reset the time to a specified value.
resetTime
public synchronized void resetTime()
- Reset the time to zero.
getTime
public synchronized double getTime()
- Return the current time in the scene. The current time is
the argument of the last frame() or resetTime() call.
inFrame
public boolean inFrame()
- Return whether we are currently processing a scene frame.
The frame time is returned by calling getTime().
getCurrentPass
public int getCurrentPass()
addRoute
public void addRoute(Route r)
deleteRoute
public void deleteRoute(Route r)
getRoute
public Route getRoute(Node from,
int eventOut,
Node to,
int eventIn)
addTimeSensor
public void addTimeSensor(Node node)
removeTimeSensor
public void removeTimeSensor(Node node)
processTimeSensors
public void processTimeSensors(double time)
queueBypassingEvent
public void queueBypassingEvent(Field value,
Node node,
int eventIn)
- Queue a "bypassing" event to be delivered to a node.
This event bypasses routes and delivers directly to a particular
node. This exists to support some bogus aspects of the Script
interface.
addSyncNode
public void addSyncNode(Node node)
- Sync nodes are nodes that get a synchronization event after all normal
events have been processed. See processEvents()
removeSyncNode
public void removeSyncNode(Node node)
processSyncNodes
public void processSyncNodes()
processEvents
protected void processEvents()
swapQueues
protected synchronized void swapQueues()
All Packages Class Hierarchy This Package Previous Next Index