com.threerings.opengl.model
Class Conditional

java.lang.Object
  extended by com.threerings.expr.SimpleScope
      extended by com.threerings.opengl.model.Model.Implementation
          extended by com.threerings.opengl.model.Conditional
All Implemented Interfaces:
Scope, ScopeUpdateListener, Compositable, Enqueueable, Intersectable, Tickable

public class Conditional
extends Model.Implementation
implements Enqueueable

A conditional model implementation.


Field Summary
protected  Model _active
          The active model.
protected  Box _bounds
          The bounds of the model.
protected  boolean _completed
          If true, the model has completed.
protected  ConditionalConfig _config
          The model config.
protected  GlContext _ctx
          The application context.
protected  MutableFloat _distance
          The distance to the camera.
protected  BooleanExpression.Evaluator[] _evaluators
          The evaluators for the cases.
protected  int _influenceFlags
          Flags indicating which influences can affect the model.
protected  Transform3D _localTransform
          The local transform.
protected  Model[] _models
          The case models.
protected  Transform3D _parentViewTransform
          The parent view transform.
protected  Transform3D _parentWorldTransform
          The parent world transform.
protected  SceneElement.TickPolicy _tickPolicy
          The model's tick policy.
protected  Transform3D _viewTransform
          The view transform.
protected  Transform3D _worldTransform
          The world transform.
 
Fields inherited from class com.threerings.expr.SimpleScope
_parentScope
 
Fields inherited from interface com.threerings.expr.Scope
EPOCH, NOW
 
Constructor Summary
Conditional(GlContext ctx, Scope parentScope, ConditionalConfig config)
          Creates a new conditional implementation.
 
Method Summary
 void composite()
          Adds this object's Dependencys and Enqueueables to the compositor in preparation for rendering.
 void drawBounds()
          Draws the bounds of the model in immediate mode.
 void enqueue()
          Enqueues this object for rendering.
 Box getBounds()
          Returns a reference to the bounds of the model.
 int getInfluenceFlags()
          Returns a set of flags indicating the types of influences that affect the model.
 boolean getIntersection(Ray3D ray, Vector3f result)
          Finds the intersection of a ray with this object and places it in the supplied vector (if it exists).
 SceneElement.TickPolicy getTickPolicy()
          Returns the tick policy of the model.
 boolean hasCompleted()
          Determines whether the model (such as a transient effect) has completed.
 void reset()
          Resets the state of this model.
 void setConfig(ConditionalConfig config)
          Sets the configuration of this model.
 void tick(float elapsed)
          Updates the state of this object based on the elapsed time in seconds.
protected  void updateActive()
          Updates the active model.
 void updateBounds()
          Updates the bounds of the model.
protected  void updateFromConfig()
          Updates the model to match its new or modified configuration.
 void wasAdded()
          Notes that the model was added to a scene.
 void willBeRemoved()
          Notes that the model will be removed from the scene.
 
Methods inherited from class com.threerings.opengl.model.Model.Implementation
attach, createAnimation, createSurface, createSurfaces, createSurfaces, detach, detachAll, getAnimation, getAnimations, getPlayingAnimations, getPointWorldTransform, getScopeName, isImplementation, setTickPolicy
 
Methods inherited from class com.threerings.expr.SimpleScope
addListener, dispose, get, getParentScope, removeListener, scopeUpdated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_ctx

protected GlContext _ctx
The application context.


_config

protected ConditionalConfig _config
The model config.


_evaluators

protected BooleanExpression.Evaluator[] _evaluators
The evaluators for the cases.


_models

protected Model[] _models
The case models.


_active

protected Model _active
The active model.


_parentWorldTransform

@Bound(value="worldTransform")
protected Transform3D _parentWorldTransform
The parent world transform.


_parentViewTransform

@Bound(value="viewTransform")
protected Transform3D _parentViewTransform
The parent view transform.


_localTransform

@Bound
protected Transform3D _localTransform
The local transform.


_worldTransform

@Scoped
protected Transform3D _worldTransform
The world transform.


_viewTransform

@Scoped
protected Transform3D _viewTransform
The view transform.


_distance

@Scoped
protected MutableFloat _distance
The distance to the camera.


_tickPolicy

protected SceneElement.TickPolicy _tickPolicy
The model's tick policy.


_influenceFlags

protected int _influenceFlags
Flags indicating which influences can affect the model.


_bounds

@Scoped
protected Box _bounds
The bounds of the model.


_completed

protected boolean _completed
If true, the model has completed.

Constructor Detail

Conditional

public Conditional(GlContext ctx,
                   Scope parentScope,
                   ConditionalConfig config)
Creates a new conditional implementation.

Method Detail

setConfig

public void setConfig(ConditionalConfig config)
Sets the configuration of this model.


enqueue

public void enqueue()
Description copied from interface: Enqueueable
Enqueues this object for rendering.

Specified by:
enqueue in interface Enqueueable

hasCompleted

public boolean hasCompleted()
Description copied from class: Model.Implementation
Determines whether the model (such as a transient effect) has completed.

Overrides:
hasCompleted in class Model.Implementation

reset

public void reset()
Description copied from class: Model.Implementation
Resets the state of this model.

Overrides:
reset in class Model.Implementation

getInfluenceFlags

public int getInfluenceFlags()
Description copied from class: Model.Implementation
Returns a set of flags indicating the types of influences that affect the model.

Overrides:
getInfluenceFlags in class Model.Implementation

getBounds

public Box getBounds()
Description copied from class: Model.Implementation
Returns a reference to the bounds of the model.

Overrides:
getBounds in class Model.Implementation

updateBounds

public void updateBounds()
Description copied from class: Model.Implementation
Updates the bounds of the model.

Overrides:
updateBounds in class Model.Implementation

drawBounds

public void drawBounds()
Description copied from class: Model.Implementation
Draws the bounds of the model in immediate mode.

Overrides:
drawBounds in class Model.Implementation

getTickPolicy

public SceneElement.TickPolicy getTickPolicy()
Description copied from class: Model.Implementation
Returns the tick policy of the model.

Overrides:
getTickPolicy in class Model.Implementation

wasAdded

public void wasAdded()
Description copied from class: Model.Implementation
Notes that the model was added to a scene.

Overrides:
wasAdded in class Model.Implementation

willBeRemoved

public void willBeRemoved()
Description copied from class: Model.Implementation
Notes that the model will be removed from the scene.

Overrides:
willBeRemoved in class Model.Implementation

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
Overrides:
tick in class Model.Implementation

getIntersection

public boolean getIntersection(Ray3D ray,
                               Vector3f result)
Description copied from interface: Intersectable
Finds the intersection of a ray with this object and places it in the supplied vector (if it exists).

Specified by:
getIntersection in interface Intersectable
Overrides:
getIntersection in class Model.Implementation
Returns:
true if the ray intersected the object (in which case the result will contain the point of intersection), false otherwise.

composite

public void composite()
Description copied from interface: Compositable
Adds this object's Dependencys and Enqueueables to the compositor in preparation for rendering.

Specified by:
composite in interface Compositable
Overrides:
composite in class Model.Implementation

updateFromConfig

protected void updateFromConfig()
Updates the model to match its new or modified configuration.


updateActive

protected void updateActive()
Updates the active model.