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

assets

assetsById

  • get assetsById(): object

materials

meshes

  • get meshes(): Mesh[]

prefabs

sounds

textures

Methods

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

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

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