net.java.joglutils.msg.collections
Class Vec3fCollection

java.lang.Object
  extended by net.java.joglutils.msg.collections.Vec3fCollection

public class Vec3fCollection
extends Object

Provides the abstraction of a collection of Vec3f objects while allowing access to the backing store in the form of a direct FloatBuffer to make it easy to pass down to OpenGL.


Constructor Summary
Vec3fCollection()
          Creates an empty Vec3fCollection.
Vec3fCollection(int estimatedSize)
          Creates an empty Vec3fCollection with the backing store sized to hold roughly the given number of vectors.
 
Method Summary
 void add(Vec3f value)
          Adds the given Vec3f to this collection, expanding it if necessary.
 Vec3f get(int index)
          Fetches the Vec3f at the given index.
 FloatBuffer getData()
          Returns the backing buffer of this collection.
 Vec3f remove(int index)
          Removes the given Vec3f from this collection.
 void set(int index, Vec3f value)
          Stores the given Vec3f at the given index.
 int size()
          Returns the number of Vec3fs currently in this collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Vec3fCollection

public Vec3fCollection()
Creates an empty Vec3fCollection.


Vec3fCollection

public Vec3fCollection(int estimatedSize)
Creates an empty Vec3fCollection with the backing store sized to hold roughly the given number of vectors.

Method Detail

size

public int size()
Returns the number of Vec3fs currently in this collection.


set

public void set(int index,
                Vec3f value)
         throws IndexOutOfBoundsException
Stores the given Vec3f at the given index. If the collection has not grown to the given size, throws an exception.

Throws:
IndexOutOfBoundsException

get

public Vec3f get(int index)
          throws IndexOutOfBoundsException
Fetches the Vec3f at the given index. If the collection has not grown to the given size, throws an exception.

Throws:
IndexOutOfBoundsException

add

public void add(Vec3f value)
Adds the given Vec3f to this collection, expanding it if necessary.


remove

public Vec3f remove(int index)
             throws IndexOutOfBoundsException
Removes the given Vec3f from this collection. Moves all Vec3fs above it down one slot.

Throws:
IndexOutOfBoundsException

getData

public FloatBuffer getData()
Returns the backing buffer of this collection.