melonJS
    Preparing search index...

    Function getGLTF

    • return the parsed glTF/GLB scene descriptor for the given asset name.

      The descriptor is { nodes, cameras, lights, bounds }:

      • nodes — one entry per mesh primitive, each carrying its accumulated world transform (16 floats, column-major), vertices, normals, uvs, indices, vertexCount, a decoded baseColor image (or null), and a doubleSided flag.
      • cameras — glTF cameras, each with its world transform + perspective parameters.
      • lights — parsed KHR_lights_punctual lights (type, color, intensity, world-space direction/position); empty without the extension. The level director instantiates directional ones automatically.
      • bounds — world-space { min, max } (glTF units), handy for framing.

      Most code never needs this: a preloaded glTF/GLB auto-registers with the level director, so the whole scene loads into a container in one call via me.level.load(name) — exactly like a Tiled map. Reach for getGLTF only when you want to inspect the raw descriptor (e.g. to frame a Camera3d from the embedded camera).

      Parameters

      • elt: string

        name of the glTF/GLB file (as specified in the preload list)

      Returns GLTFData | null

      the parsed scene descriptor, or null if not found

      loader

      me.loader.preload(
      [{ name: "diorama", type: "glb", src: "scenes/diorama.glb" }],
      () => {
      // load the whole scene into the world (view under a Camera3d)
      me.level.load("diorama", { scale: 32 });

      // ...or inspect the raw descriptor for custom framing
      const scene = me.loader.getGLTF("diorama");
      const { min, max } = scene.bounds;
      },
      );