Added a vector4f based populate method.

experimental
Paul Speed 9 years ago
parent c39788d4fa
commit d4c94bc7c0
  1. 19
      jme3-core/src/main/java/com/jme3/util/BufferUtils.java

@ -401,6 +401,25 @@ public final class BufferUtils {
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.
*

Loading…
Cancel
Save