ThreePresenter API Documentation - v0.1.2
    Preparing search index...

    Class ModelLoader

    ModelLoader

    Behavior summary:

    • parsePLY: returns a THREE.Mesh created from PLY geometry. By default, PLY geometry is not normalized or re-centered; set autoComputeNormals to true to compute vertex normals. The returned mesh preserves the geometry's original coordinates.

    • parseGLTF / parseGLB: returns a THREE.Group containing cloned meshes from the GLTF scene. Materials can be overridden via materialOverrides. The loader does not normalize or re-center GLTF models — transforms defined in the file are preserved as-is.

    • parseNexus (NXS / NXZ): Nexus is a streaming, multi-resolution format. This loader returns a Promise that resolves once the Nexus onLoad event has fired (initial model data available). The loader DOES NOT mutate the Nexus object's transform (no auto-scaling or centering). The loader will populate geometry.boundingSphere and geometry.boundingBox from Nexus's reported boundingSphere on onLoad and onUpdate so scene-level bounding computations (Box3.setFromObject) work correctly.

    • General: Model transforms (position, rotation, scale) are not applied by the ModelLoader; those are applied by the caller (e.g., ThreePresenter.applyTransforms()) after loading. This keeps model loading and scene presentation responsibilities separate.

    Index

    Constructors

    Methods

    • Load a model from an ArrayBuffer.

      Parameters

      • buffer: ArrayBuffer

        ArrayBuffer containing the model data

      • format: "ply" | "gltf" | "glb" | "nxs" | "nxz"

        File format ('ply', 'gltf', 'glb', 'nxs', or 'nxz')

      • OptionalmaterialOverrides: Material | MaterialProperties

        Optional material property overrides

      • Optionalurl: string

        Optional URL for streaming formats like NXS

      Returns Promise<LoadResult>

      Promise resolving to load result

    • Detect file format from filename or URL

      Parameters

      • filename: string

        Filename or URL

      Returns "ply" | "gltf" | "glb" | "nxs" | "nxz"

      Detected format

    • Parse PLY format buffer

      Parameters

      • buffer: ArrayBuffer

        ArrayBuffer containing PLY data

      • OptionalmaterialOverrides: Material | MaterialProperties

        Optional material overrides

      • OptionalbaseDir: string

        Optional base directory for resolving relative texture paths

      Returns Promise<
          Mesh<
              BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>,
              Material | Material[],
              Object3DEventMap,
          >,
      >

      Promise resolving to Three.js Mesh

    • Parse GLTF/GLB format buffer

      Parameters

      • buffer: ArrayBuffer

        ArrayBuffer containing GLTF/GLB data

      • OptionalmaterialOverrides: Material | MaterialProperties

        Optional material overrides

      Returns Promise<Group<Object3DEventMap>>

      Promise resolving to Three.js Group

    • Parse Nexus (NXS/NXZ) format from URL Nexus is a multiresolution format that streams data incrementally

      Parameters

      • url: string

        URL to the .nxs or .nxz file

      • OptionalmaterialOverrides: Material | MaterialProperties

      Returns Promise<Object3D<Object3DEventMap>>

      Promise resolving to Nexus3D

    • Update the Draco decoder path

      Parameters

      • path: string

        New path to Draco decoder

      Returns void

    Properties

    config: Required<LoaderConfig>
    renderer: WebGLRenderer | null = null
    plyLoader: any = null
    gltfLoader: any = null
    dracoLoader: any = null