@shopware-ag/dive 2.3.7 → 3.0.0-beta.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.
Files changed (142) hide show
  1. package/build/chunks/Animator-DHnpWRt_.mjs +16 -0
  2. package/build/chunks/Animator-YDE8aFEd.cjs +1 -0
  3. package/build/chunks/{AssetCache-DSpWOp3n.mjs → AssetCache-C2DuXcmp.mjs} +6 -5
  4. package/build/chunks/AssetCache-CnbDDhU8.cjs +1 -0
  5. package/build/chunks/AssetExporter-Cdxb04b3.cjs +1 -0
  6. package/build/chunks/AssetExporter-DLL_vJae.mjs +67 -0
  7. package/build/chunks/AssetLoader-DO7xlbC3.mjs +499 -0
  8. package/build/chunks/AssetLoader-h2uyFEfZ.cjs +3 -0
  9. package/build/chunks/{ClipAnimator-keFLDMNZ.mjs → ClipAnimator-D8Gho4Ec.mjs} +2 -2
  10. package/build/chunks/ClipAnimator-SdDq2wk1.cjs +1 -0
  11. package/build/chunks/FileTypes-BB4_1gBJ.mjs +1975 -0
  12. package/build/chunks/FileTypes-Bvt5QTJC.cjs +29 -0
  13. package/build/chunks/GridNode-0R5ZnzR6.mjs +30 -0
  14. package/build/chunks/GridNode-iqnu86_v.cjs +1 -0
  15. package/build/chunks/{PerspectiveCamera-BFzE2TQU.mjs → PerspectiveCamera-B5TvUzTa.mjs} +1 -1
  16. package/build/chunks/PerspectiveCamera-DwQUmkDv.cjs +1 -0
  17. package/build/chunks/{TargetAnimator-DuqPk2eq.cjs → TargetAnimator-D37bWNKD.cjs} +1 -1
  18. package/build/chunks/{TargetAnimator-DUqkkdVb.mjs → TargetAnimator-DL_9b921.mjs} +1 -1
  19. package/build/chunks/{isFileTypeSupported-zLrD710P.mjs → isFileTypeSupported-D1z0zckw.mjs} +1 -1
  20. package/build/chunks/{isFileTypeSupported-Bh5Scxis.cjs → isFileTypeSupported-MJWHcUsR.cjs} +1 -1
  21. package/build/components/boundingbox/BoundingBox.d.ts +1 -1
  22. package/build/components/floor/Floor.d.ts +1 -1
  23. package/build/components/gizmo/Gizmo.d.ts +1 -1
  24. package/build/components/gizmo/handles/AxisHandle.d.ts +1 -1
  25. package/build/components/gizmo/handles/RadialHandle.d.ts +1 -1
  26. package/build/components/gizmo/handles/ScaleHandle.d.ts +1 -1
  27. package/build/components/gizmo/plane/GizmoPlane.d.ts +1 -1
  28. package/build/components/gizmo/rotate/RotateGizmo.d.ts +1 -1
  29. package/build/components/gizmo/scale/ScaleGizmo.d.ts +1 -1
  30. package/build/components/gizmo/translate/TranslateGizmo.d.ts +1 -1
  31. package/build/components/grid/Grid.d.ts +2 -1
  32. package/build/components/group/Group.d.ts +1 -1
  33. package/build/components/light/AmbientLight.d.ts +1 -1
  34. package/build/components/light/PointLight.d.ts +1 -1
  35. package/build/components/light/SceneLight.d.ts +1 -1
  36. package/build/components/model/Model.d.ts +1 -1
  37. package/build/components/node/Node.d.ts +1 -1
  38. package/build/components/primitive/Primitive.d.ts +1 -1
  39. package/build/components/root/Root.d.ts +1 -1
  40. package/build/dive.cjs +1 -1
  41. package/build/dive.mjs +58 -60
  42. package/build/engine/Dive.d.ts +3 -31
  43. package/build/engine/camera/PerspectiveCamera.d.ts +1 -1
  44. package/build/engine/environment/Environment.d.ts +12 -27
  45. package/build/engine/renderer/Renderer.d.ts +7 -8
  46. package/build/engine/scene/Scene.d.ts +1 -1
  47. package/build/engine/scene/xrroot/XRRoot.d.ts +2 -3
  48. package/build/engine/scene/xrroot/xrlightroot/XRLightRoot.d.ts +3 -3
  49. package/build/helpers/findInterface/findInterface.d.ts +1 -1
  50. package/build/helpers/findSceneRecursive/findSceneRecursive.d.ts +1 -1
  51. package/build/helpers/implementsInterface/implementsInterface.d.ts +1 -1
  52. package/build/helpers/math/signedAngleTo/signedAngleTo.d.ts +1 -1
  53. package/build/interfaces/Hoverable.d.ts +1 -1
  54. package/build/plugins/animation/index.cjs +1 -1
  55. package/build/plugins/animation/index.mjs +12 -20
  56. package/build/plugins/animation/src/animator/Animator.d.ts +1 -1
  57. package/build/plugins/animation/src/animator/ClipAnimator.d.ts +1 -1
  58. package/build/plugins/animation/src/system/AnimationSystem.d.ts +1 -6
  59. package/build/plugins/animation/src/types/AnimatorTypes.d.ts +1 -1
  60. package/build/plugins/ar/index.cjs +1 -1
  61. package/build/plugins/ar/index.mjs +5 -4
  62. package/build/plugins/ar/src/webxr/controller/WebXRController.d.ts +1 -1
  63. package/build/plugins/ar/src/webxr/crosshair/WebXRCrosshair.d.ts +1 -1
  64. package/build/plugins/ar/src/webxr/origin/WebXROrigin.d.ts +1 -1
  65. package/build/plugins/ar/src/webxr/raycaster/WebXRRaycaster.d.ts +1 -1
  66. package/build/plugins/ar/src/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +1 -1
  67. package/build/plugins/assetcache/index.cjs +1 -1
  68. package/build/plugins/assetcache/index.mjs +1 -1
  69. package/build/plugins/assetexporter/index.cjs +1 -1
  70. package/build/plugins/assetexporter/index.mjs +1 -1
  71. package/build/plugins/assetexporter/src/AssetExporter.d.ts +1 -1
  72. package/build/plugins/assetloader/index.cjs +1 -1
  73. package/build/plugins/assetloader/index.mjs +2 -2
  74. package/build/plugins/assetloader/src/loader/AssetLoader.d.ts +2 -2
  75. package/build/plugins/assetloader/src/step/STEPLoader.d.ts +1 -1
  76. package/build/plugins/mediacreator/index.cjs +1 -1
  77. package/build/plugins/mediacreator/index.mjs +52 -24
  78. package/build/plugins/mediacreator/src/MediaCreator.d.ts +4 -3
  79. package/build/plugins/mediacreator/types/MediaGenerationByPosition.d.ts +1 -1
  80. package/build/plugins/orbitcontroller/index.cjs +1 -1
  81. package/build/plugins/orbitcontroller/index.mjs +1 -1
  82. package/build/plugins/orbitcontroller/src/OrbitController.d.ts +1 -1
  83. package/build/plugins/orbitcontroller/types/OrbitControllerState.types.d.ts +1 -1
  84. package/build/plugins/orientationdisplay/index.cjs +1 -1
  85. package/build/plugins/orientationdisplay/index.mjs +17 -16
  86. package/build/plugins/orientationdisplay/src/axes/Axes.d.ts +1 -1
  87. package/build/plugins/quickview/index.cjs +1 -1
  88. package/build/plugins/quickview/index.mjs +9 -8
  89. package/build/plugins/shader/index.cjs +1 -1
  90. package/build/plugins/shader/index.mjs +2 -3
  91. package/build/plugins/shader/src/index.d.ts +1 -3
  92. package/build/plugins/shader/src/shaders/GridNode.d.ts +16 -0
  93. package/build/plugins/state/index.cjs +11 -11
  94. package/build/plugins/state/index.mjs +1538 -1537
  95. package/build/plugins/state/src/actions/camera/computeencompassingview.d.ts +1 -1
  96. package/build/plugins/state/src/actions/camera/getcameratransform.d.ts +1 -1
  97. package/build/plugins/state/src/actions/camera/movecamera.d.ts +1 -1
  98. package/build/plugins/state/src/actions/camera/setcameratransform.d.ts +1 -1
  99. package/build/plugins/state/types/StateSceneData.d.ts +1 -1
  100. package/build/plugins/toolbox/index.cjs +1 -1
  101. package/build/plugins/toolbox/index.d.ts +0 -1
  102. package/build/plugins/toolbox/index.mjs +224 -853
  103. package/build/plugins/toolbox/src/PointerContext.d.ts +1 -1
  104. package/build/plugins/toolbox/src/SelectionState.d.ts +1 -1
  105. package/build/plugins/toolbox/src/Toolbox.d.ts +0 -10
  106. package/build/plugins/toolbox/src/drag/DragTool.d.ts +1 -1
  107. package/build/plugins/toolbox/src/drag/DraggableEvent.d.ts +1 -1
  108. package/build/plugins/toolbox/src/hover/HoverTool.d.ts +1 -1
  109. package/build/plugins/toolbox/src/select/SelectTool.d.ts +1 -1
  110. package/build/plugins/toolbox/src/transform/TransformTool.d.ts +2 -1
  111. package/build/types/schema/GroupSchema.d.ts +1 -1
  112. package/build/types/schema/LightSchema.d.ts +1 -1
  113. package/build/types/schema/MaterialSchema.d.ts +1 -1
  114. package/build/types/schema/ModelSchema.d.ts +1 -1
  115. package/build/types/schema/PovSchema.d.ts +1 -1
  116. package/build/types/schema/PrimitiveSchema.d.ts +1 -1
  117. package/package.json +5 -4
  118. package/build/chunks/Animator-BGFdF70Z.mjs +0 -47
  119. package/build/chunks/Animator-Cu7NIkVg.cjs +0 -1
  120. package/build/chunks/AssetCache-DJyYrAdR.cjs +0 -1
  121. package/build/chunks/AssetExporter-PFiNYi50.mjs +0 -1628
  122. package/build/chunks/AssetExporter-yVhYmVXW.cjs +0 -164
  123. package/build/chunks/AssetLoader-BA_QwJMR.mjs +0 -2590
  124. package/build/chunks/AssetLoader-DJb8P6eB.cjs +0 -5
  125. package/build/chunks/ClipAnimator-tjhLo851.cjs +0 -1
  126. package/build/chunks/DIVEShaderMaterial-Bt0d8oJB.mjs +0 -3468
  127. package/build/chunks/DIVEShaderMaterial-DE8YRWj9.cjs +0 -1554
  128. package/build/chunks/FileTypes-BSJhZREN.cjs +0 -33
  129. package/build/chunks/FileTypes-CUf24rq6.mjs +0 -2155
  130. package/build/chunks/PerspectiveCamera-iAsZqrnY.cjs +0 -1
  131. package/build/chunks/draco_decoder-Bh9flJPu.cjs +0 -1
  132. package/build/chunks/draco_decoder-CEzwqP9o.mjs +0 -38
  133. package/build/chunks/draco_decoder-DtHHc5d0.mjs +0 -4
  134. package/build/chunks/draco_decoder-DvYjcLz_.cjs +0 -35
  135. package/build/chunks/draco_wasm_wrapper-FoEVV9af.cjs +0 -118
  136. package/build/chunks/draco_wasm_wrapper-yQy2VLhb.mjs +0 -121
  137. package/build/chunks/fflate.module-DHdJvhNh.cjs +0 -6
  138. package/build/chunks/fflate.module-xyO_T3Zm.mjs +0 -602
  139. package/build/plugins/shader/src/material/DIVEShaderMaterial.d.ts +0 -5
  140. package/build/plugins/shader/src/shaders/DIVEShaderLib.d.ts +0 -2
  141. package/build/plugins/shader/src/shaders/grid/index.d.ts +0 -40
  142. package/build/plugins/toolbox/src/BaseTool.d.ts +0 -59
