melonJS
    Preparing search index...

    Function getGLTF

    • Get a loaded glTF/GLB scene (a "gltf" or "glb" asset), parsed.

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

      • 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, range, spot cone angles, world-space direction/position, name); empty without the extension. The level director instantiates directional, point and spot lights automatically (see level.load options).
      • bounds — world-space { min, max } (glTF units), handy for framing.

      Most code never needs this: a loaded glTF/GLB registers with the level director, so the whole scene loads into a container in one call, level.load(name), exactly like a Tiled map. Reach for getGLTF only to inspect the raw descriptor (to frame a Camera3d from the embedded camera, say).

      Parameters

      • elt: string

        the asset name

      Returns GLTFData | null

      the parsed scene descriptor, or null if none is loaded under that name

      await loader.preload([
      { name: "diorama", type: "glb", src: "scenes/diorama.glb" },
      ]);

      // load the whole scene into the world (view it under a Camera3d)
      level.load("diorama", { scale: 32 });

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