com.threerings.tudey.shape.config
Class ShapeConfig

java.lang.Object
  extended by com.threerings.util.DeepObject
      extended by com.threerings.tudey.shape.config.ShapeConfig
All Implemented Interfaces:
Exportable, Streamable, Copyable, Cloneable
Direct Known Subclasses:
ShapeConfig.Capsule, ShapeConfig.Circle, ShapeConfig.Compound, ShapeConfig.Global, ShapeConfig.None, ShapeConfig.Point, ShapeConfig.Polygon, ShapeConfig.Rectangle, ShapeConfig.Segment

@EditorTypes(value={ShapeConfig.Point.class,ShapeConfig.Segment.class,ShapeConfig.Rectangle.class,ShapeConfig.Circle.class,ShapeConfig.Capsule.class,ShapeConfig.Polygon.class,ShapeConfig.Compound.class,ShapeConfig.Global.class})
public abstract class ShapeConfig
extends DeepObject
implements Exportable, Streamable

The configuration for a shape.


Nested Class Summary
static class ShapeConfig.Capsule
          A capsule.
static class ShapeConfig.Circle
          A circle.
static class ShapeConfig.Compound
          A compound shape.
static class ShapeConfig.Global
          A global shape.
static class ShapeConfig.None
          A non-shape.
static class ShapeConfig.Point
          A point.
static class ShapeConfig.Polygon
          A polygon.
static class ShapeConfig.Rectangle
          A rectangle.
static class ShapeConfig.Segment
          A line segment.
static class ShapeConfig.TransformedShape
          Combines a shape with its transform.
static class ShapeConfig.Vertex
          A single vertex in a polygon.
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
Streamable.Closure
 
Field Summary
protected  Box _bounds
          The untransformed bounds of the shape.
protected  SoftReference<DisplayList> _outlineList
          The display lists containing the solid and outline representations.
protected  Shape _shape
          The untransformed shape.
protected  SoftReference<DisplayList> _solidList
          The display lists containing the solid and outline representations.
protected static float CIRCLE_INCREMENT
          The increment angle between circle segments.
protected static int CIRCLE_SEGMENTS
          The number of segments to use when we render circles.
 
Constructor Summary
ShapeConfig()
           
 
Method Summary
protected abstract  Shape createShape()
          Creates the untransformed shape corresponding to this config.
protected abstract  void draw(boolean outline)
          Draws this shape in immediate mode.
 Box getBounds()
          Returns a reference to the untransformed bounds of the shape.
 DisplayList getList(GlContext ctx, boolean outline)
          Returns the cached display list to draw this shape.
 Shape getShape()
          Returns a reference to the untransformed shape.
 void invalidate()
          Invalidates any cached data.
 
Methods inherited from class com.threerings.util.DeepObject
clone, copy, copy, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_shape

@DeepOmit
protected transient Shape _shape
The untransformed shape.


_bounds

@DeepOmit
protected transient Box _bounds
The untransformed bounds of the shape.


_solidList

@DeepOmit
protected transient SoftReference<DisplayList> _solidList
The display lists containing the solid and outline representations.


_outlineList

@DeepOmit
protected transient SoftReference<DisplayList> _outlineList
The display lists containing the solid and outline representations.


CIRCLE_SEGMENTS

protected static final int CIRCLE_SEGMENTS
The number of segments to use when we render circles.

See Also:
Constant Field Values

CIRCLE_INCREMENT

protected static final float CIRCLE_INCREMENT
The increment angle between circle segments.

See Also:
Constant Field Values
Constructor Detail

ShapeConfig

public ShapeConfig()
Method Detail

getShape

public Shape getShape()
Returns a reference to the untransformed shape.


getBounds

public Box getBounds()
Returns a reference to the untransformed bounds of the shape.


getList

public DisplayList getList(GlContext ctx,
                           boolean outline)
Returns the cached display list to draw this shape.

Parameters:
outline - if true, return the outline list; otherwise, the solid list.

invalidate

public void invalidate()
Invalidates any cached data.


createShape

protected abstract Shape createShape()
Creates the untransformed shape corresponding to this config.


draw

protected abstract void draw(boolean outline)
Draws this shape in immediate mode.

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