Class GltfImportBase
Loads a glTF's content, converts it to Unity resources and is able to feed it to an IInstantiator for instantiation.
Inherited Members
Namespace: GLTFast
Assembly: solution.dll
Syntax
public abstract class GltfImportBase : IGltfReadable, IDisposable
Constructors
Name | Description |
---|---|
GltfImportBase(IDownloadProvider, IDeferAgent, IMaterialGenerator, ICodeLogger) | Constructs a GltfImport instance with injectable customization objects. |
Properties
Name | Description |
---|---|
DefaultSceneIndex | Default scene index |
ImageCount | Number of images |
LoadingDone | True, when loading has finished and glTF can be instantiated |
LoadingError | True if an error happened during glTF loading |
MaterialCount | Number of materials |
Root | Main glTF data structure |
SceneCount | Number of scenes |
TextureCount | Number of textures |
Methods
Name | Description |
---|---|
AddImportAddonInstance<T>(T) | Adds an import add-on instance. To be called before any loading is initiated. |
Dispose() | Frees up memory by disposing all sub assets. There can be no instantiation or other element access afterwards. |
GetAccessor(int) | Creates a generic byte-array view into an accessor. Only available during loading phase as underlying buffers are disposed right afterwards. |
GetAccessorSparseIndices(AccessorSparseIndices, out void*) | Get sparse indices raw data |
GetAccessorSparseValues(AccessorSparseValues, out void*) | Get sparse value raw data |
GetAnimationClips() | Returns all imported animation clips |
GetBindPoses(int) | Returns an array of inverse bone matrices representing a skin's bind pose suitable for use with UnityEngine.Mesh.bindposes by glTF skin index. |
GetDefaultMaterial() | Returns a fallback material to be used when no material was assigned (provided by the IMaterialGenerator) |
GetImage(int) | Returns a texture by its glTF image index |
GetImportAddonInstance<T>() | Queries the import instance of a particular type. |
GetMaterial(int) | Get a Unity Material by its glTF material index |
GetMeshes() | Returns all imported meshes |
GetSceneName(int) | Get a glTF's scene's name by its index |
GetSourceCamera(uint) | Get source (de-serialized glTF) camera |
GetSourceImage(int) | Get source (de-serialized glTF) image |
GetSourceLightPunctual(uint) | Get source (de-serialized glTF) light |
GetSourceMaterial(int) | Get source (de-serialized glTF) material |
GetSourceNode(int) | Get source (de-serialized glTF) node |
GetSourceScene(int) | Get source (de-serialized glTF) scene |
GetSourceTexture(int) | Get source (de-serialized glTF) texture |
GetTexture(int) | Returns a texture by its glTF texture index |
InstantiateMainScene(IInstantiator) | Creates an instance of the main scene of the glTF ( scene property in the JSON at root level) If the main scene index is not set, it instantiates nothing (as defined in the glTF 2.0 specification) |
InstantiateMainScene(Transform) | Creates an instance of the main scene of the glTF ( scene property in the JSON at root level) If the main scene index is not set, it instantiates nothing (as defined in the glTF 2.0 specification) |
InstantiateMainSceneAsync(IInstantiator, CancellationToken) | Creates an instance of the main scene of the glTF ( scene property in the JSON at root level) If the main scene index is not set, it instantiates nothing (as defined in the glTF 2.0 specification) |
InstantiateMainSceneAsync(Transform, CancellationToken) | Creates an instance of the main scene of the glTF ( scene property in the JSON at root level) If the main scene index is not set, it instantiates nothing (as defined in the glTF 2.0 specification) |
InstantiateScene(IInstantiator, int) | Creates an instance of the scene specified by the scene index. |
InstantiateScene(Transform, int) | Creates an instance of the scene specified by the scene index. |
InstantiateSceneAsync(IInstantiator, int, CancellationToken) | Creates an instance of the scene specified by the scene index. |
InstantiateSceneAsync(Transform, int, CancellationToken) | Creates an instance of the scene specified by the scene index. |
Load(byte[], Uri, ImportSettings, CancellationToken) | Load a glTF from a byte array. If the type (JSON or glTF-Binary) is known, LoadGltfJson(string, Uri, ImportSettings, CancellationToken) and LoadGltfBinary(byte[], Uri, ImportSettings, CancellationToken) should be preferred. |
Load(string, ImportSettings, CancellationToken) | Load a glTF file (JSON or binary) The URL can be a file path (using the "file://" scheme) or a web address. |
Load(Uri, ImportSettings, CancellationToken) | Load a glTF file (JSON or binary) The URL can be a file path (using the "file://" scheme) or a web address. |
LoadFile(string, Uri, ImportSettings, CancellationToken) | Load glTF from a local file path. |
LoadGltfBinary(byte[], Uri, ImportSettings, CancellationToken) | Load a glTF-binary asset from a byte array. |
LoadGltfJson(string, Uri, ImportSettings, CancellationToken) | Load a glTF JSON from a string |
ParseJson(string) | De-serializes a glTF JSON string and returns the glTF root schema object. |
SetDefaultDeferAgent(IDeferAgent) | Sets the default IDeferAgent for subsequently generated GltfImport instances. |
UnsetDefaultDeferAgent(IDeferAgent) | Allows un-registering default IDeferAgent. For example if it's no longer available. |
Events
Name | Description |
---|---|
LoadAccessorDataEvent | Is called when retrieving data from accessors should be performed/started. |
MeshResultAssigned | Is called when a mesh and its primitives are assigned to a MeshResult and sub-meshes. Parameters are MeshResult index, mesh index and per sub-mesh primitive index |