com.threerings.opengl.geometry
Class DynamicGeometry

java.lang.Object
  extended by com.threerings.opengl.geometry.Geometry
      extended by com.threerings.opengl.geometry.DynamicGeometry
Direct Known Subclasses:
ParticleGeometry

public abstract class DynamicGeometry
extends Geometry

Base class for dynamic geometry.


Field Summary
protected  BufferObject _arrayBuffer
          The VBO, if we're using one.
protected  float[] _data
          The vertex data.
protected  FloatBuffer _floatArray
          The float array.
protected static FloatBuffer _scratchBuffer
          The shared scratch buffer used to hold vertex data before copying to the VBO.
 
Fields inherited from class com.threerings.opengl.geometry.Geometry
EMPTY
 
Constructor Summary
protected DynamicGeometry()
          Constructor for subclasses.
  DynamicGeometry(float[] data, BufferObject arrayBuffer)
          Creates a new dynamic geometry that will draw from a VBO.
  DynamicGeometry(float[] data, BufferObject arrayBuffer, FloatBuffer floatArray)
          Creates a new dynamic geometry.
  DynamicGeometry(float[] data, FloatBuffer floatArray)
          Creates a new dynamic geometry that will draw directly from a float buffer.
 
Method Summary
protected static FloatBuffer getScratchBuffer(int size)
          Returns a reference to the scratch buffer, (re)creating it if necessary to provide the supplied size.
 boolean requiresUpdate()
          Checks whether this geometry requires a call to its Geometry.update() method before rendering.
 void update()
          Updates the state of the geometry.
protected abstract  void updateData()
          Updates the vertex data.
 
Methods inherited from class com.threerings.opengl.geometry.Geometry
getArrayState, getBoneMatrices, getCenter, getCoordSpace, getDrawCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_data

protected float[] _data
The vertex data.


_arrayBuffer

protected BufferObject _arrayBuffer
The VBO, if we're using one.


_floatArray

protected FloatBuffer _floatArray
The float array.


_scratchBuffer

protected static FloatBuffer _scratchBuffer
The shared scratch buffer used to hold vertex data before copying to the VBO.

Constructor Detail

DynamicGeometry

public DynamicGeometry(float[] data,
                       BufferObject arrayBuffer)
Creates a new dynamic geometry that will draw from a VBO.

Parameters:
data - the array from which vertex data will be copied at each update.
arrayBuffer - the VBO into which the vertex data will be copied.

DynamicGeometry

public DynamicGeometry(float[] data,
                       FloatBuffer floatArray)
Creates a new dynamic geometry that will draw directly from a float buffer.

Parameters:
data - the array from which vertex data will be copied at each update.
floatArray - the buffer into which vertex data will be copied.

DynamicGeometry

public DynamicGeometry(float[] data,
                       BufferObject arrayBuffer,
                       FloatBuffer floatArray)
Creates a new dynamic geometry.

Parameters:
data - the array from which vertex data will be copied at each update.
arrayBuffer - the VBO into which the vertex data will be copied, or null for none.
floatArray - the buffer into which vertex data will be copied, or null if using a VBO.

DynamicGeometry

protected DynamicGeometry()
Constructor for subclasses.

Method Detail

requiresUpdate

public boolean requiresUpdate()
Description copied from class: Geometry
Checks whether this geometry requires a call to its Geometry.update() method before rendering.

Overrides:
requiresUpdate in class Geometry

update

public void update()
Description copied from class: Geometry
Updates the state of the geometry.

Overrides:
update in class Geometry

updateData

protected abstract void updateData()
Updates the vertex data.


getScratchBuffer

protected static FloatBuffer getScratchBuffer(int size)
Returns a reference to the scratch buffer, (re)creating it if necessary to provide the supplied size.