Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AssetContainer

The root object of the MRE SDK's asset system. Once you create an AssetContainer, you can create new materials, textures, or sounds from scratch, or load glTF files for their assets.

Hierarchy

  • AssetContainer

Index

Constructors

constructor

Properties

context

context: Context

Accessors

animationData

assets

assetsById

materials

meshes

  • get meshes(): Mesh[]

prefabs

sounds

textures

Methods

createAnimationData

  • Preload unbound animation keyframe data for later use.

    throws

    [[MreValidationError]] If the provided animation data is malformed. See the error message for details.

    Parameters

    Returns AnimationData

createBoxMesh

  • createBoxMesh(name: string, width: number, height: number, depth: number): Mesh
  • Create a new box-shaped mesh.

    Parameters

    • name: string

      The name to give to the asset.

    • width: number

      The length of the box on the X axis.

    • height: number

      The length of the box on the Y axis.

    • depth: number

      The length of the box on the Z axis.

    Returns Mesh

createCapsuleMesh

  • createCapsuleMesh(name: string, height: number, radius: number, direction?: "x" | "y" | "z", uSegments?: number, vSegments?: number): Mesh
  • Create a new capsule-shaped mesh.

    Parameters

    • name: string

      The name to give to the asset.

    • height: number

      The height of the capsule from tip to tip.

    • radius: number

      The thickness of the capsule.

    • Default value direction: "x" | "y" | "z" = "y"

      The long axis of the capsule.

    • Default value uSegments: number = 36

      The number of longitudinal segments.

    • Default value vSegments: number = 18

      The number of latitudinal segments.

    Returns Mesh

createCylinderMesh

  • createCylinderMesh(name: string, height: number, radius: number, direction?: "x" | "y" | "z", uSegments?: number): Mesh
  • Create a new cylinder-shaped mesh.

    Parameters

    • name: string

      The name to give to the asset.

    • height: number

      The height of the cylinder.

    • radius: number

      The thickness of the cylinder.

    • Default value direction: "x" | "y" | "z" = "y"

      The long axis of the cylinder.

    • Default value uSegments: number = 36

      The number of longitudinal segments.

    Returns Mesh

createMaterial

createPlaneMesh

  • createPlaneMesh(name: string, width: number, height: number, uSegments?: number, vSegments?: number): Mesh
  • Create a flat mesh on the X-Z plane.

    Parameters

    • name: string

      The name to give to the asset.

    • width: number

      The X-axis length of the plane.

    • height: number

      The Z-axis length of the plane.

    • Default value uSegments: number = 1

      The number of X-axis segments.

    • Default value vSegments: number = 1

      The number of Z-axis segments.

    Returns Mesh

createPrimitiveMesh

createSound

  • Load an audio file and generate a new sound asset

    Parameters

    • name: string

      The new sound's name

    • definition: Partial<SoundLike>

      The initial sound properties. The uri property is required.

    Returns Sound

createSphereMesh

  • createSphereMesh(name: string, radius: number, uSegments?: number, vSegments?: number): Mesh
  • Create a new sphere-shaped mesh.

    Parameters

    • name: string

      The name to give to the asset.

    • radius: number

      The radius of the sphere.

    • Default value uSegments: number = 36

      The number of longitudinal segments.

    • Default value vSegments: number = 18

      The number of latitudinal segments.

    Returns Mesh

createTexture

  • Load an image file and generate a new texture asset

    Parameters

    • name: string

      The new texture's name

    • definition: Partial<TextureLike>

      The initial texture properties. The uri property is required.

    Returns Texture

createVideoStream

loadGltf

  • loadGltf(uri: string, colliderType?: "box" | "mesh"): Promise<Asset[]>
  • Load the assets in a glTF file by URL, and this container with the result.

    Parameters

    • uri: string

      The URI to a glTF model.

    • Optional colliderType: "box" | "mesh"

      The shape of the generated prefab collider.

    Returns Promise<Asset[]>

    A promise that resolves with the list of loaded assets.

unload

  • unload(): void