Added a vector4f based populate method.
This commit is contained in:
parent
c39788d4fa
commit
d4c94bc7c0
@ -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.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user