Skip to content

Commit d4c94bc

Browse files
committed
Added a vector4f based populate method.
1 parent c39788d commit d4c94bc

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

jme3-core/src/main/java/com/jme3/util/BufferUtils.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,25 @@ public static void populateFromBuffer(Vector3f vector, FloatBuffer buf, int inde
401401
vector.z = buf.get(index * 3 + 2);
402402
}
403403

404+
/**
405+
* Updates the values of the given vector from the specified buffer at the
406+
* index provided.
407+
*
408+
* @param vector
409+
* the vector to set data on
410+
* @param buf
411+
* the buffer to read from
412+
* @param index
413+
* the position (in terms of vectors, not floats) to read from
414+
* the buf
415+
*/
416+
public static void populateFromBuffer(Vector4f vector, FloatBuffer buf, int index) {
417+
vector.x = buf.get(index * 4);
418+
vector.y = buf.get(index * 4 + 1);
419+
vector.z = buf.get(index * 4 + 2);
420+
vector.w = buf.get(index * 4 + 3);
421+
}
422+
404423
/**
405424
* Generates a Vector3f array from the given FloatBuffer.
406425
*

0 commit comments

Comments
 (0)