com.threerings.tudey.client.util
Class AreaElement

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.AreaElement
All Implemented Interfaces:
Compositable, Enqueueable, SceneElement, SceneObject, Intersectable, Tickable

public class AreaElement
extends SimpleSceneElement

Displays a solid area.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.opengl.scene.SceneElement
SceneElement.TickPolicy
 
Field Summary
protected  Vector3f _center
          The model space center.
protected  Triangle _triangle
          Triangle used for intersection testing.
protected  TudeySceneModel.Vertex[] _vertices
          The vertices of the area.
protected  boolean _visible
          Are we visible?
 
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
AreaElement(GlContext ctx)
          Creates a new area element.
 
Method Summary
protected  void computeBounds(Box result)
          Computes the bounds of the element and places them in the provided result object.
protected  RenderState[] createStates()
          Creates the state set for this object.
protected  void draw()
          Draws the geometry in immediate mode.
protected  Vector3f getCenter()
          Returns the transformable's model space center.
 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).
 void setVertices(TudeySceneModel.Vertex[] vertices)
          Sets the vertices of the area.
 void setVisible(boolean visible)
          Update the visibility.
 
Methods inherited from class com.threerings.opengl.scene.SimpleSceneElement
boundsDidChange, boundsWillChange, getBounds, getLocalBounds, getTickPolicy, getUserObject, setInfluences, setTickPolicy, setTransform, setUserObject, tick, updateBounds, updateLastVisit, wasAdded, willBeRemoved
 
Methods inherited from class com.threerings.opengl.util.SimpleTransformable
enqueue, 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

_vertices

protected TudeySceneModel.Vertex[] _vertices
The vertices of the area.


_center

protected Vector3f _center
The model space center.


_triangle

protected Triangle _triangle
Triangle used for intersection testing.


_visible

protected boolean _visible
Are we visible?

Constructor Detail

AreaElement

public AreaElement(GlContext ctx)
Creates a new area element.

Method Detail

setVertices

public void setVertices(TudeySceneModel.Vertex[] vertices)
Sets the vertices of the area.


getColor

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


setVisible

public void setVisible(boolean visible)
Update the visibility.


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.

createStates

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

Overrides:
createStates in class SimpleTransformable

computeBounds

protected void computeBounds(Box result)
Description copied from class: SimpleSceneElement
Computes the bounds of the element and places them in the provided result object. The default implementation simply transforms the bounds returned by SimpleSceneElement.getLocalBounds().

Overrides:
computeBounds in class SimpleSceneElement

draw

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

Overrides:
draw in class SimpleRenderable

getCenter

protected Vector3f getCenter()
Description copied from class: SimpleTransformable
Returns the transformable's model space center.

Overrides:
getCenter in class SimpleTransformable