Modifier and Type | Field and Description |
---|---|
static int |
SIZEOF_CHAR
The size of a char primitive type, in bytes.
|
static int |
SIZEOF_DOUBLE
The size of a double primitive type, in bytes.
|
static int |
SIZEOF_FLOAT
The size of a float primitive type, in bytes.
|
static int |
SIZEOF_INT
The size of a int primitive type, in bytes.
|
static int |
SIZEOF_SHORT
The size of a short primitive type, in bytes.
|
Constructor and Description |
---|
WWBufferUtil() |
Modifier and Type | Method and Description |
---|---|
static double[] |
computeExtremeValues(BufferWrapper buffer)
Returns the minimum and maximum floating point values in the specified buffer.
|
static double[] |
computeExtremeValues(BufferWrapper buffer,
double missingDataSignal)
Returns the minimum and maximum floating point values in the specified buffer.
|
static FloatBuffer |
copyArrayToBuffer(Vec4[] array,
FloatBuffer buffer)
Copies a specified array of vertices to a specified vertex buffer.
|
static ByteBuffer |
copyOf(ByteBuffer buffer,
int newSize)
Returns a copy of the specified buffer, with the specified new size.
|
static CharBuffer |
copyOf(CharBuffer buffer,
int newSize)
Returns a copy of the specified buffer, with the specified new size.
|
static DoubleBuffer |
copyOf(DoubleBuffer buffer,
int newSize)
Returns a copy of the specified buffer, with the specified new size.
|
static FloatBuffer |
copyOf(FloatBuffer buffer,
int newSize)
Returns a copy of the specified buffer, with the specified new size.
|
static IntBuffer |
copyOf(IntBuffer buffer,
int newSize)
Returns a copy of the specified buffer, with the specified new size.
|
static ShortBuffer |
copyOf(ShortBuffer buffer,
int newSize)
Returns a copy of the specified buffer, with the specified new size.
|
static ByteBuffer |
newByteBuffer(int size,
boolean allocateDirect)
Allocates a new direct
ByteBuffer of the specified size, in chars. |
static BufferWrapper |
newByteBufferWrapper(int size,
boolean allocateDirect)
Allocates a new
BufferWrapper of the specified size, in bytes. |
static CharBuffer |
newCharBuffer(int size,
boolean allocateDirect)
Allocates a new direct
CharBuffer of the specified size, in chars. |
protected static ByteBuffer |
newDirectByteBuffer(int size) |
static DoubleBuffer |
newDoubleBuffer(int size,
boolean allocateDirect)
Allocates a new direct
DoubleBuffer of the specified size, in chars. |
static BufferWrapper |
newDoubleBufferWrapper(int size,
boolean allocateDirect)
Allocates a new
BufferWrapper of the specified size, in doubles. |
static FloatBuffer |
newFloatBuffer(int size,
boolean allocateDirect)
Allocates a new direct
FloatBuffer of the specified size, in chars. |
static BufferWrapper |
newFloatBufferWrapper(int size,
boolean allocateDirect)
Allocates a new
BufferWrapper of the specified size, in floats. |
static IntBuffer |
newIntBuffer(int size,
boolean allocateDirect)
Allocates a new direct
IntBuffer of the specified size, in chars. |
static BufferWrapper |
newIntBufferWrapper(int size,
boolean allocateDirect)
Allocates a new
BufferWrapper of the specified size, in ints. |
static ShortBuffer |
newShortBuffer(int size,
boolean allocateDirect)
Allocates a new direct
ShortBuffer of the specified size, in chars. |
static BufferWrapper |
newShortBufferWrapper(int size,
boolean allocateDirect)
Allocates a new
BufferWrapper of the specified size, in shorts. |
static int |
sizeOfPrimitiveType(Object dataType)
Returns the size in bytes of the specified primitive data type, or -1 if the specified type is unrecognized.
|
public static final int SIZEOF_CHAR
public static final int SIZEOF_DOUBLE
public static final int SIZEOF_FLOAT
public static final int SIZEOF_INT
public static final int SIZEOF_SHORT
public static double[] computeExtremeValues(BufferWrapper buffer)
Double.NaN
are ignored. This returns null if the buffer is empty or contains only NaN values.buffer
- the buffer to search for the minimum and maximum values.IllegalArgumentException
- if the buffer is null.public static double[] computeExtremeValues(BufferWrapper buffer, double missingDataSignal)
missingDataSignal
are ignored. This returns null if the buffer is empty or contains only missing
values.buffer
- the buffer to search for the minimum and maximum values.missingDataSignal
- the number indicating a specific floating point value to ignore.IllegalArgumentException
- if the buffer is null.public static FloatBuffer copyArrayToBuffer(Vec4[] array, FloatBuffer buffer)
Buffer.flip()
prior to returning.array
- the vertices to copy.buffer
- the buffer to copy the vertices to. Must have enough remaining space to hold the vertices.public static ByteBuffer copyOf(ByteBuffer buffer, int newSize)
buffer
- the buffer to copy.newSize
- the new buffer's size, in bytes.IllegalArgumentException
- if the buffer is null, if the new size is negative, or if the new size is less
than the buffer's remaing elements.public static CharBuffer copyOf(CharBuffer buffer, int newSize)
buffer
- the buffer to copy.newSize
- the new buffer's size, in chars.IllegalArgumentException
- if the buffer is null, if the new size is negative, or if the new size is less
than the buffer's remaing elements.public static DoubleBuffer copyOf(DoubleBuffer buffer, int newSize)
buffer
- the buffer to copy.newSize
- the new buffer's size, in doubles.IllegalArgumentException
- if the buffer is null, if the new size is negative, or if the new size is less
than the buffer's remaing elements.public static FloatBuffer copyOf(FloatBuffer buffer, int newSize)
buffer
- the buffer to copy.newSize
- the new buffer's size, in floats.IllegalArgumentException
- if the buffer is null, if the new size is negative, or if the new size is less
than the buffer's remaing elements.public static IntBuffer copyOf(IntBuffer buffer, int newSize)
buffer
- the buffer to copy.newSize
- the new buffer's size, in ints.IllegalArgumentException
- if the buffer is null, if the new size is negative, or if the new size is less
than the buffer's remaing elements.public static ShortBuffer copyOf(ShortBuffer buffer, int newSize)
buffer
- the buffer to copy.newSize
- the new buffer's size, in shorts.IllegalArgumentException
- if the buffer is null, if the new size is negative, or if the new size is less
than the buffer's remaing elements.public static ByteBuffer newByteBuffer(int size, boolean allocateDirect)
ByteBuffer
of the specified size, in chars.size
- the new ByteBuffer's size.allocateDirect
- true to allocate and return a direct buffer, false to allocate and return a non-direct
buffer.IllegalArgumentException
- if size is negative.public static BufferWrapper newByteBufferWrapper(int size, boolean allocateDirect)
BufferWrapper
of the specified size, in bytes. The BufferWrapper is backed by a Buffer of
bytes.size
- the new BufferWrapper's size.allocateDirect
- true to allocate and return a direct buffer, false to allocate and return a non-direct
buffer.IllegalArgumentException
- if size is negative.public static CharBuffer newCharBuffer(int size, boolean allocateDirect)
CharBuffer
of the specified size, in chars.size
- the new CharBuffer's size.allocateDirect
- true to allocate and return a direct buffer, false to allocate and return a non-direct
buffer.IllegalArgumentException
- if size is negative.protected static ByteBuffer newDirectByteBuffer(int size)
public static DoubleBuffer newDoubleBuffer(int size, boolean allocateDirect)
DoubleBuffer
of the specified size, in chars.size
- the new DoubleBuffer's size.allocateDirect
- true to allocate and return a direct buffer, false to allocate and return a non-direct
buffer.IllegalArgumentException
- if size is negative.public static BufferWrapper newDoubleBufferWrapper(int size, boolean allocateDirect)
BufferWrapper
of the specified size, in doubles. The BufferWrapper is backed by a Buffer
of doubles.size
- the new BufferWrapper's size.allocateDirect
- true to allocate and return a direct buffer, false to allocate and return a non-direct
buffer.IllegalArgumentException
- if size is negative.public static FloatBuffer newFloatBuffer(int size, boolean allocateDirect)
FloatBuffer
of the specified size, in chars.size
- the new FloatBuffer's size.allocateDirect
- true to allocate and return a direct buffer, false to allocate and return a non-direct
buffer.IllegalArgumentException
- if size is negative.public static BufferWrapper newFloatBufferWrapper(int size, boolean allocateDirect)
BufferWrapper
of the specified size, in floats. The BufferWrapper is backed by a Buffer
of floats.size
- the new BufferWrapper's size.allocateDirect
- true to allocate and return a direct buffer, false to allocate and return a non-direct
buffer.IllegalArgumentException
- if size is negative.public static IntBuffer newIntBuffer(int size, boolean allocateDirect)
IntBuffer
of the specified size, in chars.size
- the new IntBuffer's size.allocateDirect
- true to allocate and return a direct buffer, false to allocate and return a non-direct
buffer.IllegalArgumentException
- if size is negative.public static BufferWrapper newIntBufferWrapper(int size, boolean allocateDirect)
BufferWrapper
of the specified size, in ints. The BufferWrapper is backed by a Buffer of
ints.size
- the new BufferWrapper's size.allocateDirect
- true to allocate and return a direct buffer, false to allocate and return a non-direct
buffer.IllegalArgumentException
- if size is negative.public static ShortBuffer newShortBuffer(int size, boolean allocateDirect)
ShortBuffer
of the specified size, in chars.size
- the new ShortBuffer's size.allocateDirect
- true to allocate and return a direct buffer, false to allocate and return a non-direct
buffer.IllegalArgumentException
- if size is negative.public static BufferWrapper newShortBufferWrapper(int size, boolean allocateDirect)
BufferWrapper
of the specified size, in shorts. The BufferWrapper is backed by a Buffer
of shorts.size
- the new BufferWrapper's size.allocateDirect
- true to allocate and return a direct buffer, false to allocate and return a non-direct
buffer.IllegalArgumentException
- if size is negative.public static int sizeOfPrimitiveType(Object dataType)
dataType
- the primitive data type.IllegalArgumentException
- if the data type is null.