Package com.jme3.util
Class BufferUtils
java.lang.Object
com.jme3.util.BufferUtils
BufferUtils
is a helper class for generating nio buffers from
jME data classes such as Vectors.-
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBuffer
createByteBuffer
(int size) Create a new ByteBuffer of the specified size.static FloatBuffer
createFloatBuffer
(float... data) Generate a new FloatBuffer using the given array of float primitives.static FloatBuffer
createFloatBuffer
(int size) Create a new FloatBuffer of the specified size.static FloatBuffer
createFloatBuffer
(Vector3f... data) Generate a new FloatBuffer using the given array of Vector3f objects.static IntBuffer
createIntBuffer
(int size) Create a new IntBuffer of the specified size.static IntBuffer
createIntBuffer
(int... data) Generate a new IntBuffer using the given array of ints.static ShortBuffer
createShortBuffer
(int size) Create a new ShortBuffer of the specified size.
-
Method Details
-
createFloatBuffer
Generate a new FloatBuffer using the given array of Vector3f objects. The FloatBuffer will be 3 * data.length long and contain the vector data as data[0].x, data[0].y, data[0].z, data[1].x... etc.- Parameters:
data
- array of Vector3f objects to place into a new FloatBuffer- Returns:
- a new direct, flipped FloatBuffer, or null if data was null
-
createFloatBuffer
Generate a new FloatBuffer using the given array of float primitives.- Parameters:
data
- array of float primitives to place into a new FloatBuffer- Returns:
- a new direct, flipped FloatBuffer, or null if data was null
-
createIntBuffer
Generate a new IntBuffer using the given array of ints. The IntBuffer will be data.length long and contain the int data as data[0], data[1]... etc.- Parameters:
data
- array of ints to place into a new IntBuffer- Returns:
- a new direct, flipped IntBuffer, or null if data was null
-
createFloatBuffer
Create a new FloatBuffer of the specified size.- Parameters:
size
- required number of floats to store.- Returns:
- the new FloatBuffer
-
createIntBuffer
Create a new IntBuffer of the specified size.- Parameters:
size
- required number of ints to store.- Returns:
- the new IntBuffer
-
createByteBuffer
Create a new ByteBuffer of the specified size.- Parameters:
size
- required number of ints to store.- Returns:
- the new IntBuffer
-
createShortBuffer
Create a new ShortBuffer of the specified size.- Parameters:
size
- required number of shorts to store.- Returns:
- the new ShortBuffer
-