Package com.jme3.util

Class BufferUtils

java.lang.Object
com.jme3.util.BufferUtils

public final class BufferUtils extends Object
BufferUtils is a helper class for generating nio buffers from jME data classes such as Vectors.
  • Method Details

    • createFloatBuffer

      public static FloatBuffer createFloatBuffer(Vector3f... data)
      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

      public static FloatBuffer createFloatBuffer(float... data)
      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

      public static IntBuffer createIntBuffer(int... data)
      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

      public static FloatBuffer createFloatBuffer(int size)
      Create a new FloatBuffer of the specified size.
      Parameters:
      size - required number of floats to store.
      Returns:
      the new FloatBuffer
    • createIntBuffer

      public static IntBuffer createIntBuffer(int size)
      Create a new IntBuffer of the specified size.
      Parameters:
      size - required number of ints to store.
      Returns:
      the new IntBuffer
    • createByteBuffer

      public static ByteBuffer createByteBuffer(int size)
      Create a new ByteBuffer of the specified size.
      Parameters:
      size - required number of ints to store.
      Returns:
      the new IntBuffer
    • createShortBuffer

      public static ShortBuffer createShortBuffer(int size)
      Create a new ShortBuffer of the specified size.
      Parameters:
      size - required number of shorts to store.
      Returns:
      the new ShortBuffer