API reference
API reference
Select your platform
No SDKs available
No versions available

OVRGLTFAccessor Class

Extends IDisposable
This class follows the GLTF 2.0 specification for loading data. For more information, refer to the Binary Data Storage section on the GLTF 2.0 specification site.
This class is intended to be used in conjunction with the . It is not recommended to use these functions outside of the context of GLTF loading.

Methods

Dispose ()
Disposes the BinaryReader if being used for accessing the Stream.
Signature
void Dispose()
Returns
void
GetDataCount ()
Gets the total number of GLTF accessors loaded from the GLTF file.
Signature
int GetDataCount()
Returns
int  Total number of GLTF accessors.
ReadBuffer ( bufferViewIndex )
Read the binary stream using a specific buffer view.
Signature
byte[] ReadBuffer(int bufferViewIndex)
Parameters
bufferViewIndex: int  Index of a buffer view to use out of all buffer views.
Returns
byte[]  An array of byte data the buffer view points to.
ReadColor ()
Read data from the binary stream as colors, using the current accessor set by Seek.
Signature
Color[] ReadColor()
Returns
Color[]  An array of Colors.
ReadFloat ()
Reads data as floats from the binary stream, using the current accessor set by Seek.
Signature
float[] ReadFloat()
Returns
float[]  An array of floats.
ReadInt ()
Read data as integers from the binary stream, using the current accessor set by Seek.
Signature
int[] ReadInt()
Returns
int[]  An array of integers.
ReadJoints ( resultsBoneWeights )
Read data from the binary stream as bone indices, using the current accessor set by Seek.
Signature
void ReadJoints(ref BoneWeight[] resultsBoneWeights)
Parameters
resultsBoneWeights: ref BoneWeight[]  Output array of BoneWeights.
Returns
void
ReadMatrix4x4 ( conversionScale )
Read data from the binary stream as a Matrix 4x4, using the current accessor set by Seek.
Signature
Matrix4x4[] ReadMatrix4x4(Vector3 conversionScale)
Parameters
conversionScale: Vector3  Conversion scale to be applied to each 4x4 matrix.
Returns
Matrix4x4[]  An array of Matrix4x4.
ReadQuaterion ( gltfToUnitySpaceRotation )
Read data from the binary stream as Quaternions, using the current accessor set by Seek.
Signature
Quaternion[] ReadQuaterion(Vector4 gltfToUnitySpaceRotation)
Parameters
gltfToUnitySpaceRotation: Vector4  The conversion value to apply to translate from GLTF space to Unity space.
Returns
Quaternion[]  An array of Quaternions.
ReadVector2 ()
Read data as 2D vectors from the binary stream, using the current accessor set by Seek
Signature
Vector2[] ReadVector2()
Returns
Vector2[]  An array of Vector2s
ReadVector3 ( conversionScale )
Read data from the binary stream as 3D vectors, using the current accessor set by Seek.
Signature
Vector3[] ReadVector3(Vector3 conversionScale)
Parameters
conversionScale: Vector3  Coversion scale that is applied to each Vector3.
Returns
Vector3[]  An array of Vector3s
ReadVector4 ( conversionScale )
Read data from the binary stream as 4D vectors, using the current accessor set by Seek.
Signature
Vector4[] ReadVector4(Vector4 conversionScale)
Parameters
conversionScale: Vector4  Coversion scale that is applied to each Vector4.
Returns
Vector4[]  An array of Vector4s
ReadWeights ( resultsBoneWeights )
Read data from the binary stream as bone weights, using the current accessor set by Seek.
Signature
void ReadWeights(ref BoneWeight[] resultsBoneWeights)
Parameters
resultsBoneWeights: ref BoneWeight[]  Output array of BoneWeights.
Returns
void
Seek ( accessorIndex , onlyBufferView )
Indexes into the GLTF accessors JSONNode provided to the TryCreate method and moves the binary data stream position based on the accessor's data.
Signature
void Seek(int accessorIndex, bool onlyBufferView=false)
Parameters
accessorIndex: int  The index to a accessor in the accessor array.
onlyBufferView: bool  If the position should be set to just the start of the buffer view.
Returns
void

Static Methods

TryCreate ( accessorsRoot , bufferViewsRoot , buffersRoot , binaryChunk , dataAccessor )
Tries to create a OVRGLTFAccessor object by checking if the binary stream data provided is a valid GLTF binary chunk.
Signature
static bool TryCreate(JSONNode accessorsRoot, JSONNode bufferViewsRoot, JSONNode buffersRoot, Stream binaryChunk, out OVRGLTFAccessor dataAccessor)
Parameters
accessorsRoot: JSONNode  JSON node containing the GLTF accessors.
bufferViewsRoot: JSONNode  JSON node containing the GLTF buffer views.
buffersRoot: JSONNode  JSON node containing the GLTF buffers.
binaryChunk: Stream  Binary stream of the entire GLTF file.
dataAccessor: out OVRGLTFAccessor  A valid OVRGLTFAccessor that can be used to access data in the GLTF binary stream.
Returns
bool  If the OVRGLTFAccessor was created successfully.