com.threerings.opengl.scene
Class Scene

java.lang.Object
  extended by com.threerings.expr.DynamicScope
      extended by com.threerings.opengl.scene.Scene
All Implemented Interfaces:
Scope, ScopeUpdateListener, Compositable, Tickable
Direct Known Subclasses:
HashScene, SimpleScene

public abstract class Scene
extends DynamicScope
implements Tickable, Compositable

Base class for scenes.


Nested Class Summary
static class Scene.Transient
          Extends the normal model class to include an optional pre-tick updater.
 
Field Summary
 
Fields inherited from interface com.threerings.expr.Scope
EPOCH, NOW
 
Constructor Summary
Scene(GlContext ctx)
          Creates a new scene.
Scene(GlContext ctx, int sources)
          Creates a new scene.
 
Method Summary
 void add(SceneElement element)
          Adds an element to this scene.
 void add(SceneInfluence influence)
          Adds an influence to this scene.
 void add(ViewerEffect effect)
          Adds a viewer effect to this scene.
 void addAll(SceneElement[] elements)
          Adds all of the specified elements to the scene.
 void boundsDidChange(SceneElement element)
          Notes that the specified scene element's bounds have changed.
 void boundsDidChange(SceneInfluence influence)
          Notes that the specified influence's bounds have changed.
 void boundsDidChange(ViewerEffect effect)
          Notes that the specified effect's bounds have changed.
 void boundsWillChange(SceneElement element)
          Notes that the specified scene element's bounds are about to change.
 void boundsWillChange(SceneInfluence influence)
          Notes that the specified influence's bounds are about to change.
 void boundsWillChange(ViewerEffect effect)
          Notes that the specified effect's bounds are about to change.
 void clearEffects()
          Clears any viewer effects (when called outside the tick method).
 void dispose()
          Releases the resources associated with this scope.
 void dumpViewerEffects()
          Writes the set of active viewer effects out to the log.
 int getAlwaysTickCount()
          Returns the size of the list of elements that we tick on every frame.
abstract  void getEffects(Box bounds, Collection<ViewerEffect> results)
          Retrieves all viewer effects whose bounds intersect the provided region.
abstract  void getElements(Box bounds, Collection<SceneElement> results)
          Retrieves all scene elements whose bounds intersect the provided region.
 Scene.Transient getFromTransientPool(ConfigReference<ModelConfig> ref)
          Returns an instance of the referenced model from the transient pool.
abstract  void getInfluences(Box bounds, Collection<SceneInfluence> results)
          Retrieves all scene influences whose bounds intersect the provided region.
 SceneElement getIntersection(Ray3D ray, Vector3f location)
          Checks for an intersection between the provided ray and the contents of the scene.
abstract  SceneElement getIntersection(Ray3D ray, Vector3f location, Predicate<? super SceneElement> filter)
          Checks for an intersection between the provided ray and the contents of the scene.
 int getUpdateInfluencesCount()
          Returns the size of the set of elements whose influences must be updated.
 int getViewerEffectCount()
          Returns the number of effects acting upon the viewer.
 int getVisibleTickCount()
          Returns the size of the set of elements that we are going to tick because they're visible.
 void remove(SceneElement element)
          Removes an element from the scene.
 void remove(SceneElement element, boolean clearParentScope)
          Removes an element from the scene.
 void remove(SceneInfluence influence)
          Removes an influence from this scene.
 void remove(ViewerEffect effect)
          Removes a viewer effect from this scene.
 void removeAll(SceneElement[] elements)
          Removes all of the specified elements from the scene.
 void removeAll(SceneElement[] elements, boolean clearParentScopes)
          Removes all of the specified elements from the scene.
 void returnToTransientPool(Scene.Transient model)
          Returns a model to the transient pool.
 Scene.Transient spawnTransient(ConfigReference<ModelConfig> ref, Transform3D transform)
          Spawns a transient model.
 void tick(float elapsed)
          Updates the state of this object based on the elapsed time in seconds.
 void tickPolicyDidChange(SceneElement element)
          Notes that the specified scene element's tick policy has changed.
 void tickPolicyWillChange(SceneElement element)
          Notes that the specified scene element's tick policy is about to change.
 
Methods inherited from class com.threerings.expr.DynamicScope
addListener, endCompoundUpdate, get, getParentScope, getScopeName, put, remove, removeListener, scopeUpdated, setParentScope, startCompoundUpdate, wasUpdated
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.threerings.opengl.compositor.Compositable
composite
 

Constructor Detail

Scene

public Scene(GlContext ctx)
Creates a new scene.


Scene

public Scene(GlContext ctx,
             int sources)
Creates a new scene.

Parameters:
sources - the number of simultaneous sound sources to allow.
Method Detail

spawnTransient

@Scoped
public Scene.Transient spawnTransient(ConfigReference<ModelConfig> ref,
                                             Transform3D transform)
Spawns a transient model.


getFromTransientPool

