j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class Scene

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.Scene

public class Scene
extends SceneGraphObject

Representation of the top level structure of a piece of scene graph that can form a coherent rendering.

A scene encapsulates a viewpoint that is used to view the scene from, the geometry structure to render, data defining the view environment (eg projection type) and global data, such as the background, global fog etc.

A scene may also provide an instance RenderEffectsProcessor that allows the user to provide pre or post processing effects on a per-scene basis. Note that if you are running layers, this will be pre and post processing per layer, not per final rendering. The processor allows a limited form of immediate-mode rendering.

Version:
$Revision: 1.6 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
Scene()
          Create a default instance of this scene with no content provided.
 
Method Summary
 Background getActiveBackground()
          Get the currently set active view.
 Fog getActiveFog()
          Get the currently set active view.
 Viewpoint getActiveView()
          Get the currently set active view.
 Group getRenderedGeometry()
          Get the root of the currently rendered scene.
 RenderEffectsProcessor getRenderEffectsProcessor()
          Get the currently set scene processor instance.
 java.lang.Object getUserData()
          Get the currently set instance of user data.
 ViewEnvironment getViewEnvironment()
          Get the currently set active view.
 void setActiveBackground(Background bg)
          Set the background path that should be applied to the current surface.
 void setActiveFog(Fog fog)
          Set the fog that should be applied to the current surface.
 void setActiveView(Viewpoint vp)
          Set the viewpoint path that should be applied to the current surface.
protected  void setLive(boolean state)
          Notification that this object is live now.
 void setRenderedGeometry(Group geom)
          Set the collection of geometry that should be rendered to this texture.
 void setRenderEffectsProcessor(RenderEffectsProcessor prc)
          Register the scene processor to be used for this scene for pre and post rendering effects.
protected  void setUpdateHandler(NodeUpdateHandler handler)
          Set the scenegraph update handler for this node.
 void setUserData(java.lang.Object data)
          Assign some arbitrary piece of user data to this scene.
 void setViewEnvironment(ViewEnvironment env)
          Set the view environment that is used to render this surface.
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, isLive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scene

public Scene()
Create a default instance of this scene with no content provided.

Method Detail

setLive

protected void setLive(boolean state)
Notification that this object is live now. Overridden to make sure that the live state of the nodes represents the same state as the parent scene graph.

Overrides:
setLive in class SceneGraphObject
Parameters:
state - true if this should be marked as live now

setUpdateHandler

protected void setUpdateHandler(NodeUpdateHandler handler)
Set the scenegraph update handler for this node. It will notify all its children of the value. A null value will clear the current handler.

Overrides:
setUpdateHandler in class SceneGraphObject
Parameters:
handler - The instance to use as a handler

setRenderEffectsProcessor

public void setRenderEffectsProcessor(RenderEffectsProcessor prc)
                               throws InvalidWriteTimingException
Register the scene processor to be used for this scene for pre and post rendering effects. Setting a null value will clear the current instance.

Parameters:
prc - The instance to use or null
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the ApplicationUpdateObserver callback method

getRenderEffectsProcessor

public RenderEffectsProcessor getRenderEffectsProcessor()
Get the currently set scene processor instance. If none is set, returns null.

Returns:
The current processor or null

setUserData

public void setUserData(java.lang.Object data)
Assign some arbitrary piece of user data to this scene. This data is also sent back to the user through scene processor callbacks when they are made. Setting a null value will clear the current instance.

Overrides:
setUserData in class SceneGraphObject
Parameters:
data - some arbitrary data the user wants to provide

getUserData

public java.lang.Object getUserData()
Get the currently set instance of user data. If none provided, return null.

Overrides:
getUserData in class SceneGraphObject
Returns:
Some arbitrary piece of data or null

setRenderedGeometry

public void setRenderedGeometry(Group geom)
                         throws InvalidWriteTimingException
Set the collection of geometry that should be rendered to this texture. A null value will clear the current geometry and result in only rendering the background, if set. if not set, then whatever the default colour is, is used (typically black).

Parameters:
geom - The new geometry to use or null
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the ApplicationUpdateObserver callback method

getRenderedGeometry

public Group getRenderedGeometry()
Get the root of the currently rendered scene. If none is set, this will return null.

Returns:
The current scene root or null.

setActiveView

public void setActiveView(Viewpoint vp)
                   throws InvalidWriteTimingException,
                          java.lang.IllegalArgumentException
Set the viewpoint path that should be applied to the current surface. The output drawn will be a combination of this information and that of the view environment.

Parameters:
vp - The instance of the active viewpoint to use
Throws:
java.lang.IllegalArgumentException - The path contains a SharedGroup or the node is not live
InvalidWriteTimingException - An attempt was made to write outside of the ApplicationUpdateObserver callback method

getActiveView

public Viewpoint getActiveView()
Get the currently set active view. If none is set, return null.

Returns:
The current view instance or null

setActiveFog

public void setActiveFog(Fog fog)
                  throws InvalidWriteTimingException,
                         java.lang.IllegalArgumentException
Set the fog that should be applied to the current surface. The output drawn will be a combination of this information and that of the view environment.

Parameters:
fog - The instance of the active fog node
Throws:
java.lang.IllegalArgumentException - The path contains a SharedGroup or the node is not live
InvalidWriteTimingException - An attempt was made to write outside of the ApplicationUpdateObserver callback method

getActiveFog

public Fog getActiveFog()
Get the currently set active view. If none is set, return null.

Returns:
The current view instance or null

setActiveBackground

public void setActiveBackground(Background bg)
                         throws InvalidWriteTimingException,
                                java.lang.IllegalArgumentException
Set the background path that should be applied to the current surface. The output drawn will be a combination of this information and that of the view environment.

Parameters:
bg - The instance of the active background
Throws:
java.lang.IllegalArgumentException - The path contains a SharedGroup or the node is not live
InvalidWriteTimingException - An attempt was made to write outside of the ApplicationUpdateObserver callback method

getActiveBackground

public Background getActiveBackground()
Get the currently set active view. If none is set, return null.

Returns:
The current view instance or null

setViewEnvironment

public void setViewEnvironment(ViewEnvironment env)
                        throws InvalidWriteTimingException,
                               java.lang.IllegalArgumentException
Set the view environment that is used to render this surface.

Parameters:
env - The environment instance to use for the render setup
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the ApplicationUpdateObserver callback method
java.lang.IllegalArgumentException

getViewEnvironment

public ViewEnvironment getViewEnvironment()
Get the currently set active view. If none is set, return null.

Returns:
The current view instance or null

j3d.org Aviatrix3D

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - j3d.org