|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.expr.DynamicScope
com.threerings.opengl.scene.Scene
public abstract class Scene
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 | |
|---|---|
protected ArrayList<SceneElement> |
_alwaysTick
The scene elements that we always tick. |
protected SoundClipManager |
_clipmgr
A sound clip manager for the scene. |
protected GlContext |
_ctx
The application context. |
protected boolean |
_disposed
Set when we've been disposed. |
protected ViewerEffectSet |
_effects
The effects currently acting on the viewer. |
protected SceneInfluenceSet |
_influences
Holds the influences affecting an element. |
protected ViewerEffectSet |
_neffects
Holds the new set of effects acting on the viewer. |
protected Vector3f |
_result
Result vector for intersection testing. |
protected SoundGroup |
_soundGroup
A sound group for the scene. |
protected ModelAdapter |
_transientObserver
Removes transient models and returns them to the pool when they complete. |
protected HashMap<ConfigReference,ArrayList<SoftReference<Scene.Transient>>> |
_transientPool
Pooled transient models. |
protected SceneElement[] |
_updateArray
Holds the scene elements while we're updating their influences. |
protected HashSet<SceneElement> |
_updateInfluences
The elements whose influence sets must be updated. |
protected int |
_updateInfluencesCount
The last count of the influences set. |
protected Box |
_viewer
The viewer volume. |
protected HashSet<SceneElement> |
_visible
The visible elements to tick. |
protected static int |
DEFAULT_SOURCES
The default number of sound sources to allow. |
| Fields inherited from class com.threerings.expr.DynamicScope |
|---|
_compoundDepth, _listeners, _owner, _parentScope, _scopeName, _symbols, INVALID_SCOPE |
| 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. |
|
protected abstract void |
addToSpatial(SceneElement element)
Adds an element to the scene's spatial data structure. |
|
protected abstract void |
addToSpatial(SceneInfluence influence)
Adds an influence to the scene's spatial data structure. |
|
protected abstract void |
addToSpatial(ViewerEffect effect)
Adds an effect to the scene's spatial data structure. |
|
protected void |
addToTick(SceneElement element)
Adds an element to the scene's tick data structure. |
|
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). |
|
protected void |
composite(ArrayList<SceneElement> elements,
Frustum frustum)
Composites a list of elements for rendering. |
|
protected void |
composite(SceneElement element)
Composites an element for rendering. |
|
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. |
|
protected static
|
getIntersecting(ArrayList<T> objects,
Box bounds,
Collection<T> results)
Adds all objects from the provided list that intersect the given bounds to the specified results list. |
|
protected SceneElement |
getIntersection(ArrayList<SceneElement> elements,
Ray3D ray,
Vector3f location,
com.google.common.base.Predicate<? super SceneElement> filter)
Searches for an intersection with the supplied elements. |
|
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,
com.google.common.base.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. |
|
protected abstract void |
removeFromSpatial(SceneElement element)
Removes an element from the scene's spatial data structure. |
|
protected abstract void |
removeFromSpatial(SceneInfluence influence)
Removes an influence from the scene's spatial data structure. |
|
protected abstract void |
removeFromSpatial(ViewerEffect effect)
Removes an effect from the scene's spatial data structure. |
|
protected void |
removeFromTick(SceneElement element)
Removes an element from the scene's tick data structure. |
|
void |
returnToTransientPool(Scene.Transient model)
Returns a model to the transient pool. |
|
protected void |
setEffects(ViewerEffectSet effects)
Sets the effects acting on the viewer. |
|
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 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.threerings.opengl.compositor.Compositable |
|---|
composite |
| Field Detail |
|---|
protected GlContext _ctx
protected ArrayList<SceneElement> _alwaysTick
protected HashSet<SceneElement> _visible
protected HashSet<SceneElement> _updateInfluences
protected int _updateInfluencesCount
protected SceneElement[] _updateArray
protected ViewerEffectSet _effects
protected HashMap<ConfigReference,ArrayList<SoftReference<Scene.Transient>>> _transientPool
protected ModelAdapter _transientObserver
@Scoped protected SoundGroup _soundGroup
@Scoped protected SoundClipManager _clipmgr
protected boolean _disposed
protected Box _viewer
protected SceneInfluenceSet _influences
protected Vector3f _result
protected ViewerEffectSet _neffects
protected static final int DEFAULT_SOURCES
| Constructor Detail |
|---|
public Scene(GlContext ctx)
public Scene(GlContext ctx,
int sources)
sources - the number of simultaneous sound sources to allow.| Method Detail |
|---|
@Scoped
public Scene.Transient spawnTransient(ConfigReference<ModelConfig> ref,
Transform3D transform)
@Scoped public Scene.Transient getFromTransientPool(ConfigReference<ModelConfig> ref)
@Scoped public void returnToTransientPool(Scene.Transient model)
public void addAll(SceneElement[] elements)
public void add(SceneElement element)
public void removeAll(SceneElement[] elements)
public void removeAll(SceneElement[] elements,
boolean clearParentScopes)
clearParentScopes - if true and the element is an instance of DynamicScope,
set the element's parent scope to null.public void remove(SceneElement element)
public void remove(SceneElement element,
boolean clearParentScope)
clearParentScope - if true and the element is an instance of DynamicScope,
set the element's parent scope to null.public void add(SceneInfluence influence)
public void remove(SceneInfluence influence)
public void add(ViewerEffect effect)
public void remove(ViewerEffect effect)
public SceneElement getIntersection(Ray3D ray,
Vector3f location)
location - a vector to populate with the location of the intersection, if any.
null for
none.
public abstract SceneElement getIntersection(Ray3D ray,
Vector3f location,
com.google.common.base.Predicate<? super SceneElement> filter)
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.
null for
none.
public abstract void getElements(Box bounds,
Collection<SceneElement> results)
results - a list to hold the results of the search.
public abstract void getInfluences(Box bounds,
Collection<SceneInfluence> results)
public abstract void getEffects(Box bounds,
Collection<ViewerEffect> results)
public int getAlwaysTickCount()
public int getVisibleTickCount()
public int getUpdateInfluencesCount()
public int getViewerEffectCount()
public void dumpViewerEffects()
public void tickPolicyWillChange(SceneElement element)
tickPolicyDidChange(com.threerings.opengl.scene.SceneElement) when the change has been effected.
public void tickPolicyDidChange(SceneElement element)
public void boundsWillChange(SceneElement element)
boundsDidChange(SceneElement) when the change has been effected.
public void boundsDidChange(SceneElement element)
public void boundsWillChange(SceneInfluence influence)
boundsDidChange(SceneInfluence) when the change has been effected.
public void boundsDidChange(SceneInfluence influence)
public void boundsWillChange(ViewerEffect effect)
boundsDidChange(ViewerEffect) when the change has been effected.
public void boundsDidChange(ViewerEffect effect)
public void clearEffects()
public void tick(float elapsed)
Tickable
tick in interface Tickablepublic void dispose()
DynamicScope
dispose in class DynamicScopeprotected void setEffects(ViewerEffectSet effects)
protected void addToTick(SceneElement element)
protected void removeFromTick(SceneElement element)
protected abstract void addToSpatial(SceneElement element)
protected abstract void removeFromSpatial(SceneElement element)
protected abstract void addToSpatial(SceneInfluence influence)
protected abstract void removeFromSpatial(SceneInfluence influence)
protected abstract void addToSpatial(ViewerEffect effect)
protected abstract void removeFromSpatial(ViewerEffect effect)
protected void composite(ArrayList<SceneElement> elements,
Frustum frustum)
protected final void composite(SceneElement element)
protected SceneElement getIntersection(ArrayList<SceneElement> elements,
Ray3D ray,
Vector3f location,
com.google.common.base.Predicate<? super SceneElement> filter)
protected static <T extends SceneObject> void getIntersecting(ArrayList<T> objects,
Box bounds,
Collection<T> results)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||