@@ -1,11 +1,9 @@
1
- import { Scene, WebGLRenderer } from 'three';
1
+ import { Scene, WebGPURenderer } from 'three/webgpu';
2
2
  export type DIVEEnvironmentSettings = {
3
3
  /**
4
4
  * Whether to enable the image-based lighting.
5
5
  *
6
6
  * @default true
7
- *
8
- * @deprecated enabled defaults to true.
9
7
  */
10
8
  enabled: boolean;
11
9
  /**
@@ -24,8 +22,6 @@ export type DIVEEnvironmentSettings = {
24
22
  * The intensity of the environment lighting.
25
23
  *
26
24
  * @default 1
27
- *
28
- * @deprecated envIntensity defaults to 1.0.
29
25
  */
30
26
  globalEnvIntensity: number;
31
27
  /**
@@ -44,8 +40,6 @@ export type DIVEEnvironmentSettings = {
44
40
  * Whether to replace the existing lights (can be restored via `restoreLights`).
45
41
  *
46
42
  * @default false
47
- *
48
- * @deprecated replaceLights defaults to false. Remove lights manually instead.
49
43
  */
50
44
  replaceLights?: boolean;
51
45
  };
@@ -66,7 +60,13 @@ export declare class DIVEEnvironment {
66
60
  private currentBackgroundCube;
67
61
  private sourceImage;
68
62
  private options;
69
- constructor(renderer: WebGLRenderer, scene: Scene, options?: Partial<DIVEEnvironmentSettings>);
63
+ private _loadPromise;
64
+ private _initPromise;
65
+ private _sourceImageLoadId;
66
+ private _initRequested;
67
+ private _disposed;
68
+ constructor(renderer: WebGPURenderer, scene: Scene, options?: Partial<DIVEEnvironmentSettings>);
69
+ init(): Promise<void>;
70
70
  /**
71
71
  * Disposes the environment.
72
72
  */
@@ -84,11 +84,11 @@ export declare class DIVEEnvironment {
84
84
  */
85
85
  update(): void;
86
86
  /**
87
- * Sets the renderer and updates the environment. Use this only when rebuilding the webgl renderer.
87
+ * Sets the renderer and rebinds the PMREM generator. Use this only when rebuilding the renderer.
88
88
  *
89
- * @param renderer - The webglrenderer.
89
+ * @param renderer - The renderer.
90
90
  */
91
- setRenderer(renderer: WebGLRenderer): void;
91
+ setRenderer(renderer: WebGPURenderer): void;
92
92
  /**
93
93
  * Sets the URL of the HDR image.
94
94
  *
@@ -114,20 +114,5 @@ export declare class DIVEEnvironment {
114
114
  * @returns The loaded equirectangular HDR texture.
115
115
  */
116
116
  private loadHDRImage;
117
- /**
118
- * @deprecated setGlobalEnvIntensity does nothing.
119
- */
120
- setGlobalEnvIntensity(intensity: number): void;
121
- /**
122
- * @deprecated setExposure does nothing.
123
- */
124
- setExposure(exposure: number): void;
125
- /**
126
- * @deprecated disable does nothing. Environment is enabled by default.
127
- */
128
- disable(): void;
129
- /**
130
- * @deprecated Use update() instead.
131
- */
132
- enable(): Promise<void>;
117
+ private _loadSourceImage;
133
118
  }
@@ -1,4 +1,4 @@
1
- import { WebGLRenderer } from 'three';
1
+ import { WebGPURenderer } from 'three/webgpu';
2
2
  import { DIVEScene } from '../scene/Scene.ts';
3
3
  import { DIVEPerspectiveCamera } from '../camera/PerspectiveCamera.ts';
4
4
  import { DIVEEnvironment } from '../environment/Environment.ts';
@@ -72,20 +72,19 @@ export declare class DIVERenderer {
72
72
  private _scene;
73
73
  private _camera;
74
74
  readonly isDIVERenderer: true;
75
- private _webglrenderer;
75
+ private _webgpurenderer;
76
76
  private _environment;
77
+ private _initPromise;
77
78
  private _settings;
78
79
  constructor(_scene: DIVEScene, _camera: DIVEPerspectiveCamera, settings?: Partial<DIVERendererSettings>);
79
- get webglrenderer(): WebGLRenderer;
80
+ get webgpurenderer(): WebGPURenderer;
80
81
  get environment(): DIVEEnvironment;
81
82
  get canvas(): HTMLCanvasElement;
83
+ get initialized(): boolean;
84
+ init(): Promise<void>;
82
85
  render(): void;
83
86
  onResize(width: number, height: number): void;
84
87
  dispose(): void;
85
88
  setCanvas(canvas: HTMLCanvasElement): void;
86
- private _createWebGLRenderer;
89
+ private _createWebGPURenderer;
87
90
  }
88
- /**
89
- * @deprecated Use `import { DIVERenderer } from '@shopware-ag/dive'` instead.
90
- */
91
- export declare const DIVERenderPipeline: typeof DIVERenderer;
@@ -1,4 +1,4 @@
1
- import { Scene, Box3, ColorRepresentation } from 'three';
1
+ import { Scene, Box3, ColorRepresentation } from 'three/webgpu';
2
2
  import { DIVERoot } from '../../components/root/Root.ts';
3
3
  import { DIVEGrid } from '../../components/grid/Grid.ts';
4
4
  export type DIVESceneSettings = {
@@ -1,6 +1,5 @@
1
- import { Object3D } from 'three';
1
+ import { Object3D } from 'three/webgpu';
2
2
  import { DIVERoot } from '../../../components/root/Root.ts';
3
- import { DIVERenderer } from '../../renderer/Renderer.ts';
4
3
  import { DIVEXRLightRoot } from './xrlightroot/XRLightRoot.ts';
5
4
  import { DIVEScene } from '../Scene.ts';
6
5
  export declare class DIVEXRRoot extends Object3D {
@@ -12,6 +11,6 @@ export declare class DIVEXRRoot extends Object3D {
12
11
  get XRHandNode(): Object3D;
13
12
  private _xrShadowPlane;
14
13
  constructor(scene: DIVEScene);
15
- initLightEstimation(renderer: DIVERenderer): void;
14
+ initLightEstimation(): void;
16
15
  disposeLightEstimation(): void;
17
16
  }
@@ -1,12 +1,12 @@
1
- import { DIVERenderer } from '../../../renderer/Renderer.ts';
2
- import { Object3D } from 'three';
1
+ import { Object3D } from 'three/webgpu';
3
2
  import { DIVEScene } from '../../Scene.ts';
4
3
  export declare class DIVEXRLightRoot extends Object3D {
5
4
  private _scene;
6
5
  private _xrLight;
7
6
  private _lightRoot;
7
+ private _warnedUnsupported;
8
8
  constructor(scene: DIVEScene);
9
- initLightEstimation(renderer: DIVERenderer): void;
9
+ initLightEstimation(): void;
10
10
  disposeLightEstimation(): void;
11
11
  private onEstimationStart;
12
12
  private onEstimationEnd;
@@ -1,2 +1,2 @@
1
- import { Object3D } from 'three';
1
+ import { Object3D } from 'three/webgpu';
2
2
  export declare function findInterface<T>(object: Object3D | null | undefined, discriminator: string): (Object3D & T) | undefined;
@@ -1,4 +1,4 @@
1
- import { Object3D } from 'three';
1
+ import { Object3D } from 'three/webgpu';
2
2
  import { DIVEScene } from '../../engine/scene/Scene.ts';
3
3
  /**
4
4
  * Find the scene object of an object.
@@ -1,2 +1,2 @@
1
- import { Object3D } from 'three';
1
+ import { Object3D } from 'three/webgpu';
2
2
  export declare function implementsInterface<T>(object: Object3D | null | undefined, discriminator: string): object is Object3D & T;
@@ -1,4 +1,4 @@
1
- import { Vector3 } from 'three';
1
+ import { Vector3 } from 'three/webgpu';
2
2
  /**
3
3
  * Calculate the signed angle between two vectors. Only works when the vectors are on the same plane.
4
4
  * @param vecB Start Vector
@@ -1,4 +1,4 @@
1
- import { Intersection } from 'three';
1
+ import { Intersection } from 'three/webgpu';
2
2
  export interface DIVEHoverable {
3
3
  isHoverable: true;
4
4
  onPointerEnter?: (i: Intersection) => void;
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var u=(s,t,e)=>t in s?m(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var n=(s,t,e)=>u(s,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tweenjs/tween.js"),c=require("three");class l{constructor(){n(this,"uuid",c.MathUtils.generateUUID());n(this,"Easing",o.Easing);n(this,"_animators",new Map)}dispose(){for(const t of this._animators.values())t.dispose();this._animators.clear()}tick(t){for(const e of this._animators.values())e.update(t)}async animate(t,e,i){const a=await this.fromTargets(t,e,i);return a.play(),a}async fromTargets(t,e,i){const{TargetAnimator:a}=await Promise.resolve().then(()=>require("../../chunks/TargetAnimator-DuqPk2eq.cjs")),r=new a(t,e,i);return this._animators.set(r.uuid,r),r}async fromClips(t,e){const{ClipAnimator:i}=await Promise.resolve().then(()=>require("../../chunks/ClipAnimator-tjhLo851.cjs")),a=new i(t,e);return this._animators.set(a.uuid,a),a}remove(t){const e=this._animators.get(t);if(!e){console.warn(`Animator with uuid ${t} not found`);return}e.dispose(),this._animators.delete(t)}}Object.defineProperty(exports,"Easing",{enumerable:!0,get:()=>o.Easing});exports.AnimationSystem=l;
1
+ "use strict";var m=Object.defineProperty;var u=(a,t,e)=>t in a?m(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var i=(a,t,e)=>u(a,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tweenjs/tween.js"),c=require("three/webgpu");class l{constructor(){i(this,"uuid",c.MathUtils.generateUUID());i(this,"Easing",o.Easing);i(this,"_animators",new Map)}dispose(){for(const t of this._animators.values())t.dispose();this._animators.clear()}tick(t){for(const e of this._animators.values())e.update(t)}async fromTargets(t,e,n){const{TargetAnimator:s}=await Promise.resolve().then(()=>require("../../chunks/TargetAnimator-D37bWNKD.cjs")),r=new s(t,e,n);return this._animators.set(r.uuid,r),r}async fromClips(t,e){const{ClipAnimator:n}=await Promise.resolve().then(()=>require("../../chunks/ClipAnimator-SdDq2wk1.cjs")),s=new n(t,e);return this._animators.set(s.uuid,s),s}remove(t){const e=this._animators.get(t);if(!e){console.warn(`Animator with uuid ${t} not found`);return}e.dispose(),this._animators.delete(t)}}Object.defineProperty(exports,"Easing",{enumerable:!0,get:()=>o.Easing});exports.AnimationSystem=l;
@@ -1,14 +1,14 @@
1
1
  var e = Object.defineProperty;
2
- var m = (i, t, a) => t in i ? e(i, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : i[t] = a;
3
- var n = (i, t, a) => m(i, typeof t != "symbol" ? t + "" : t, a);
2
+ var m = (o, t, a) => t in o ? e(o, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : o[t] = a;
3
+ var s = (o, t, a) => m(o, typeof t != "symbol" ? t + "" : t, a);
4
4
  import { Easing as c } from "@tweenjs/tween.js";
5
- import { Easing as w } from "@tweenjs/tween.js";
6
- import { MathUtils as p } from "three";
5
+ import { Easing as g } from "@tweenjs/tween.js";
6
+ import { MathUtils as p } from "three/webgpu";
7
7
  class l {
8
8
  constructor() {
9
- n(this, "uuid", p.generateUUID());
10
- n(this, "Easing", c);
11
- n(this, "_animators", /* @__PURE__ */ new Map());
9
+ s(this, "uuid", p.generateUUID());
10
+ s(this, "Easing", c);
11
+ s(this, "_animators", /* @__PURE__ */ new Map());
12
12
  }
13
13
  dispose() {
14
14
  for (const t of this._animators.values())
@@ -19,14 +19,6 @@ class l {
19
19
  for (const a of this._animators.values())
20
20
  a.update(t);
21
21
  }
22
- /**
23
- * @deprecated Use `fromTargets()` instead.
24
- * @note This method also calls .play() on the animator automatically. This has been removed in fromTargets(). You have to call .play() independently after creating the animator.
25
- */
26
- async animate(t, a, s) {
27
- const o = await this.fromTargets(t, a, s);
28
- return o.play(), o;
29
- }
30
22
  /**
31
23
  * Creates a TargetAnimator and returns it asynchronously.
32
24
  *
@@ -55,8 +47,8 @@ class l {
55
47
  * @param options - The options for the animation.
56
48
  * @returns Promise<TargetAnimator>.
57
49
  */
58
- async fromTargets(t, a, s) {
59
- const { TargetAnimator: o } = await import("../../chunks/TargetAnimator-DUqkkdVb.mjs"), r = new o(t, a, s);
50
+ async fromTargets(t, a, n) {
51
+ const { TargetAnimator: i } = await import("../../chunks/TargetAnimator-DL_9b921.mjs"), r = new i(t, a, n);
60
52
  return this._animators.set(r.uuid, r), r;
61
53
  }
62
54
  /**
@@ -78,8 +70,8 @@ class l {
78
70
  * @returns Promise<ClipAnimator>.
79
71
  */
80
72
  async fromClips(t, a) {
81
- const { ClipAnimator: s } = await import("../../chunks/ClipAnimator-keFLDMNZ.mjs"), o = new s(t, a);
82
- return this._animators.set(o.uuid, o), o;
73
+ const { ClipAnimator: n } = await import("../../chunks/ClipAnimator-D8Gho4Ec.mjs"), i = new n(t, a);
74
+ return this._animators.set(i.uuid, i), i;
83
75
  }
84
76
  /**
85
77
  * Removes an animator from the system.
@@ -97,5 +89,5 @@ class l {
97
89
  }
98
90
  export {
99
91
  l as AnimationSystem,
100
- w as Easing
92
+ g as Easing
101
93
  };
@@ -1,4 +1,4 @@
1
- import { EventDispatcher } from 'three/src/core/EventDispatcher.js';
1
+ import { EventDispatcher } from 'three/webgpu';
2
2
  import { TAnimatorEventMap, TAnimatorLoopMode, TAnimatorState } from '../types/AnimatorTypes.ts';
3
3
  /**
4
4
  * Abstract base class for all animation types.
@@ -1,4 +1,4 @@
1
- import { AnimationClip, Object3D } from 'three';
1
+ import { AnimationClip, Object3D } from 'three/webgpu';
2
2
  import { Animator } from './Animator.ts';
3
3
  import { TAnimatorLoopMode, TAnimatorState } from '../types/AnimatorTypes.ts';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { AnimationClip, Object3D } from 'three';
1
+ import { AnimationClip, Object3D } from 'three/webgpu';
2
2
  import { DIVETicker } from '../../../../index.ts';
3
3
  type ClipAnimator = import('../animator/ClipAnimator.ts').ClipAnimator;
4
4
  type TargetAnimator = import('../animator/TargetAnimator.ts').TargetAnimator;
@@ -82,11 +82,6 @@ export declare class AnimationSystem implements DIVETicker {
82
82
  private _animators;
83
83
  dispose(): void;
84
84
  tick(deltaTime: number): void;
85
- /**
86
- * @deprecated Use `fromTargets()` instead.
87
- * @note This method also calls .play() on the animator automatically. This has been removed in fromTargets(). You have to call .play() independently after creating the animator.
88
- */
89
- animate(targets: AnimationTarget | AnimationTarget[], duration: number, options?: TargetAnimatorOptions): Promise<TargetAnimator>;
90
85
  /**
91
86
  * Creates a TargetAnimator and returns it asynchronously.
92
87
  *
@@ -1,4 +1,4 @@
1
- import { Event } from 'three/src/core/EventDispatcher.js';
1
+ import { Event } from 'three/webgpu';
2
2
  export type TAnimatorState = 'idle' | 'playing' | 'paused';
3
3
  export type TAnimatorEventMap = {
4
4
  play: Event;
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var h=(o,e,r)=>e in o?f(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r;var l=(o,e,r)=>h(o,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../systeminfo/index.cjs"),A=require("../assetconverter/index.cjs"),O=require("../../chunks/AssetLoader-DJb8P6eB.cjs"),w=require("../../chunks/AssetExporter-yVhYmVXW.cjs");var m=(o=>(o.AR_DESKTOP_PLATFORM_ERROR="ar-desktop-platform-error",o.AR_QUICK_LOOK_NOT_SAFARI_ERROR="ar-quicklook-not-safari-error",o.AR_QUICK_LOOK_VERSION_MISMATCH_ERROR="ar-quicklook-version-mismatch-error",o.AR_QUICK_LOOK_UNKNOWN_ERROR="ar-quicklook-unknown-error",o))(m||{});class a extends Error{constructor(r,t){super(r);l(this,"type");this.name=this.constructor.name,this.type=t,Object.setPrototypeOf(this,new.target.prototype)}}class R extends a{constructor(){super("AR features are not supported on desktop platforms.","ar-desktop-platform-error")}}class p extends a{constructor(){super("ARQuickLook on iOS is only available in Safari.","ar-quicklook-not-safari-error")}}class d extends a{constructor(e,r){super(`ARQuickLook requires iOS version ${r} or later. Current version: ${e}.`,"ar-quicklook-version-mismatch-error"),this.currentVersion=e,this.requiredVersion=r}}class u extends a{constructor(){super("An unknown ARQuickLook compatibility error occurred.","ar-quicklook-unknown-error")}}const k=12;class S{constructor(){l(this,"converter",new A.AssetConverter(new O.AssetLoader,new w.AssetExporter))}async launch(e,r){if(c.SystemInfo.getBrowser()!==c.EBrowser.SAFARI)return Promise.reject(new p);const t=c.SystemInfo.getIOSVersion();if(t&&t.major<k)return Promise.reject(new d(t.full,k));if(!t)return Promise.reject(new u);if(!c.SystemInfo.getSupportsARQuickLook())return Promise.reject(new u);const n=await this.convertToUSDZ(e,r);return this.launchARQuickLook(n,r)}async convertToUSDZ(e,r){const t=await this.converter.convert(e).to("usdz",{quickLookCompatible:!0,ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}}}),n=new Blob([t],{type:"model/vnd.usdz+zip"});return URL.createObjectURL(n)}launchARQuickLook(e,r){return new Promise(t=>{(r==null?void 0:r.arScale)==="fixed"&&(e=e.concat("#allowsContentScaling=0"));const n=document.createElement("a");n.innerHTML="<picture></picture>",n.rel="ar",n.href=e,n.download="scene.usdz",t(),n.click()})}}class _{launch(e,r){const t=self.location.toString(),n=document.createElement("a"),s=this._createParams(t,e,r),i=this._createIntent(t,e,s);n.setAttribute("href",i),n.click()}_createParams(e,r,t){const n=new URL(r,e),s=new URLSearchParams(n.search);return s.set("mode","ar_preferred"),this._applyScaleOption(s,t),this._applyPlacementOption(s,t),this._applySoundOption(s,e),this._applyLinkOption(s,e),s}_applyScaleOption(e,r){(r==null?void 0:r.arScale)==="fixed"&&e.set("resizable","false")}_applyPlacementOption(e,r){(r==null?void 0:r.arPlacement)==="vertical"&&e.set("enable_vertical_placement","true")}_applySoundOption(e,r){if(e.has("sound")){const t=new URL(e.get("sound"),r);e.set("sound",t.toString())}}_applyLinkOption(e,r){if(e.has("link")){const t=new URL(e.get("link"),r);e.set("link",t.toString())}}_createIntent(e,r,t){const n=new URL(e),s=new URL(r,e),i="#model-viewer-no-ar-fallback";return n.hash=i,`intent://arvr.google.com/scene-viewer/1.2?${t.toString()+"&file="+s.toString()}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(n.toString())};end;`}}class L{async launch(e,r){const t=c.SystemInfo.getSystem();return t===c.ESystem.IOS?new S().launch(e,r):t===c.ESystem.ANDROID?new _().launch(e,r):Promise.reject(new R)}}exports.ARDesktopPlatformError=R;exports.ARError=a;exports.ARQuickLook=S;exports.ARQuickLookNotSafariError=p;exports.ARQuickLookUnknownError=u;exports.ARQuickLookVersionMismatchError=d;exports.ARSystem=L;exports.EARErrorType=m;exports.SceneViewer=_;
1
+ "use strict";var f=Object.defineProperty;var h=(o,e,r)=>e in o?f(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r;var l=(o,e,r)=>h(o,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../systeminfo/index.cjs"),A=require("../assetconverter/index.cjs"),O=require("../../chunks/AssetLoader-h2uyFEfZ.cjs");require("three/examples/jsm/loaders/DRACOLoader.js");const w=require("../../chunks/AssetExporter-Cdxb04b3.cjs");var m=(o=>(o.AR_DESKTOP_PLATFORM_ERROR="ar-desktop-platform-error",o.AR_QUICK_LOOK_NOT_SAFARI_ERROR="ar-quicklook-not-safari-error",o.AR_QUICK_LOOK_VERSION_MISMATCH_ERROR="ar-quicklook-version-mismatch-error",o.AR_QUICK_LOOK_UNKNOWN_ERROR="ar-quicklook-unknown-error",o))(m||{});class a extends Error{constructor(r,t){super(r);l(this,"type");this.name=this.constructor.name,this.type=t,Object.setPrototypeOf(this,new.target.prototype)}}class R extends a{constructor(){super("AR features are not supported on desktop platforms.","ar-desktop-platform-error")}}class p extends a{constructor(){super("ARQuickLook on iOS is only available in Safari.","ar-quicklook-not-safari-error")}}class d extends a{constructor(e,r){super(`ARQuickLook requires iOS version ${r} or later. Current version: ${e}.`,"ar-quicklook-version-mismatch-error"),this.currentVersion=e,this.requiredVersion=r}}class u extends a{constructor(){super("An unknown ARQuickLook compatibility error occurred.","ar-quicklook-unknown-error")}}const k=12;class S{constructor(){l(this,"converter",new A.AssetConverter(new O.AssetLoader,new w.AssetExporter))}async launch(e,r){if(c.SystemInfo.getBrowser()!==c.EBrowser.SAFARI)return Promise.reject(new p);const t=c.SystemInfo.getIOSVersion();if(t&&t.major<k)return Promise.reject(new d(t.full,k));if(!t)return Promise.reject(new u);if(!c.SystemInfo.getSupportsARQuickLook())return Promise.reject(new u);const n=await this.convertToUSDZ(e,r);return this.launchARQuickLook(n,r)}async convertToUSDZ(e,r){const t=await this.converter.convert(e).to("usdz",{quickLookCompatible:!0,ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}}}),n=new Blob([t],{type:"model/vnd.usdz+zip"});return URL.createObjectURL(n)}launchARQuickLook(e,r){return new Promise(t=>{(r==null?void 0:r.arScale)==="fixed"&&(e=e.concat("#allowsContentScaling=0"));const n=document.createElement("a");n.innerHTML="<picture></picture>",n.rel="ar",n.href=e,n.download="scene.usdz",t(),n.click()})}}class _{launch(e,r){const t=self.location.toString(),n=document.createElement("a"),s=this._createParams(t,e,r),i=this._createIntent(t,e,s);n.setAttribute("href",i),n.click()}_createParams(e,r,t){const n=new URL(r,e),s=new URLSearchParams(n.search);return s.set("mode","ar_preferred"),this._applyScaleOption(s,t),this._applyPlacementOption(s,t),this._applySoundOption(s,e),this._applyLinkOption(s,e),s}_applyScaleOption(e,r){(r==null?void 0:r.arScale)==="fixed"&&e.set("resizable","false")}_applyPlacementOption(e,r){(r==null?void 0:r.arPlacement)==="vertical"&&e.set("enable_vertical_placement","true")}_applySoundOption(e,r){if(e.has("sound")){const t=new URL(e.get("sound"),r);e.set("sound",t.toString())}}_applyLinkOption(e,r){if(e.has("link")){const t=new URL(e.get("link"),r);e.set("link",t.toString())}}_createIntent(e,r,t){const n=new URL(e),s=new URL(r,e),i="#model-viewer-no-ar-fallback";return n.hash=i,`intent://arvr.google.com/scene-viewer/1.2?${t.toString()+"&file="+s.toString()}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(n.toString())};end;`}}class L{async launch(e,r){const t=c.SystemInfo.getSystem();return t===c.ESystem.IOS?new S().launch(e,r):t===c.ESystem.ANDROID?new _().launch(e,r):Promise.reject(new R)}}exports.ARDesktopPlatformError=R;exports.ARError=a;exports.ARQuickLook=S;exports.ARQuickLookNotSafariError=p;exports.ARQuickLookUnknownError=u;exports.ARQuickLookVersionMismatchError=d;exports.ARSystem=L;exports.EARErrorType=m;exports.SceneViewer=_;
@@ -3,8 +3,9 @@ var R = (o, e, r) => e in o ? p(o, e, { enumerable: !0, configurable: !0, writab
3
3
  var l = (o, e, r) => R(o, typeof e != "symbol" ? e + "" : e, r);
4
4
  import { SystemInfo as c, EBrowser as d, ESystem as u } from "../systeminfo/index.mjs";
5
5
  import { AssetConverter as h } from "../assetconverter/index.mjs";
6
- import { A as _ } from "../../chunks/AssetLoader-BA_QwJMR.mjs";
7
- import { A as f } from "../../chunks/AssetExporter-PFiNYi50.mjs";
6
+ import { A as _ } from "../../chunks/AssetLoader-DO7xlbC3.mjs";
7
+ import "three/examples/jsm/loaders/DRACOLoader.js";
8
+ import { A as f } from "../../chunks/AssetExporter-DLL_vJae.mjs";
8
9
  var S = /* @__PURE__ */ ((o) => (o.AR_DESKTOP_PLATFORM_ERROR = "ar-desktop-platform-error", o.AR_QUICK_LOOK_NOT_SAFARI_ERROR = "ar-quicklook-not-safari-error", o.AR_QUICK_LOOK_VERSION_MISMATCH_ERROR = "ar-quicklook-version-mismatch-error", o.AR_QUICK_LOOK_UNKNOWN_ERROR = "ar-quicklook-unknown-error", o))(S || {});
9
10
  class a extends Error {
10
11
  constructor(r, t) {
@@ -180,7 +181,7 @@ class g {
180
181
  )};end;`;
181
182
  }
182
183
  }
183
- class b {
184
+ class Q {
184
185
  /**
185
186
  * Launches an AR experience using the appropriate platform-specific implementation
186
187
  *
@@ -201,7 +202,7 @@ export {
201
202
  w as ARQuickLookNotSafariError,
202
203
  k as ARQuickLookUnknownError,
203
204
  A as ARQuickLookVersionMismatchError,
204
- b as ARSystem,
205
+ Q as ARSystem,
205
206
  S as EARErrorType,
206
207
  g as SceneViewer
207
208
  };
@@ -1,4 +1,4 @@
1
- import { Object3D } from 'three';
1
+ import { Object3D } from 'three/webgpu';
2
2
  import { DIVERenderer } from '../../../../../engine/renderer/Renderer.ts';
3
3
  import { DIVEScene } from '../../../../../engine/scene/Scene.ts';
4
4
  export declare class DIVEWebXRController extends Object3D {
@@ -1,4 +1,4 @@
1
- import { Mesh, Object3D } from 'three';
1
+ import { Mesh, Object3D } from 'three/webgpu';
2
2
  export declare class DIVEWebXRCrosshair extends Object3D {
3
3
  set mesh(mesh: Mesh | undefined);
4
4
  constructor(mesh?: Mesh);
@@ -1,4 +1,4 @@
1
- import { Matrix4, Quaternion, Vector3 } from 'three';
1
+ import { Matrix4, Quaternion, Vector3 } from 'three/webgpu';
2
2
  import { DIVERenderer } from '../../../../../engine/renderer/Renderer.ts';
3
3
  export declare class DIVEWebXROrigin {
4
4
  private _renderer;
@@ -1,4 +1,4 @@
1
- import { Matrix4, Mesh, Vector3 } from 'three';
1
+ import { Matrix4, Mesh, Vector3 } from 'three/webgpu';
2
2
  import { DIVERenderer } from '../../../../../engine/renderer/Renderer.ts';
3
3
  import { DIVEScene } from '../../../../../engine/scene/Scene.ts';
4
4
  import { EventDispatcher } from '../../../../../events/index.ts';
@@ -1,4 +1,4 @@
1
- import { Vector2 } from 'three';
1
+ import { Vector2 } from 'three/webgpu';
2
2
  import { EventDispatcher } from '../../../../../events/index.ts';
3
3
  export type DIVETouchscreenEvents = {
4
4
  TOUCH_START: {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetCache-DJyYrAdR.cjs");exports.AssetCache=e.AssetCache;exports.Chunk=e.Chunk;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetCache-CnbDDhU8.cjs");exports.AssetCache=e.AssetCache;exports.Chunk=e.Chunk;
@@ -1,4 +1,4 @@
1
- import { A as e, C } from "../../chunks/AssetCache-DSpWOp3n.mjs";
1
+ import { A as e, C } from "../../chunks/AssetCache-C2DuXcmp.mjs";
2
2
  export {
3
3
  e as AssetCache,
4
4
  C as Chunk
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetExporter-yVhYmVXW.cjs");exports.AssetExporter=e.AssetExporter;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetExporter-Cdxb04b3.cjs");exports.AssetExporter=e.AssetExporter;
@@ -1,4 +1,4 @@
1
- import { A as o } from "../../chunks/AssetExporter-PFiNYi50.mjs";
1
+ import { A as o } from "../../chunks/AssetExporter-DLL_vJae.mjs";
2
2
  export {
3
3
  o as AssetExporter
4
4
  };
@@ -1,4 +1,4 @@
1
- import { Object3D } from 'three';
1
+ import { Object3D } from 'three/webgpu';
2
2
  import { GLTFExporterOptions as THREEGLTFExporterOptions } from 'three/examples/jsm/exporters/GLTFExporter.js';
3
3
  import { USDZExporterOptions as THREEUSDZExporterOptions } from 'three/examples/jsm/exporters/USDZExporter.js';
4
4
  import { FileType } from '../../../types/file/FileTypes.ts';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetLoader-DJb8P6eB.cjs");exports.AssetLoader=e.AssetLoader;exports.DRACOWorker=e.DRACOWorker;exports.DracoLoader=e.DracoLoader;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetLoader-h2uyFEfZ.cjs");exports.AssetLoader=e.AssetLoader;exports.DRACOWorker=e.DRACOWorker;exports.DracoLoader=e.DracoLoader;
@@ -1,5 +1,5 @@
1
- import { A as o } from "../../chunks/AssetLoader-BA_QwJMR.mjs";
2
- import { D as s, a as t } from "../../chunks/AssetLoader-BA_QwJMR.mjs";
1
+ import { A as o } from "../../chunks/AssetLoader-DO7xlbC3.mjs";
2
+ import { D as s, a as t } from "../../chunks/AssetLoader-DO7xlbC3.mjs";
3
3
  export {
4
4
  o as AssetLoader,
5
5
  s as DRACOWorker,
@@ -1,8 +1,8 @@
1
- import { Object3D } from 'three';
1
+ import { Object3D } from 'three/webgpu';
2
2
  import { FileType } from '../../../../index.ts';
3
3
  export declare class AssetLoader {
4
4
  private _gltfLoader;
5
- private _usdzLoader;
5
+ private _usdLoader;
6
6
  private _stepLoader;
7
7
  constructor();
8
8
  load(uri: string, fileType?: FileType): Promise<Object3D>;
@@ -1,4 +1,4 @@
1
- import { Object3D } from 'three';
1
+ import { Object3D } from 'three/webgpu';
2
2
  /**
3
3
  * Loader for STEP, STP, IGES, and IGS CAD files using occt-import-js.
4
4
  * Parsing runs in a blob-URL Web Worker (same pattern as DracoLoader).
@@ -1 +1 @@
1
- "use strict";var h=Object.defineProperty;var b=(t,e,r)=>e in t?h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var n=(t,e,r)=>b(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../chunks/PerspectiveCamera-iAsZqrnY.cjs");class p{constructor(e,r,o){n(this,"_renderer");n(this,"_scene");n(this,"_controller");this._renderer=e,this._scene=r,this._controller=o}generateMedia(e){const{position:r,target:o,resolution:l}=e,{width:s,height:i}=l,a=this._controller.object.position.clone(),_=this._controller.object.quaternion.clone();this._renderer.onResize(s,i),"onResize"in this._controller.object&&this._controller.object.onResize(s,i),this._controller.object.position.copy(r),this._controller.target.copy(o),this._controller.update();const d=this.drawCanvas().toDataURL();return this._controller.object.position.copy(a),this._controller.object.quaternion.copy(_),d}drawCanvas(e){const r=this._renderer.webglrenderer.domElement;e&&(this._renderer.webglrenderer.domElement=e),this._controller.object.layers.mask=c.DIVEPerspectiveCamera.LIVE_VIEW_LAYER_MASK,this._renderer.webglrenderer.render(this._scene,this._controller.object),this._controller.object.layers.mask=c.DIVEPerspectiveCamera.EDITOR_VIEW_LAYER_MASK;const o=this._renderer.webglrenderer.domElement;return e&&(this._renderer.webglrenderer.domElement=r),o}}exports.MediaCreator=p;
1
+ "use strict";var p=Object.defineProperty;var y=(c,t,e)=>t in c?p(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var a=(c,t,e)=>y(c,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("three/webgpu"),w=require("../../chunks/PerspectiveCamera-DwQUmkDv.cjs");class b{constructor(t,e,r){a(this,"_renderer");a(this,"_scene");a(this,"_controller");this._renderer=t,this._scene=e,this._controller=r}async generateMedia(t){const{position:e,target:r,resolution:i}=t,{width:o,height:s}=i,h=this._controller.object.position.clone(),d=this._controller.object.quaternion.clone(),l=this._controller.target.clone(),n=this._renderer.canvas.clientWidth||o,g=this._renderer.canvas.clientHeight||s;try{return"onResize"in this._controller.object&&this._controller.object.onResize(o,s),this._controller.object.position.copy(e),this._controller.target.copy(r),this._controller.update(),(await this.drawCanvas(void 0,i)).toDataURL()}finally{this._controller.object.position.copy(h),this._controller.object.quaternion.copy(d),this._controller.target.copy(l),this._controller.update(),"onResize"in this._controller.object&&this._controller.object.onResize(n,g)}}async drawCanvas(t,e){await this._renderer.init();const r=this._renderer.webgpurenderer,i=Math.max(1,(e==null?void 0:e.width)??(t==null?void 0:t.width)??(t==null?void 0:t.clientWidth)??this._renderer.canvas.clientWidth),o=Math.max(1,(e==null?void 0:e.height)??(t==null?void 0:t.height)??(t==null?void 0:t.clientHeight)??this._renderer.canvas.clientHeight),s=new _.RenderTarget(i,o,{colorSpace:_.SRGBColorSpace}),h=r.getRenderTarget(),d=this._controller.object.layers.mask;try{r.setRenderTarget(s),this._controller.object.layers.mask=w.DIVEPerspectiveCamera.LIVE_VIEW_LAYER_MASK,r.render(this._scene,this._controller.object);const l=await r.readRenderTargetPixelsAsync(s,0,0,i,o),n=t??document.createElement("canvas");return n.width=i,n.height=o,this._writePixelsToCanvas(n,l,i,o),n}finally{this._controller.object.layers.mask=d,r.setRenderTarget(h),s.dispose()}}_writePixelsToCanvas(t,e,r,i){const o=t.getContext("2d");if(!o)throw new Error("MediaCreator.drawCanvas: 2D canvas context is not available.");const s=o.createImageData(r,i);s.data.set(new Uint8ClampedArray(Array.from(e))),o.putImageData(s,0,0)}}exports.MediaCreator=b;
@@ -1,30 +1,58 @@
1
- var d = Object.defineProperty;
2
- var b = (t, e, r) => e in t ? d(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var n = (t, e, r) => b(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { D as c } from "../../chunks/PerspectiveCamera-BFzE2TQU.mjs";
5
- class j {
6
- constructor(e, r, o) {
7
- n(this, "_renderer");
8
- n(this, "_scene");
9
- n(this, "_controller");
10
- this._renderer = e, this._scene = r, this._controller = o;
1
+ var g = Object.defineProperty;
2
+ var p = (c, t, e) => t in c ? g(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
3
+ var a = (c, t, e) => p(c, typeof t != "symbol" ? t + "" : t, e);
4
+ import { RenderTarget as w, SRGBColorSpace as y } from "three/webgpu";
5
+ import { D as b } from "../../chunks/PerspectiveCamera-B5TvUzTa.mjs";
6
+ class T {
7
+ constructor(t, e, r) {
8
+ a(this, "_renderer");
9
+ a(this, "_scene");
10
+ a(this, "_controller");
11
+ this._renderer = t, this._scene = e, this._controller = r;
11
12
  }
12
- generateMedia(e) {
13
- const { position: r, target: o, resolution: l } = e, { width: s, height: i } = l, _ = this._controller.object.position.clone(), a = this._controller.object.quaternion.clone();
14
- this._renderer.onResize(s, i), "onResize" in this._controller.object && this._controller.object.onResize(s, i), this._controller.object.position.copy(r), this._controller.target.copy(o), this._controller.update();
15
- const h = this.drawCanvas().toDataURL();
16
- return this._controller.object.position.copy(_), this._controller.object.quaternion.copy(a), h;
13
+ async generateMedia(t) {
14
+ const { position: e, target: r, resolution: i } = t, { width: o, height: s } = i, h = this._controller.object.position.clone(), d = this._controller.object.quaternion.clone(), l = this._controller.target.clone(), n = this._renderer.canvas.clientWidth || o, _ = this._renderer.canvas.clientHeight || s;
15
+ try {
16
+ return "onResize" in this._controller.object && this._controller.object.onResize(o, s), this._controller.object.position.copy(e), this._controller.target.copy(r), this._controller.update(), (await this.drawCanvas(void 0, i)).toDataURL();
17
+ } finally {
18
+ this._controller.object.position.copy(h), this._controller.object.quaternion.copy(d), this._controller.target.copy(l), this._controller.update(), "onResize" in this._controller.object && this._controller.object.onResize(n, _);
19
+ }
17
20
  }
18
- drawCanvas(e) {
19
- const r = this._renderer.webglrenderer.domElement;
20
- e && (this._renderer.webglrenderer.domElement = e), this._controller.object.layers.mask = c.LIVE_VIEW_LAYER_MASK, this._renderer.webglrenderer.render(
21
- this._scene,
22
- this._controller.object
23
- ), this._controller.object.layers.mask = c.EDITOR_VIEW_LAYER_MASK;
24
- const o = this._renderer.webglrenderer.domElement;
25
- return e && (this._renderer.webglrenderer.domElement = r), o;
21
+ async drawCanvas(t, e) {
22
+ await this._renderer.init();
23
+ const r = this._renderer.webgpurenderer, i = Math.max(
24
+ 1,
25
+ (e == null ? void 0 : e.width) ?? (t == null ? void 0 : t.width) ?? (t == null ? void 0 : t.clientWidth) ?? this._renderer.canvas.clientWidth
26
+ ), o = Math.max(
27
+ 1,
28
+ (e == null ? void 0 : e.height) ?? (t == null ? void 0 : t.height) ?? (t == null ? void 0 : t.clientHeight) ?? this._renderer.canvas.clientHeight
29
+ ), s = new w(i, o, {
30
+ colorSpace: y
31
+ }), h = r.getRenderTarget(), d = this._controller.object.layers.mask;
32
+ try {
33
+ r.setRenderTarget(s), this._controller.object.layers.mask = b.LIVE_VIEW_LAYER_MASK, r.render(this._scene, this._controller.object);
34
+ const l = await r.readRenderTargetPixelsAsync(
35
+ s,
36
+ 0,
37
+ 0,
38
+ i,
39
+ o
40
+ ), n = t ?? document.createElement("canvas");
41
+ return n.width = i, n.height = o, this._writePixelsToCanvas(n, l, i, o), n;
42
+ } finally {
43
+ this._controller.object.layers.mask = d, r.setRenderTarget(h), s.dispose();
44
+ }
45
+ }
46
+ _writePixelsToCanvas(t, e, r, i) {
47
+ const o = t.getContext("2d");
48
+ if (!o)
49
+ throw new Error(
50
+ "MediaCreator.drawCanvas: 2D canvas context is not available."
51
+ );
52
+ const s = o.createImageData(r, i);
53
+ s.data.set(new Uint8ClampedArray(Array.from(e))), o.putImageData(s, 0, 0);
26
54
  }
27
55
  }
28
56
  export {
29
- j as MediaCreator
57
+ T as MediaCreator
30
58
  };
@@ -1,7 +1,7 @@
1
1
  import { DIVEScene } from '../../../engine/scene/Scene.ts';
2
2
  import { DIVERenderer } from '../../../engine/renderer/Renderer.ts';
3
3
  import { OrbitController } from '../../orbitcontroller/index.ts';
4
- import { MediaGenerationByPosition } from '../types/index.ts';
4
+ import { MediaGenerationByPosition, MediaGenerationResolution } from '../types/index.ts';
5
5
  /**
6
6
  * @internal
7
7
  */
@@ -10,6 +10,7 @@ export declare class MediaCreator {
10
10
  private _scene;
11
11
  private _controller;
12
12
  constructor(renderer: DIVERenderer, scene: DIVEScene, controller: OrbitController);
13
- generateMedia(options: MediaGenerationByPosition): string;
14
- drawCanvas(canvasElement?: HTMLCanvasElement): HTMLCanvasElement;
13
+ generateMedia(options: MediaGenerationByPosition): Promise<string>;
14
+ drawCanvas(canvasElement?: HTMLCanvasElement, resolution?: MediaGenerationResolution): Promise<HTMLCanvasElement>;
15
+ private _writePixelsToCanvas;
15
16
  }
@@ -1,4 +1,4 @@
1
- import { Vector3Like } from 'three';
1
+ import { Vector3Like } from 'three/webgpu';
2
2
  import { MediaGenerationResolution } from './MediaGenerationResolution.ts';
3
3
  export type MediaGenerationByPosition = {
4
4
  resolution: MediaGenerationResolution;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../chunks/FileTypes-BSJhZREN.cjs");exports.OrbitController=t.OrbitController;exports.OrbitControllerDefaultSettings=t.OrbitControllerDefaultSettings;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../chunks/FileTypes-Bvt5QTJC.cjs");exports.OrbitController=t.OrbitController;exports.OrbitControllerDefaultSettings=t.OrbitControllerDefaultSettings;
@@ -1,4 +1,4 @@
1
- import { O as o, a as e } from "../../chunks/FileTypes-CUf24rq6.mjs";
1
+ import { O as o, a as e } from "../../chunks/FileTypes-BB4_1gBJ.mjs";
2
2
  export {
3
3
  o as OrbitController,
4
4
  e as OrbitControllerDefaultSettings
@@ -1,4 +1,4 @@
1
- import { EventDispatcher, MOUSE, Object3D, OrthographicCamera, TOUCH, Vector3, Vector3Like } from 'three';
1
+ import { EventDispatcher, MOUSE, Object3D, OrthographicCamera, TOUCH, Vector3, Vector3Like } from 'three/webgpu';
2
2
  import { DIVEPerspectiveCamera, DIVETicker, BoundingBox } from '../../../index.ts';
3
3
  import { OrbitControllerState } from '../types/index.ts';
4
4
  export type OrbitControllerSettings = {
@@ -1,4 +1,4 @@
1
- import { Vector3Like, QuaternionLike } from 'three';
1
+ import { Vector3Like, QuaternionLike } from 'three/webgpu';
2
2
  export type OrbitControllerState = {
3
3
  target: Vector3Like;
4
4
  azimuthalAngle: number;