Added a vector4f based populate method.

This commit is contained in:
Paul Speed 2016-01-30 04:32:19 -05:00
parent c39788d4fa
commit d4c94bc7c0

View File

@ -401,6 +401,25 @@ public final class BufferUtils {
vector.z = buf.get(index * 3 + 2); vector.z = buf.get(index * 3 + 2);
} }
/**
* Updates the values of the given vector from the specified buffer at the
* index provided.
*
* @param vector
* the vector to set data on
* @param buf
* the buffer to read from
* @param index
* the position (in terms of vectors, not floats) to read from
* the buf
*/
public static void populateFromBuffer(Vector4f vector, FloatBuffer buf, int index) {
vector.x = buf.get(index * 4);
vector.y = buf.get(index * 4 + 1);
vector.z = buf.get(index * 4 + 2);
vector.w = buf.get(index * 4 + 3);
}
/** /**
* Generates a Vector3f array from the given FloatBuffer. * Generates a Vector3f array from the given FloatBuffer.
* *