com.threerings.tudey.client.util
Class ShapeConfigElement

java.lang.Object
  extended by com.threerings.opengl.util.SimpleRenderable
      extended by com.threerings.opengl.util.SimpleTransformable
          extended by com.threerings.opengl.scene.SimpleSceneElement
              extended by com.threerings.tudey.client.util.ShapeConfigElement
All Implemented Interfaces:
Compositable, Enqueueable, SceneElement, SceneObject, Intersectable, Tickable

public class ShapeConfigElement
extends SimpleSceneElement

Draws a shape from its config.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.opengl.scene.SceneElement
SceneElement.TickPolicy
 
Field Summary
protected  DisplayList _list
          The display list containing the shape draw commands.
protected  Box _localBounds
          The local bounds of the shape.
protected  Shape _shape
          The untransformed shape, or null if non-intersectable.
 
Fields inherited from class com.threerings.opengl.scene.SimpleSceneElement
_bounds, _influences, _lastVisit, _nbounds, _scene, _tickPolicy, _userObject
 
Fields inherited from class com.threerings.opengl.util.SimpleTransformable
_transform
 
Fields inherited from class com.threerings.opengl.util.SimpleRenderable
_batch, _ctx, _priority, _queue
 
Constructor Summary
ShapeConfigElement(GlContext ctx)
          Creates a new shape config element.
 
Method Summary
protected  RenderState[] createStates()
          Creates the state set for this object.
protected  void draw()
          Draws the geometry in immediate mode.
 Color4f getColor()
          Returns a reference to the outline color.
 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).
protected  Box getLocalBounds()
          Returns the local bounds of the element.
 void setConfig(ShapeConfig config, boolean outline)
          Sets the configuration of the shape to draw.
 
Methods inherited from class com.threerings.opengl.scene.SimpleSceneElement
boundsDidChange, boundsWillChange, computeBounds, getBounds, getTickPolicy, getUserObject, setInfluences, setTickPolicy, setTransform, setUserObject, tick, updateBounds, updateLastVisit, wasAdded, willBeRemoved
 
Methods inherited from class com.threerings.opengl.util.SimpleTransformable
enqueue, getCenter, getTransform
 
Methods inherited from class com.threerings.opengl.util.SimpleRenderable
composite, createBatch, getStates
 
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

_localBounds

protected Box _localBounds
The local bounds of the shape.


_list

protected DisplayList _list
The display list containing the shape draw commands.


_shape

protected Shape _shape
The untransformed shape, or null if non-intersectable.

Constructor Detail

ShapeConfigElement

public ShapeConfigElement(GlContext ctx)
Creates a new shape config element.

Method Detail

setConfig

public void setConfig(ShapeConfig config,
                      boolean outline)
Sets the configuration of the shape to draw.

Parameters:
outline - if true, draw the outline of the shape; if false, draw the solid form.

getColor

public Color4f getColor()
Returns a reference to the outline color.


createStates

protected RenderState[] createStates()
Description copied from class: SimpleRenderable
Creates the state set for this object.

Overrides:
createStates in class SimpleTransformable

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

getLocalBounds

protected Box getLocalBounds()
Description copied from class: SimpleSceneElement
Returns the local bounds of the element. Default implementation returns Box.ZERO; override to return actual local bounds.

Overrides:
getLocalBounds in class SimpleSceneElement

draw

protected void draw()
Description copied from class: SimpleRenderable
Draws the geometry in immediate mode.

Overrides:
draw in class SimpleRenderable