docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IGltfReadable

    Provides read-only access to a glTF (schema and imported Unity resources)

    Inherited Members
    IMaterialProvider.GetMaterialAsync(int)
    IMaterialProvider.GetMaterialAsync(int, CancellationToken)
    IMaterialProvider.GetDefaultMaterialAsync()
    IMaterialProvider.GetDefaultMaterialAsync(CancellationToken)
    IMaterialProvider.GetMaterialsVariantsSlots(int, int)
    IMaterialsVariantsProvider.MaterialsVariantsCount
    IMaterialsVariantsProvider.GetMaterialsVariantName(int)
    Namespace: GLTFast
    Assembly: glTFast.dll
    Syntax
    public interface IGltfReadable : IMaterialProvider, IMaterialsVariantsProvider

    Properties

    ImageCount

    Number of images

    Declaration
    int ImageCount { get; }
    Property Value
    Type Description
    int

    MaterialCount

    Number of materials

    Declaration
    int MaterialCount { get; }
    Property Value
    Type Description
    int

    TextureCount

    Number of textures

    Declaration
    int TextureCount { get; }
    Property Value
    Type Description
    int

    Methods

    GetAccessor(int)

    Creates a generic byte-array view into an accessor. Only available during loading phase as underlying buffers are disposed right afterwards.

    Declaration
    NativeSlice<byte> GetAccessor(int accessorIndex)
    Parameters
    Type Name Description
    int accessorIndex

    glTF accessor index

    Returns
    Type Description
    NativeSlice<byte>

    Valid byte-slice view into accessor's data if parameter was correct and buffers are available. Zero-length slice otherwise.

    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.

    Declaration
    Matrix4x4[] GetBindPoses(int skinId)
    Parameters
    Type Name Description
    int skinId

    glTF skin index

    Returns
    Type Description
    Matrix4x4[]

    Corresponding bind poses

    GetDefaultMaterial()

    Returns a fallback material to be used when no material was assigned (provided by the IMaterialGenerator)

    Declaration
    Material GetDefaultMaterial()
    Returns
    Type Description
    Material

    Default material

    GetImage(int)

    Get texture by glTF image index

    Declaration
    Texture2D GetImage(int index = 0)
    Parameters
    Type Name Description
    int index

    glTF image index

    Returns
    Type Description
    Texture2D

    Loaded Unity texture

    GetMaterial(int)

    Get a Unity Material by its glTF material index

    Declaration
    Material GetMaterial(int index = 0)
    Parameters
    Type Name Description
    int index

    glTF material index

    Returns
    Type Description
    Material

    Corresponding Unity Material

    GetSourceCamera(uint)

    Get source (de-serialized glTF) camera

    Declaration
    CameraBase GetSourceCamera(uint index)
    Parameters
    Type Name Description
    uint index

    glTF camera index

    Returns
    Type Description
    CameraBase

    De-serialized glTF camera

    GetSourceImage(int)

    Get source (de-serialized glTF) image

    Declaration
    Image GetSourceImage(int index = 0)
    Parameters
    Type Name Description
    int index

    glTF image index

    Returns
    Type Description
    Image

    De-serialized glTF image

    GetSourceLightPunctual(uint)

    Get source (de-serialized glTF) light

    Declaration
    LightPunctual GetSourceLightPunctual(uint index)
    Parameters
    Type Name Description
    uint index

    glTF light index

    Returns
    Type Description
    LightPunctual

    De-serialized glTF light

    GetSourceMaterial(int)

    Get source (de-serialized glTF) material

    Declaration
    MaterialBase GetSourceMaterial(int index = 0)
    Parameters
    Type Name Description
    int index

    glTF material index

    Returns
    Type Description
    MaterialBase

    De-serialized glTF material

    GetSourceMeshPrimitive(int, int)

    Get source (de-serialized glTF) mesh primitive

    Declaration
    MeshPrimitiveBase GetSourceMeshPrimitive(int meshIndex, int primitiveIndex)
    Parameters
    Type Name Description
    int meshIndex

    glTF mesh index.

    int primitiveIndex

    glTF primitive index within mesh.

    Returns
    Type Description
    MeshPrimitiveBase

    De-serialized glTF mesh primitive

    GetSourceNode(int)

    Get source (de-serialized glTF) node

    Declaration
    NodeBase GetSourceNode(int index = 0)
    Parameters
    Type Name Description
    int index

    glTF node index

    Returns
    Type Description
    NodeBase

    De-serialized glTF node

    GetSourceScene(int)

    Get source (de-serialized glTF) scene

    Declaration
    Scene GetSourceScene(int index = 0)
    Parameters
    Type Name Description
    int index

    glTF scene index

    Returns
    Type Description
    Scene

    De-serialized glTF scene

    GetSourceTexture(int)

    Get source (de-serialized glTF) texture

    Declaration
    TextureBase GetSourceTexture(int index = 0)
    Parameters
    Type Name Description
    int index

    glTF texture index

    Returns
    Type Description
    TextureBase

    De-serialized glTF texture

    GetTexture(int)

    Get texture by glTF texture index

    Declaration
    Texture2D GetTexture(int index = 0)
    Parameters
    Type Name Description
    int index

    glTF texture index

    Returns
    Type Description
    Texture2D

    Loaded Unity texture

    IsTextureYFlipped(int)

    Evaluates if the texture's vertical orientation conforms to Unity's default. If it's not aligned (=true; =flipped), the texture has to be applied mirrored vertically.

    Declaration
    bool IsTextureYFlipped(int index = 0)
    Parameters
    Type Name Description
    int index

    glTF texture index

    Returns
    Type Description
    bool

    True if the vertical orientation is flipped, false otherwise

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)