com.threerings.opengl.scene
Class SimpleSceneElement

java.lang.Object
  extended by com.threerings.opengl.util.SimpleRenderable
      extended by com.threerings.opengl.util.SimpleTransformable
          extended by com.threerings.opengl.scene.SimpleSceneElement
All Implemented Interfaces:
Compositable, Enqueueable, SceneElement, SceneObject, Intersectable, Tickable
Direct Known Subclasses:
AreaElement, RectangleElement, ShapeConfigElement, ShapeSceneElement, TextBillboard

public abstract class SimpleSceneElement
extends SimpleTransformable
implements SceneElement

Extends SimpleTransformable and provides a basic implementation of the SceneElement interface.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.opengl.scene.SceneElement
SceneElement.TickPolicy
 
Constructor Summary
SimpleSceneElement(GlContext ctx)
          Creates a new scene element.
SimpleSceneElement(GlContext ctx, String queue)
          Creates a new simple scene element.
SimpleSceneElement(GlContext ctx, String queue, int priority)
          Creates a new simple scene element.
SimpleSceneElement(GlContext ctx, String queue, int priority, boolean modifiesColorState, int primitiveCount)
          Creates a new simple scene element.
 
Method Summary
 Box getBounds()
          Returns a reference to the bounds of the object.
 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 policy that determines when the Tickable.tick(float) method must be called.
 Object getUserObject()
          Returns this element's user object reference.
 void setInfluences(SceneInfluenceSet influences)
          Sets the influences affecting this element.
 void setTickPolicy(SceneElement.TickPolicy policy)
          Sets the element's tick policy.
 void setTransform(Transform3D transform)
          Sets the transform to the specified value and promotes it to Transform3D.UNIFORM, then updates the bounds of the element.
 void setUserObject(Object object)
          Sets the element's user object reference.
 void tick(float elapsed)
          Updates the state of this object based on the elapsed time in seconds.
 void updateBounds()
          Updates the bounds of the element.
 boolean updateLastVisit(int visit)
          Checks and updates the last visit value.
 void wasAdded(Scene scene)
          Notes that the element was added to the specified scene.
 void willBeRemoved()
          Notes that the element will be removed from the scene.
 
Methods inherited from class com.threerings.opengl.util.SimpleTransformable
enqueue, getTransform
 
Methods inherited from class com.threerings.opengl.util.SimpleRenderable
composite, getStates
 
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

SimpleSceneElement

public SimpleSceneElement(GlContext ctx)
Creates a new scene element.


SimpleSceneElement

public SimpleSceneElement(GlContext ctx,
                          String queue)
Creates a new simple scene element.

Parameters:
queue - the name of the queue into which we place the batch.

SimpleSceneElement

public SimpleSceneElement(GlContext ctx,
                          String queue,
                          int priority)
Creates a new simple scene element.

Parameters:
queue - the name of the queue into which we place the batch.
priority - the priority level at which to enqueue the batch.

SimpleSceneElement

public SimpleSceneElement(GlContext ctx,
                          String queue,
                          int priority,
                          boolean modifiesColorState,
                          int primitiveCount)
Creates a new simple scene element.

Parameters:
queue - the name of the queue into which we place the batch.
priority - the priority level at which to enqueue the batch.
modifiesColorState - if true, invalidate the color state after calling the SimpleRenderable.draw() method.
primitiveCount - the primitive count to report to the renderer.
Method Detail

setTickPolicy

public void setTickPolicy(SceneElement.TickPolicy policy)
Sets the element's tick policy.


setUserObject

public void setUserObject(Object object)
Sets the element's user object reference.


setTransform

public void setTransform(Transform3D transform)
Sets the transform to the specified value and promotes it to Transform3D.UNIFORM, then updates the bounds of the element.


updateBounds

public void updateBounds()
Updates the bounds of the element. The default implementation transforms the bounds returned by getLocalBounds().


getTickPolicy

public SceneElement.TickPolicy getTickPolicy()
Description copied from interface: SceneElement
Returns the policy that determines when the Tickable.tick(float) method must be called.

Specified by:
getTickPolicy in interface SceneElement

getUserObject

public Object getUserObject()
Description copied from interface: SceneElement
Returns this element's user object reference.

Specified by:
getUserObject in interface SceneElement

wasAdded

public void wasAdded(Scene scene)
Description copied from interface: SceneElement
Notes that the element was added to the specified scene.

Specified by:
wasAdded in interface SceneElement

willBeRemoved

public void willBeRemoved()
Description copied from interface: SceneElement
Notes that the element will be removed from the scene.

Specified by:
willBeRemoved in interface SceneElement

setInfluences

public void setInfluences(SceneInfluenceSet influences)
Description copied from interface: SceneElement
Sets the influences affecting this element.

Specified by:
setInfluences in interface SceneElement

getBounds

public Box getBounds()
Description copied from interface: SceneObject
Returns a reference to the bounds of the object.

Specified by:
getBounds in interface SceneObject

updateLastVisit

public boolean updateLastVisit(int visit)
Description copied from interface: SceneObject
Checks and updates the last visit value. This is used to determine when we have visited (e.g., rendered) the object without having to clear a flag for all objects before performing the operation. Instead, we use a unique visitation id for each operation and assume that any object with that id has been visited already.

Specified by:
updateLastVisit in interface SceneObject
Returns:
true if the last visit value was not equal to the value provided (and has now been set to that value), false if the object had already been visited during the current operation.

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

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
Returns:
true if the ray intersected the object (in which case the result will contain the point of intersection), false otherwise.


Copyright © 2011. All Rights Reserved.