@Scoped
public Scene.Transient getFromTransientPool(ConfigReference<ModelConfig> ref)
Returns an instance of the referenced model from the transient pool.


returnToTransientPool

@Scoped
public void returnToTransientPool(Scene.Transient model)
Returns a model to the transient pool.


addAll

public void addAll(SceneElement[] elements)
Adds all of the specified elements to the scene.


add

public void add(SceneElement element)
Adds an element to this scene.


removeAll

public void removeAll(SceneElement[] elements)
Removes all of the specified elements from the scene.


removeAll

public void removeAll(SceneElement[] elements,
                      boolean clearParentScopes)
Removes all of the specified elements from the scene.

Parameters:
clearParentScopes - if true and the element is an instance of DynamicScope, set the element's parent scope to null.

remove

public void remove(SceneElement element)
Removes an element from the scene.


remove

public void remove(SceneElement element,
                   boolean clearParentScope)
Removes an element from the scene.

Parameters:
clearParentScope - if true and the element is an instance of DynamicScope, set the element's parent scope to null.

add

public void add(SceneInfluence influence)
Adds an influence to this scene.


remove

public void remove(SceneInfluence influence)
Removes an influence from this scene.


add

public void add(ViewerEffect effect)
Adds a viewer effect to this scene.


remove

public void remove(ViewerEffect effect)
Removes a viewer effect from this scene.


getIntersection

public SceneElement getIntersection(Ray3D ray,
                                    Vector3f location)
Checks for an intersection between the provided ray and the contents of the scene.

Parameters:
location - a vector to populate with the location of the intersection, if any.
Returns:
a reference to the first element intersected by the ray, or null for none.

getIntersection

public abstract SceneElement getIntersection(Ray3D ray,
                                             Vector3f location,
                                             Predicate<? super SceneElement> filter)
Checks for an intersection between the provided ray and the contents of the scene.

Parameters:
filter - a predicate to use in filtering the results of the test.
location - a vector to populate with the location of the intersection, if any.
Returns:
a reference to the first element intersected by the ray, or null for none.

getElements

public abstract void getElements(Box bounds,
                                 Collection<SceneElement> results)
Retrieves all scene elements whose bounds intersect the provided region.

Parameters:
results - a list to hold the results of the search.

getInfluences

public abstract void getInfluences(Box bounds,
                                   Collection<SceneInfluence> results)
Retrieves all scene influences whose bounds intersect the provided region.


getEffects

public abstract void getEffects(Box bounds,
                                Collection<ViewerEffect> results)
Retrieves all viewer effects whose bounds intersect the provided region.


getAlwaysTickCount

public int getAlwaysTickCount()
Returns the size of the list of elements that we tick on every frame.


getVisibleTickCount

public int getVisibleTickCount()
Returns the size of the set of elements that we are going to tick because they're visible.


getUpdateInfluencesCount

public int getUpdateInfluencesCount()
Returns the size of the set of elements whose influences must be updated.


getViewerEffectCount

public int getViewerEffectCount()
Returns the number of effects acting upon the viewer.


dumpViewerEffects

public void dumpViewerEffects()
Writes the set of active viewer effects out to the log.


tickPolicyWillChange

public void tickPolicyWillChange(SceneElement element)
Notes that the specified scene element's tick policy is about to change. Will be followed by a call to tickPolicyDidChange(com.threerings.opengl.scene.SceneElement) when the change has been effected.


tickPolicyDidChange

public void tickPolicyDidChange(SceneElement element)
Notes that the specified scene element's tick policy has changed.


boundsWillChange

public void boundsWillChange(SceneElement element)
Notes that the specified scene element's bounds are about to change. Will be followed by a call to boundsDidChange(SceneElement) when the change has been effected.


boundsDidChange

public void boundsDidChange(SceneElement element)
Notes that the specified scene element's bounds have changed.


boundsWillChange

public void boundsWillChange(SceneInfluence influence)
Notes that the specified influence's bounds are about to change. Will be followed by a call to boundsDidChange(SceneInfluence) when the change has been effected.


boundsDidChange

public void boundsDidChange(SceneInfluence influence)
Notes that the specified influence's bounds have changed.


boundsWillChange

public void boundsWillChange(ViewerEffect effect)
Notes that the specified effect's bounds are about to change. Will be followed by a call to boundsDidChange(ViewerEffect) when the change has been effected.


boundsDidChange

public void boundsDidChange(ViewerEffect effect)
Notes that the specified effect's bounds have changed.


clearEffects

public void clearEffects()
Clears any viewer effects (when called outside the tick method).


tick

public void tick(float elapsed)
Description copied from interface: Tickable
Updates the state of this object based on the elapsed time in seconds.

Specified by:
tick in interface Tickable

dispose

public void dispose()
Description copied from class: DynamicScope
Releases the resources associated with this scope.

Overrides:
dispose in class DynamicScope


Copyright © 2011. All Rights Reserved.