public final class AccessorShortData extends java.lang.Object implements AccessorData
| Constructor and Description |
|---|
AccessorShortData(int componentType,
java.nio.ByteBuffer bufferViewByteBuffer,
int byteOffset,
int numElements,
ElementType elementType,
java.lang.Integer byteStride)
Creates a new instance for accessing the data in the given
byte buffer, according to the rules described by the given
accessor parameters.
|
| Modifier and Type | Method and Description |
|---|---|
short[] |
computeMax()
Returns an array containing the maximum component values of all elements
of this accessor data.
|
int[] |
computeMaxInt()
Returns an array containing the maximum component values of all elements
of this accessor data.
|
short[] |
computeMin()
Returns an array containing the minimum component values of all elements
of this accessor data.
|
int[] |
computeMinInt()
Returns an array containing the minimum component values of all elements
of this accessor data.
|
java.nio.ByteBuffer |
createByteBuffer()
Creates a new, direct byte buffer (with native byte order) that
contains the data for the accessor, in a compact form,
without any offset, and without any additional stride (that is,
all elements will be tightly packed).
|
java.lang.String |
createString(java.util.Locale locale,
java.lang.String format,
int elementsPerRow)
Creates a (potentially large!)
|
short |
get(int globalComponentIndex)
Returns the value of the specified component
|
short |
get(int elementIndex,
int componentIndex)
Returns the value of the specified component of the specified element
|
protected java.nio.ByteBuffer |
getBufferViewByteBuffer()
Returns the underlying byte buffer
|
protected int |
getByteIndex(int elementIndex,
int componentIndex)
Returns the index of the byte in the byte buffer where the specified
component starts
|
protected int |
getByteStridePerElement()
Returns the byte stride per element
|
java.lang.Class<?> |
getComponentType()
Returns the type of the components that this class provides access to.
|
int |
getInt(int globalComponentIndex)
Returns the value of the specified component, taking into account
whether the data
isUnsigned(): If the data is unsigned,
the returned short value will be converted into an unsigned integer
value. |
int |
getInt(int elementIndex,
int componentIndex)
Returns the value of the specified component of the specified element,
taking into account whether the data
isUnsigned(): If the data
is unsigned, the returned short value will be converted into an
unsigned integer value. |
protected int |
getNumBytesPerComponent()
Returns the number of bytes per component
|
int |
getNumComponentsPerElement()
Returns the number of components per element (for example, 3 if the
elements are 3D vectors)
|
int |
getNumElements()
Returns the number of elements in this data (for example, the number
of 3D vectors)
|
int |
getTotalNumComponents()
Returns the total number of components (that is, the number of elements
multiplied with the number of components per element)
|
boolean |
isUnsigned()
Returns whether the data should be interpreted as unsigned
|
void |
set(int elementIndex,
int componentIndex,
short value)
Set the value of the specified component of the specified element
|
void |
set(int globalComponentIndex,
short value)
Set the value of the specified component
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetComponentType, getNumComponentsPerElement, getNumElements, getTotalNumComponentspublic AccessorShortData(int componentType,
java.nio.ByteBuffer bufferViewByteBuffer,
int byteOffset,
int numElements,
ElementType elementType,
java.lang.Integer byteStride)
componentType - The component typebufferViewByteBuffer - The byte buffer of the buffer viewbyteOffset - The byte offset in the buffer viewnumElements - The number of elementselementType - The ElementTypebyteStride - The byte stride between two elements. If this
is null or 0, then the stride will
be the size of one element.java.lang.NullPointerException - If the bufferViewByteBuffer is
nulljava.lang.IllegalArgumentException - If the component type is not
GL_SHORT or GL_UNSIGEND_SHORTjava.lang.IllegalArgumentException - If the given byte buffer does not
have a sufficient capacity to provide the data for the accessorpublic boolean isUnsigned()
public short get(int elementIndex,
int componentIndex)
elementIndex - The element indexcomponentIndex - The component indexjava.lang.IndexOutOfBoundsException - If the given indices cause the
underlying buffer to be accessed out of boundspublic short get(int globalComponentIndex)
globalComponentIndex - The global component indexjava.lang.IndexOutOfBoundsException - If the given index causes the
underlying buffer to be accessed out of boundspublic void set(int elementIndex,
int componentIndex,
short value)
elementIndex - The element indexcomponentIndex - The component indexvalue - The valuejava.lang.IndexOutOfBoundsException - If the given indices cause the
underlying buffer to be accessed out of boundspublic void set(int globalComponentIndex,
short value)
globalComponentIndex - The global component indexvalue - The valuejava.lang.IndexOutOfBoundsException - If the given index causes the
underlying buffer to be accessed out of boundspublic int getInt(int elementIndex,
int componentIndex)
isUnsigned(): If the data
is unsigned, the returned short value will be converted into an
unsigned integer value.elementIndex - The element indexcomponentIndex - The component indexjava.lang.IndexOutOfBoundsException - If the given indices cause the
underlying buffer to be accessed out of boundspublic int getInt(int globalComponentIndex)
isUnsigned(): If the data is unsigned,
the returned short value will be converted into an unsigned integer
value.globalComponentIndex - The global component indexjava.lang.IndexOutOfBoundsException - If the given index causes the
underlying buffer to be accessed out of boundspublic short[] computeMin()
number of components per element.public short[] computeMax()
number of components per element.public int[] computeMinInt()
number of components per element.
These values are computed based on getInt(int, int).public int[] computeMaxInt()
number of components per element.
These values are computed based on getInt(int, int).public java.nio.ByteBuffer createByteBuffer()
AccessorDatacreateByteBuffer in interface AccessorDatapublic java.lang.String createString(java.util.Locale locale,
java.lang.String format,
int elementsPerRow)
locale - The locale used for number formattingformat - The number format stringelementsPerRow - The number of elements per row. If this
is not greater than 0, then all elements will be in a single row.public final java.lang.Class<?> getComponentType()
AccessorDatafloat.class
or short.class.getComponentType in interface AccessorDatapublic final int getNumElements()
AccessorDatagetNumElements in interface AccessorDatapublic final int getNumComponentsPerElement()
AccessorDatagetNumComponentsPerElement in interface AccessorDatapublic final int getTotalNumComponents()
AccessorDatagetTotalNumComponents in interface AccessorDataprotected final int getByteIndex(int elementIndex,
int componentIndex)
elementIndex - The element indexcomponentIndex - The component indexprotected final java.nio.ByteBuffer getBufferViewByteBuffer()
protected final int getByteStridePerElement()
protected final int getNumBytesPerComponent()
Copyright © 2022. All Rights Reserved.