public final class DefaultAccessorModel extends AbstractNamedModelElement implements AccessorModel
AccessorModel| Constructor and Description |
|---|
DefaultAccessorModel(int componentType,
int count,
ElementType elementType)
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
AccessorData |
getAccessorData()
Returns the
AccessorData for this accessor. |
BufferViewModel |
getBufferViewModel()
Returns the
BufferViewModel for the data that this accessor
provides access to. |
int |
getByteOffset()
Returns the byte offset of this accessor referring to its
BufferViewModel |
int |
getByteStride()
Returns the byte stride between the starts of two consecutive elements
of this accessor.
|
java.lang.Class<?> |
getComponentDataType()
Returns the data type of the components of this accessor.
|
int |
getComponentSizeInBytes()
Returns the size of one component, in bytes
|
int |
getComponentType()
Returns the component type of this accessor, as a GL constant.
|
int |
getCount()
Returns the number of elements that this accessor provides access to
|
int |
getElementSizeInBytes()
Returns the size of one element, in bytes.
|
ElementType |
getElementType()
Returns the
ElementType that this accessor provides access to |
java.lang.Number[] |
getMax()
Returns the maximum components of the
AccessorData. |
java.lang.Number[] |
getMin()
Returns the minimum components of the
AccessorData. |
int |
getPaddedElementSizeInBytes()
Obtain the padded size of one element, in bytes.
|
boolean |
isNormalized()
Returns whether this accessor contains normalized data
|
void |
setAccessorData(AccessorData accessorData)
Set the
AccessorData for this accessor |
void |
setBufferViewModel(BufferViewModel bufferViewModel)
Set the
BufferViewModel for this model |
void |
setByteOffset(int byteOffset)
Set the byte offset, referring to the
BufferViewModel |
void |
setByteStride(int byteStride)
Set the byte stride, indicating the number of bytes between the start
of one element and the start of the next element.
|
void |
setNormalized(boolean normalized)
Set whether the underlying data is normalized
|
getName, setNameaddExtension, getExtensions, getExtras, removeExtension, setExtensions, setExtrasclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetNamegetExtensions, getExtraspublic DefaultAccessorModel(int componentType,
int count,
ElementType elementType)
componentType - The component type GL constantcount - The number of elementselementType - The element typepublic void setBufferViewModel(BufferViewModel bufferViewModel)
BufferViewModel for this modelbufferViewModel - The BufferViewModelpublic void setByteOffset(int byteOffset)
BufferViewModelbyteOffset - The byte offsetpublic void setByteStride(int byteStride)
byteStride - The byte stridepublic BufferViewModel getBufferViewModel()
AccessorModelBufferViewModel for the data that this accessor
provides access to. Typed access to the data is possible by obtaining
the AccessorData using AccessorModel.getAccessorData().getBufferViewModel in interface AccessorModelBufferViewModelpublic int getComponentType()
AccessorModelGL_FLOAT or GL_UNSIGNED_SHORTgetComponentType in interface AccessorModelpublic java.lang.Class<?> getComponentDataType()
AccessorModelfloat.class or short.class.getComponentDataType in interface AccessorModelpublic boolean isNormalized()
AccessorModelisNormalized in interface AccessorModelpublic void setNormalized(boolean normalized)
normalized - Whether the underlying data is normalizedpublic int getComponentSizeInBytes()
AccessorModelgetComponentSizeInBytes in interface AccessorModelpublic int getElementSizeInBytes()
AccessorModelAccessorModel.getPaddedElementSizeInBytes() can be used.getElementSizeInBytes in interface AccessorModelpublic int getPaddedElementSizeInBytes()
AccessorModel
ElementType elementType = accessorModel.getElementType();
int componentType = accessorModel.getComponentType();
int sizeWithPadding = elementType.getByteStride(componentType);
See ElementType.getByteStride(int).getPaddedElementSizeInBytes in interface AccessorModelpublic int getByteOffset()
AccessorModelBufferViewModelgetByteOffset in interface AccessorModelpublic int getCount()
AccessorModelgetCount in interface AccessorModelpublic ElementType getElementType()
AccessorModelElementType that this accessor provides access togetElementType in interface AccessorModelElementTypepublic int getByteStride()
AccessorModelelement
size. Note that for glTF 2.0, the byte stride for vertex attributes
must be a multiple 4. Callers must check whether the returned value
is 0 or not a multiple of 4 accordingly.getByteStride in interface AccessorModelpublic void setAccessorData(AccessorData accessorData)
AccessorData for this accessoraccessorData - The AccessorDatapublic AccessorData getAccessorData()
AccessorModelAccessorData for this accessor. The exact type
of the returned AccessorData object will depend on the
component data type. It will be
AccessorByteData, AccessorShortData,
AccessorIntData or AccessorFloatData for a component
data type of byte.class, short.class,
int.class or float.class, respectively,
and can be safely cast to the respective type.getAccessorData in interface AccessorModelAccessorDatapublic java.lang.Number[] getMin()
AccessorModelAccessorData. The
returned array will be a clone of the array that is stored internally,
and have a length that matches the number of components per element.getMin in interface AccessorModelpublic java.lang.Number[] getMax()
AccessorModelAccessorData. The
returned array will be a clone of the array that is stored internally,
and have a length that matches the number of components per element.getMax in interface AccessorModelCopyright © 2022. All Rights Reserved.