rhodonite
    Preparing search index...

    Class DrcPointCloudImporter

    The Draco Point Cloud Importer class for importing and decoding Draco compressed point cloud files. This class provides functionality to import Draco files and convert them to glTF2 format or Rhodonite primitives. Currently supports point cloud geometry only - mesh types, WEIGHTS_0, and JOINTS_0 attributes are not supported.

    Index

    Methods

    • Imports a Draco point cloud from an ArrayBuffer and converts it to glTF2 format. This method is useful when you already have the file data in memory.

      Parameters

      • uri: string

        The original URI of the file (used for base path calculation)

      • arrayBuffer: ArrayBuffer

        The ArrayBuffer containing the Draco file data

      • Optionaloptions: GltfLoadOption

        Optional loading configuration

      Returns Promise<void | RnM2>

      A Promise that resolves to the glTF2 JSON or rejects with an error

      const importer = DrcPointCloudImporter.getInstance();
      const buffer = await fetch('pointcloud.drc').then(r => r.arrayBuffer());
      const gltfJson = await importer.importArrayBuffer('pointcloud.drc', buffer);
    • Imports a Draco point cloud file from a URI and converts it to glTF2 format. This method supports both direct file URIs and file collections passed through options.

      Parameters

      • uri: string

        The URI of the .drc file to import

      • Optionaloptions: GltfLoadOption

        Optional loading configuration including file collections and processing options

      Returns Promise<Result<RnM2, Err<ArrayBuffer, unknown>>>

      A Promise that resolves to a Result containing the glTF2 JSON or an error

      const importer = DrcPointCloudImporter.getInstance();
      const result = await importer.importPointCloud('path/to/pointcloud.drc');
      if (result.isOk()) {
      const gltfJson = result.get();
      // Process the glTF JSON
      }
    • Imports a Draco point cloud file and converts it directly to a Rhodonite Primitive. This method bypasses glTF conversion for direct primitive creation.

      Parameters

      • engine: Engine
      • uri: string

        The URI of the .drc file to import

      Returns Promise<Primitive>

      A Promise that resolves to a Rhodonite Primitive object

      const importer = DrcPointCloudImporter.getInstance();
      const primitive = await importer.importPointCloudToPrimitive('path/to/pointcloud.drc');
      // Use the primitive directly in Rhodonite