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

OVRGLTFLoader Class

This is a lightweight GLTF model loader that is guaranteed to work with models loaded from the Meta Quest runtime using OVRPlugin.LoadRenderModel OVRPlugin.LoadRenderModel.
The loader only accepts GLTF files/data in the GLB format. We do not recommended using this class as a general purpose GLTF loader.

Fields

OVRGLTFScene scene[Get]
Func< string, Material, Texture2D > textureUriHandler[Get]

Public Statics

static readonly Vector3 GLTFToUnitySpace[Get]
static readonly Vector3 GLTFToUnityTangent[Get]
static readonly Vector4 GLTFToUnitySpace_Rotation[Get]

Member Functions

Creates a new GLTF loader using a file path.
Parameters
fileName
Path to GLB file
Creates a new GLTF loader using a binary data array.
Parameters
data
GLB byte data
Creates a new GLTF loader with a deferred data stream.
This should be used with OVRGLTFLoader.LoadGLBCoroutine to allow for async loading of the GLTF model. This can help prevent stalling on complex GLTF models.
Parameters
deferredStream
GLB data as a Stream
Starts the loading process for the full GLTF file into Unity.
Parameters
supportAnimation
Load GLTF animations.
loadMips
Load GLTF textures with mip maps.
Returns
Full GLTF scene
Starts the loading process for the full GLTF file into Unity as a coroutine.
This can help prevent stalling as loading will be spread out over multiple frames.
Parameters
supportAnimation
Load GLTF animations
loadMips
Load GLTF textures with mip maps.
Returns
IEnumerator that can be yielded on.
Sets the shader that should be used by the GLTF loader on materials.
Parameters
shader
Shader to be used.
Sets the alpha blending shader that should be used by the GLTF loader on materials.
Parameters
shader
Shader to be used.
Sets the texture quality for loading all textures in the GLTF model.
The default is Bilinear. Once loaded, textures will be read-only on GPU memory.
Parameters
loadedTexturesQuality
The quality setting.
Sets the MipMap bias value for loading all textures in the GLTF model.
The default is 0. Only supported when MipMaps are loaded and the provided shader has a property named "_MainTexMMBias"
Parameters
loadedTexturesMipmapBiasing
The value for bias. Value is clamped between [-1,1]

Static Member Functions

Decodes the Texture Quality setting from the input Texture2D properties' values.
Parameters
srcTexture
The input Texture2D
Returns
The enum TextureQualityFiltering representing the quality.
Applies the input Texture Quality setting into the ref Texture2D provided as input.
Texture2D must not be readonly.
Parameters
qualityLevel
The quality level to apply
destTexture
The destination Texture2D to apply quality setting to
Checks the GLB data stream to check if it is a valid GLTF file.
Parameters
glbStream
Data stream of the GLB file.
Returns
If the stream is a valid GLTF file.
Reads a chunk of binary data from the stream that either represents the JSON or BIN part of the GLTF file.
Parameters
glbStream
The binary stream of the GLTF file.
type
Type indicating which part of the GLTF file should be read.
Returns
Did you find this page helpful?
Thumbs up icon
Thumbs down icon