@expofp/renderer 3.1.6 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -178,6 +178,14 @@ export declare interface EventsAPI {
178
178
  clear(): void;
179
179
  }
180
180
 
181
+ /**
182
+ * Loads a GLB file, converts it to a Three.js {@link Scene}, exports the scene as a GLTF
183
+ * (JSON) file, and triggers a browser download of the result.
184
+ * @param url - The URL of the GLB file.
185
+ * @param isMeshopt - Whether the model file uses meshopt compression.
186
+ */
187
+ export declare function glb2gltf(url: string, isMeshopt?: boolean): Promise<void>;
188
+
181
189
  /**
182
190
  * Public API interface exposed through renderer.controls.handlers.
183
191
  * Each handler implements this interface to provide consistent enable/disable/configure functionality.
@@ -254,6 +262,10 @@ export declare function isLineDef(def: RenderableDef): def is LineDef;
254
262
 
255
263
  export declare function isLineLayer(layer: LayerDef): layer is TypedLayerDef<LineDef>;
256
264
 
265
+ export declare function isModelDef(def: RenderableDef): def is ModelDef;
266
+
267
+ export declare function isModelLayer(layer: LayerDef): layer is TypedLayerDef<ModelDef>;
268
+
257
269
  export declare function isShapeDef(def: RenderableDef): def is ShapeDef;
258
270
 
259
271
  export declare function isShapeLayer(layer: LayerDef): layer is TypedLayerDef<ShapeDef>;
@@ -294,6 +306,26 @@ export declare interface LineDef extends SharedDef {
294
306
  width: number;
295
307
  }
296
308
 
309
+ /** Options for loading a GLB file. */
310
+ export declare interface LoadGLBOptions {
311
+ /** The URL of the GLB file. */
312
+ url: string;
313
+ /** Whether the model file uses meshopt compression. */
314
+ isMeshopt?: boolean;
315
+ /** Whether the model file uses Draco compression. */
316
+ isDraco?: boolean;
317
+ }
318
+
319
+ /** External 3D model definition */
320
+ export declare interface ModelDef extends SharedDef {
321
+ /** Model's URL. Not updatable. */
322
+ url: string;
323
+ /** Model's bounds */
324
+ bounds: Rect;
325
+ /** Model's opacity. Optional. */
326
+ opacity?: number;
327
+ }
328
+
297
329
  /**
298
330
  * Data for mouse events
299
331
  */
@@ -452,7 +484,7 @@ export declare class Rect {
452
484
  private updateMinAndMax;
453
485
  }
454
486
 
455
- export declare type RenderableDef = LayerDef | ShapeDef | ImageDef | TextDef | LineDef;
487
+ export declare type RenderableDef = LayerDef | ShapeDef | ImageDef | TextDef | LineDef | ModelDef;
456
488
 
457
489
  export declare type RenderableDefCollection<T = RenderableDef> = T extends RenderableDef ? T[] : never;
458
490
 
@@ -530,6 +562,11 @@ export declare class Renderer {
530
562
  * Returns true if the renderer is disposed, meaning that all WebGL resources have been released.
531
563
  */
532
564
  get isDisposed(): boolean;
565
+ /**
566
+ * Loads a GLB file and returns a Three.js model.
567
+ * @param models - The models to load.
568
+ */
569
+ loadModel(models: LoadGLBOptions[]): Promise<void>;
533
570
  /**
534
571
  * Initializes viewport and scene with the given scene definition.
535
572
  * Should be called once on startup. Repeated calls will produce console warnings.
@@ -644,6 +681,16 @@ export declare interface SharedDef {
644
681
  dim?: boolean;
645
682
  }
646
683
 
684
+ /**
685
+ * Loads a GLTF/GLB file and splits its top-level children into two GLB files based on
686
+ * whether each child's name starts with `BasisTransform`. The matching children are saved
687
+ * with a `-decor` suffix; the rest are saved with a `-base` suffix. Both files are
688
+ * triggered as browser downloads. The output is intentionally uncompressed — run a
689
+ * meshopt/quantize pass offline (e.g. via `gltf-transform`) afterwards.
690
+ * @param url - The URL of the GLTF/GLB file.
691
+ */
692
+ export declare function splitGltf(url: string): Promise<void>;
693
+
647
694
  /** Text alignment */
648
695
  export declare interface TextAlignment {
649
696
  /** Horizontal alignment */