@shopware-ag/dive 3.1.0 → 4.0.1

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 (196) hide show
  1. package/README.md +31 -5
  2. package/build/chunks/{AssetCache-xpY_N7Yp.cjs → AssetCache-CUVFS7wk.cjs} +1 -1
  3. package/build/chunks/{AssetCache-C3YXhbaX.mjs → AssetCache-DnAAa719.mjs} +1 -1
  4. package/build/chunks/AssetExporter-CD2iuQce.mjs +108 -0
  5. package/build/chunks/AssetExporter-CoL-QXkB.cjs +1 -0
  6. package/build/chunks/{AssetLoader-MfH5d_Rr.mjs → AssetLoader-Bkp3fWZz.mjs} +9 -9
  7. package/build/chunks/{AssetLoader-CRxLq0AL.cjs → AssetLoader-DnVvCd41.cjs} +2 -2
  8. package/build/chunks/FileTypes-B-MjfMGd.cjs +29 -0
  9. package/build/chunks/FileTypes-D3Dxr2dj.mjs +2294 -0
  10. package/build/chunks/ModelComponent-Cmu0EX0r.cjs +1 -0
  11. package/build/chunks/ModelComponent-WA0kLOEY.mjs +87 -0
  12. package/build/chunks/OrbitController-CAJIiZeE.cjs +1 -0
  13. package/build/chunks/OrbitController-DxCbrQVB.mjs +612 -0
  14. package/build/chunks/SpriteTextComponent-BpoKLOjA.cjs +1 -0
  15. package/build/chunks/SpriteTextComponent-DIZFqao0.mjs +83 -0
  16. package/build/chunks/collectAnimations-BgYCN1le.mjs +35 -0
  17. package/build/chunks/collectAnimations-C3HfZHte.cjs +1 -0
  18. package/build/chunks/contributesToBounds-C1mva__U.cjs +1 -0
  19. package/build/chunks/contributesToBounds-DYmHYES4.mjs +14 -0
  20. package/build/chunks/detachTransformControls-B4iRF1bw.mjs +209 -0
  21. package/build/chunks/detachTransformControls-CZ2cd5hx.cjs +1 -0
  22. package/build/chunks/{isFileTypeSupported-BBU39V4u.cjs → isFileExtensionSupported-B1q2eWs7.cjs} +1 -1
  23. package/build/chunks/{isFileTypeSupported-9h8lrIuG.mjs → isFileExtensionSupported-BqOqU3-h.mjs} +1 -1
  24. package/build/chunks/isVisibleInHierarchy-D9JcLqR5.cjs +1 -0
  25. package/build/chunks/isVisibleInHierarchy-KzVGvDEw.mjs +21 -0
  26. package/build/components/boundingbox/BoundingBoxComponent.d.ts +100 -0
  27. package/build/components/boundingbox/index.d.ts +1 -0
  28. package/build/components/camera/CameraComponent.d.ts +75 -0
  29. package/build/components/camera/index.d.ts +2 -0
  30. package/build/components/camera/perspective/PerspectiveCameraComponent.d.ts +39 -0
  31. package/build/components/grid/GridComponent.d.ts +50 -0
  32. package/build/components/index.d.ts +6 -10
  33. package/build/components/light/LightComponent.d.ts +65 -0
  34. package/build/components/light/ambient/AmbientLightComponent.d.ts +10 -0
  35. package/build/components/light/directional/DirectionalLightComponent.d.ts +23 -0
  36. package/build/components/light/hemi/HemisphereLightComponent.d.ts +21 -0
  37. package/build/components/light/index.d.ts +5 -3
  38. package/build/components/light/point/PointLightComponent.d.ts +26 -0
  39. package/build/components/line/MultiLineComponent.d.ts +133 -0
  40. package/build/components/line/index.d.ts +1 -0
  41. package/build/components/mesh/MeshComponent.d.ts +74 -0
  42. package/build/components/mesh/floor/FloorComponent.d.ts +36 -0
  43. package/build/components/mesh/index.d.ts +4 -0
  44. package/build/components/mesh/model/ModelComponent.d.ts +67 -0
  45. package/build/components/mesh/primitive/PrimitiveComponent.d.ts +43 -0
  46. package/build/components/spritetext/SpriteTextComponent.d.ts +58 -0
  47. package/build/constants/VisibilityLayerMask.d.ts +23 -0
  48. package/build/dive.cjs +1 -1
  49. package/build/dive.mjs +252 -773
  50. package/build/engine/Dive.d.ts +11 -13
  51. package/build/engine/boundingbox/BoundingBox.d.ts +76 -0
  52. package/build/engine/component/Component.d.ts +236 -0
  53. package/build/engine/environment/Environment.d.ts +0 -18
  54. package/build/engine/index.d.ts +4 -1
  55. package/build/engine/node/Node.d.ts +189 -0
  56. package/build/engine/promise/abortable/AbortablePromise.d.ts +8 -0
  57. package/build/engine/renderer/Renderer.d.ts +43 -7
  58. package/build/engine/scene/Scene.d.ts +88 -4
  59. package/build/engine/scene/root/Root.d.ts +29 -0
  60. package/build/engine/scene/xrroot/XRRoot.d.ts +1 -1
  61. package/build/engine/view/View.d.ts +15 -4
  62. package/build/helpers/collectAnimations/collectAnimations.d.ts +23 -0
  63. package/build/helpers/computeProductBounds/computeProductBounds.d.ts +18 -0
  64. package/build/helpers/contributesToBounds/contributesToBounds.d.ts +17 -0
  65. package/build/helpers/detachTransformControls/detachTransformControls.d.ts +15 -0
  66. package/build/helpers/disposeComponents/disposeComponents.d.ts +20 -0
  67. package/build/helpers/findSceneRecursive/findSceneRecursive.d.ts +7 -3
  68. package/build/helpers/implementsInterface/implementsInterface.d.ts +11 -0
  69. package/build/helpers/index.d.ts +6 -1
  70. package/build/helpers/isVisibleInHierarchy/isVisibleInHierarchy.d.ts +12 -0
  71. package/build/index.d.ts +0 -1
  72. package/build/plugins/animation/index.mjs +3 -2
  73. package/build/plugins/animation/src/system/AnimationSystem.d.ts +3 -2
  74. package/build/plugins/ar/index.cjs +1 -1
  75. package/build/plugins/ar/index.mjs +2 -2
  76. package/build/plugins/ar/src/webxr/WebXR.d.ts +7 -0
  77. package/build/plugins/assetcache/index.cjs +1 -1
  78. package/build/plugins/assetcache/index.mjs +1 -1
  79. package/build/plugins/assetexporter/index.cjs +1 -1
  80. package/build/plugins/assetexporter/index.mjs +1 -1
  81. package/build/plugins/assetexporter/src/AssetExporter.d.ts +12 -0
  82. package/build/plugins/assetloader/index.cjs +1 -1
  83. package/build/plugins/assetloader/index.mjs +2 -2
  84. package/build/plugins/mediacreator/index.cjs +1 -1
  85. package/build/plugins/mediacreator/index.mjs +32 -30
  86. package/build/plugins/mediacreator/src/MediaCreator.d.ts +1 -2
  87. package/build/plugins/orbitcontroller/index.cjs +1 -1
  88. package/build/plugins/orbitcontroller/index.d.ts +1 -0
  89. package/build/plugins/orbitcontroller/index.mjs +1 -1
  90. package/build/plugins/orbitcontroller/src/OrbitController.d.ts +39 -6
  91. package/build/plugins/orientationdisplay/index.cjs +1 -1
  92. package/build/plugins/orientationdisplay/index.mjs +39 -31
  93. package/build/plugins/orientationdisplay/src/OrientationDisplay.d.ts +3 -3
  94. package/build/plugins/quickview/index.cjs +1 -1
  95. package/build/plugins/quickview/index.mjs +68 -45
  96. package/build/plugins/quickview/src/QuickView.d.ts +40 -13
  97. package/build/plugins/quickview/types/index.d.ts +0 -18
  98. package/build/plugins/state/index.cjs +1 -27
  99. package/build/plugins/state/index.mjs +1983 -4262
  100. package/build/plugins/state/src/EngineGateway.d.ts +98 -0
  101. package/build/plugins/state/src/EntityRegistry.d.ts +51 -0
  102. package/build/plugins/state/src/State.d.ts +20 -9
  103. package/build/plugins/state/src/actions/camera/computeencompassingview.d.ts +1 -1
  104. package/build/plugins/state/src/actions/camera/movecamera.d.ts +2 -2
  105. package/build/plugins/state/src/actions/media/generatemedia.d.ts +1 -1
  106. package/build/plugins/state/src/actions/object/addobject.d.ts +2 -3
  107. package/build/plugins/state/src/actions/object/deleteobject.d.ts +3 -4
  108. package/build/plugins/state/src/actions/object/deselectobject.d.ts +3 -4
  109. package/build/plugins/state/src/actions/object/dropit.d.ts +2 -2
  110. package/build/plugins/state/src/actions/object/getallobjects.d.ts +2 -3
  111. package/build/plugins/state/src/actions/object/getobjects.d.ts +3 -4
  112. package/build/plugins/state/src/actions/object/index.d.ts +0 -1
  113. package/build/plugins/state/src/actions/object/modelloaded.d.ts +2 -2
  114. package/build/plugins/state/src/actions/object/selectobject.d.ts +3 -4
  115. package/build/plugins/state/src/actions/object/setparent.d.ts +3 -4
  116. package/build/plugins/state/src/actions/object/updateobject.d.ts +3 -4
  117. package/build/plugins/state/src/actions/renderer/startrender.d.ts +1 -1
  118. package/build/plugins/state/src/actions/scene/exportscene.d.ts +2 -2
  119. package/build/plugins/state/src/actions/scene/index.d.ts +0 -1
  120. package/build/plugins/state/src/actions/scene/setbackground.d.ts +2 -2
  121. package/build/plugins/state/src/actions/scene/updatescene.d.ts +2 -2
  122. package/build/plugins/state/src/actions/state/getstate.d.ts +1 -1
  123. package/build/plugins/state/src/actions/state/setstate.d.ts +1 -1
  124. package/build/plugins/state/src/helpers/copyVectors/copyVectors.d.ts +17 -0
  125. package/build/plugins/state/src/helpers/updateParentLink/updateParentLink.d.ts +29 -0
  126. package/build/plugins/state/src/helpers/watchEntity/watchEntity.d.ts +30 -0
  127. package/build/plugins/state/types/ActionTypes.d.ts +18 -3
  128. package/build/plugins/state/types/RegisteredEntity.d.ts +27 -0
  129. package/build/plugins/state/types/StateData.d.ts +1 -1
  130. package/build/plugins/state/types/index.d.ts +2 -1
  131. package/build/{types → plugins/state/types}/schema/GroupSchema.d.ts +1 -1
  132. package/build/{types → plugins/state/types}/schema/ModelSchema.d.ts +7 -4
  133. package/build/{types → plugins/state/types}/schema/PrimitiveSchema.d.ts +4 -5
  134. package/build/{types → plugins/state/types}/schema/index.d.ts +0 -3
  135. package/build/plugins/toolbox/index.cjs +1 -1
  136. package/build/plugins/toolbox/index.mjs +193 -140
  137. package/build/plugins/toolbox/src/PointerContext.d.ts +7 -0
  138. package/build/plugins/toolbox/src/SelectionState.d.ts +21 -0
  139. package/build/plugins/toolbox/src/Toolbox.d.ts +9 -2
  140. package/build/{components → plugins/toolbox/src}/gizmo/Gizmo.d.ts +16 -2
  141. package/build/{components → plugins/toolbox/src}/gizmo/handles/AxisHandle.d.ts +2 -3
  142. package/build/{components → plugins/toolbox/src}/gizmo/handles/RadialHandle.d.ts +2 -3
  143. package/build/{components → plugins/toolbox/src}/gizmo/handles/ScaleHandle.d.ts +2 -3
  144. package/build/{components → plugins/toolbox/src}/gizmo/rotate/RotateGizmo.d.ts +2 -2
  145. package/build/{components → plugins/toolbox/src}/gizmo/scale/ScaleGizmo.d.ts +3 -3
  146. package/build/{components → plugins/toolbox/src}/gizmo/translate/TranslateGizmo.d.ts +2 -2
  147. package/build/types/components/DIVESceneObject.d.ts +13 -6
  148. package/build/types/components/index.d.ts +0 -1
  149. package/build/types/events/DIVEComponentEventMap.d.ts +14 -0
  150. package/build/types/events/DIVEEntityEventMap.d.ts +47 -0
  151. package/build/types/events/index.d.ts +2 -0
  152. package/build/types/{schema/GeometrySchema.d.ts → geometry/DIVEGeometry.d.ts} +4 -4
  153. package/build/types/{schema/GeometryTypeSchema.d.ts → geometry/DIVEGeometryType.d.ts} +1 -1
  154. package/build/types/geometry/index.d.ts +2 -0
  155. package/build/types/index.d.ts +3 -1
  156. package/build/types/{schema/MaterialSchema.d.ts → material/DIVEMaterial.d.ts} +1 -1
  157. package/build/types/material/index.d.ts +1 -0
  158. package/package.json +6 -5
  159. package/build/chunks/AssetExporter-C5MScs9S.mjs +0 -70
  160. package/build/chunks/AssetExporter-Cdxb04b3.cjs +0 -1
  161. package/build/chunks/CameraSchema-cgY5WBGW.mjs +0 -10
  162. package/build/chunks/CameraSchema-twxH-72N.cjs +0 -1
  163. package/build/chunks/FileTypes-Cgyf8ocm.cjs +0 -29
  164. package/build/chunks/FileTypes-DiYB3WBp.mjs +0 -2166
  165. package/build/chunks/PerspectiveCamera-B5TvUzTa.mjs +0 -39
  166. package/build/chunks/PerspectiveCamera-DwQUmkDv.cjs +0 -1
  167. package/build/chunks/SpriteText-2lCRglsw.cjs +0 -1
  168. package/build/chunks/SpriteText-C_CQPvUn.mjs +0 -50
  169. package/build/chunks/findInterface-C6mrvf_t.cjs +0 -1
  170. package/build/chunks/findInterface-DbJ5qzbc.mjs +0 -11
  171. package/build/components/boundingbox/BoundingBox.d.ts +0 -140
  172. package/build/components/floor/Floor.d.ts +0 -14
  173. package/build/components/grid/Grid.d.ts +0 -23
  174. package/build/components/group/Group.d.ts +0 -28
  175. package/build/components/light/AmbientLight.d.ts +0 -19
  176. package/build/components/light/PointLight.d.ts +0 -29
  177. package/build/components/light/SceneLight.d.ts +0 -20
  178. package/build/components/model/Model.d.ts +0 -26
  179. package/build/components/node/Node.d.ts +0 -24
  180. package/build/components/primitive/Primitive.d.ts +0 -27
  181. package/build/components/root/Root.d.ts +0 -34
  182. package/build/components/spritetext/SpriteText.d.ts +0 -27
  183. package/build/engine/camera/PerspectiveCamera.d.ts +0 -24
  184. package/build/helpers/isFileTypeSupported/isFileTypeSupported.d.ts +0 -9
  185. package/build/plugins/quickview/src/state/QuickViewState.d.ts +0 -4
  186. package/build/plugins/quickview/src/uri/QuickViewUri.d.ts +0 -3
  187. package/build/plugins/state/src/actions/object/placeonfloor.d.ts +0 -12
  188. package/build/plugins/state/src/actions/scene/getallscenedata.d.ts +0 -12
  189. package/build/plugins/state/types/StateSceneData.d.ts +0 -5
  190. package/build/types/components/DIVELight.d.ts +0 -4
  191. /package/build/{types → plugins/state/types}/schema/BaseEntitySchema.d.ts +0 -0
  192. /package/build/{types → plugins/state/types}/schema/CameraSchema.d.ts +0 -0
  193. /package/build/{types → plugins/state/types}/schema/EntitySchema.d.ts +0 -0
  194. /package/build/{types → plugins/state/types}/schema/EntityTypeSchema.d.ts +0 -0
  195. /package/build/{types → plugins/state/types}/schema/LightSchema.d.ts +0 -0
  196. /package/build/{components → plugins/toolbox/src}/gizmo/plane/GizmoPlane.d.ts +0 -0
@@ -0,0 +1,35 @@
1
+ import { PropertyBinding as s } from "three/webgpu";
2
+ const a = (r) => "isDIVENode" in r, u = (r, i) => {
3
+ for (const t of r) {
4
+ const n = s.findNode(
5
+ t,
6
+ i
7
+ );
8
+ if (n) return n;
9
+ }
10
+ return null;
11
+ }, f = (r, i) => {
12
+ const t = r.clone();
13
+ return t.tracks.forEach((n) => {
14
+ const { nodeName: o } = s.parseTrackName(n.name);
15
+ if (!o) return;
16
+ const e = u(i, o);
17
+ e && (n.name = e.uuid + n.name.slice(o.length));
18
+ }), t;
19
+ };
20
+ function m(r) {
21
+ const i = [], t = (n, o) => {
22
+ var e;
23
+ (e = n.animations) == null || e.forEach(
24
+ (c) => i.push(f(c, o))
25
+ );
26
+ };
27
+ return r.traverse((n) => {
28
+ t(n, [n]), a(n) && n.components.forEach(
29
+ (o) => t(o, o.contributions)
30
+ );
31
+ }), i;
32
+ }
33
+ export {
34
+ m as c
35
+ };
@@ -0,0 +1 @@
1
+ "use strict";const s=require("three/webgpu"),u=t=>"isDIVENode"in t,a=(t,i)=>{for(const r of t){const n=s.PropertyBinding.findNode(r,i);if(n)return n}return null},f=(t,i)=>{const r=t.clone();return r.tracks.forEach(n=>{const{nodeName:o}=s.PropertyBinding.parseTrackName(n.name);if(!o)return;const e=a(i,o);e&&(n.name=e.uuid+n.name.slice(o.length))}),r};function d(t){const i=[],r=(n,o)=>{var e;(e=n.animations)==null||e.forEach(c=>i.push(f(c,o)))};return t.traverse(n=>{r(n,[n]),u(n)&&n.components.forEach(o=>r(o,o.contributions))}),i}exports.collectAnimations=d;
@@ -0,0 +1 @@
1
+ "use strict";function _(A){return(A.layers.mask&16)!==0}exports.COORDINATE_LAYER_MASK=2;exports.DEFAULT_LAYER_MASK=1;exports.FLOOR_LAYER_MASK=32;exports.HELPER_LAYER_MASK=8;exports.PRODUCT_LAYER_MASK=16;exports.PROXY_LAYER_MASK=64;exports.UI_LAYER_MASK=4;exports.contributesToBounds=_;
@@ -0,0 +1,14 @@
1
+ const A = 1, _ = 2, R = 4, n = 8, o = 16, t = 32, E = 64;
2
+ function a(s) {
3
+ return (s.layers.mask & 16) !== 0;
4
+ }
5
+ export {
6
+ _ as C,
7
+ A as D,
8
+ t as F,
9
+ n as H,
10
+ o as P,
11
+ R as U,
12
+ E as a,
13
+ a as c
14
+ };
@@ -0,0 +1,209 @@
1
+ var p = Object.defineProperty;
2
+ var w = (n, s, e) => s in n ? p(n, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[s] = e;
3
+ var r = (n, s, e) => w(n, typeof s != "symbol" ? s + "" : s, e);
4
+ import { AmbientLight as C, PointLight as f, MeshBasicMaterial as G, FrontSide as S, Mesh as m, SphereGeometry as u, MeshStandardMaterial as y, BufferGeometry as h, CylinderGeometry as M, BufferAttribute as c, BoxGeometry as l, ConeGeometry as A } from "three/webgpu";
5
+ import { f as _, M as P, g } from "./FileTypes-D3Dxr2dj.mjs";
6
+ import { a as E, P as L } from "./contributesToBounds-DYmHYES4.mjs";
7
+ class H extends _ {
8
+ constructor() {
9
+ super(new C(16777215, 1));
10
+ r(this, "isAmbientLightComponent", !0);
11
+ this.name = "AmbientLightComponent";
12
+ }
13
+ }
14
+ const b = 0.1, o = 0.8, d = 512;
15
+ class D extends _ {
16
+ constructor() {
17
+ super(new f(16777215, 1));
18
+ r(this, "isPointLightComponent", !0);
19
+ r(this, "_handle");
20
+ r(this, "_handleMaterial");
21
+ this.name = "PointLightComponent";
22
+ const e = this._light;
23
+ e.castShadow = !0, e.shadow.mapSize.width = d, e.shadow.mapSize.height = d, this._handleMaterial = new G({
24
+ color: this._light.color,
25
+ transparent: !0,
26
+ opacity: o,
27
+ side: S
28
+ }), this._handle = new m(
29
+ new u(b, 32, 32),
30
+ this._handleMaterial
31
+ ), this._handle.layers.mask = E, this.contribute(this._handle);
32
+ }
33
+ /**
34
+ * The editor handle standing in for this light.
35
+ */
36
+ get handle() {
37
+ return this._handle;
38
+ }
39
+ setColor(e) {
40
+ super.setColor(e), this._handleMaterial.color = e;
41
+ }
42
+ setIntensity(e) {
43
+ super.setIntensity(e), this._handleMaterial.opacity = Math.min(
44
+ e * o,
45
+ o
46
+ );
47
+ }
48
+ dispose() {
49
+ super.dispose(), this._handle.geometry.dispose(), this._handleMaterial.dispose();
50
+ }
51
+ }
52
+ const x = 64, B = 32;
53
+ class N extends P {
54
+ constructor() {
55
+ super();
56
+ r(this, "isPrimitiveComponent", !0);
57
+ /**
58
+ * The shape this component was last built from.
59
+ *
60
+ * Kept because the built `BufferGeometry` cannot be handed to a clone -- both
61
+ * would dispose it -- while the descriptor rebuilds it for free.
62
+ */
63
+ r(this, "_geometry", null);
64
+ this.name = "PrimitiveComponent", this._material = new y(), this._mesh = new m(new h(), this._material), this._mesh.name = "PrimitiveMesh", this._mesh.layers.mask = L, this._mesh.castShadow = !0, this._mesh.receiveShadow = !0, this.contribute(this._mesh);
65
+ }
66
+ /** The shape this component was last built from, if any. */
67
+ get geometry() {
68
+ return this._geometry;
69
+ }
70
+ /**
71
+ * Rebuilds the geometry from a descriptor.
72
+ *
73
+ * @param geometry - The shape to build.
74
+ */
75
+ setGeometry(e) {
76
+ const t = this._assembleGeometry(e);
77
+ t && (this._geometry = e, t.computeVertexNormals(), t.computeBoundingBox(), t.computeBoundingSphere(), this._mesh.geometry.dispose(), this._mesh.geometry = t);
78
+ }
79
+ /**
80
+ * Rebuilds the source's shape, rather than sharing the geometry it built.
81
+ *
82
+ * @param source - The component to copy from.
83
+ */
84
+ copy(e) {
85
+ return super.copy(e), e.geometry && this.setGeometry(e.geometry), this;
86
+ }
87
+ _assembleGeometry(e) {
88
+ switch (this._material.flatShading = !1, e.name.toLowerCase()) {
89
+ case "cylinder":
90
+ return this._createCylinderGeometry(e);
91
+ case "sphere":
92
+ return this._createSphereGeometry(e);
93
+ case "pyramid":
94
+ return this._material.flatShading = !0, this._createPyramidGeometry(e);
95
+ case "cube":
96
+ case "box":
97
+ case "plane":
98
+ return this._createBoxGeometry(e);
99
+ case "cone":
100
+ return this._createConeGeometry(e);
101
+ case "wall":
102
+ return this._createWallGeometry(e);
103
+ default:
104
+ return console.warn(
105
+ "PrimitiveComponent.setGeometry: Invalid geometry type:",
106
+ e.name.toLowerCase()
107
+ ), null;
108
+ }
109
+ }
110
+ _createCylinderGeometry(e) {
111
+ const t = new M(
112
+ e.width / 2,
113
+ e.width / 2,
114
+ e.height,
115
+ 64
116
+ );
117
+ return t.translate(0, e.height / 2, 0), t;
118
+ }
119
+ _createSphereGeometry(e) {
120
+ return new u(
121
+ e.width / 2,
122
+ x,
123
+ B
124
+ );
125
+ }
126
+ _createPyramidGeometry(e) {
127
+ const t = new Float32Array([
128
+ -e.width / 2,
129
+ 0,
130
+ -e.depth / 2,
131
+ // 0
132
+ e.width / 2,
133
+ 0,
134
+ -e.depth / 2,
135
+ // 1
136
+ e.width / 2,
137
+ 0,
138
+ e.depth / 2,
139
+ // 2
140
+ -e.width / 2,
141
+ 0,
142
+ e.depth / 2,
143
+ // 3
144
+ 0,
145
+ e.height,
146
+ 0
147
+ ]), i = new Uint16Array([
148
+ 0,
149
+ 1,
150
+ 2,
151
+ 0,
152
+ 2,
153
+ 3,
154
+ 0,
155
+ 4,
156
+ 1,
157
+ 1,
158
+ 4,
159
+ 2,
160
+ 2,
161
+ 4,
162
+ 3,
163
+ 3,
164
+ 4,
165
+ 0
166
+ ]), a = new h();
167
+ return a.setAttribute(
168
+ "position",
169
+ new c(t, 3)
170
+ ), a.setIndex(new c(i, 1)), a;
171
+ }
172
+ _createBoxGeometry(e) {
173
+ const t = new l(
174
+ e.width,
175
+ e.height,
176
+ e.depth
177
+ );
178
+ return t.translate(0, e.height / 2, 0), t;
179
+ }
180
+ _createConeGeometry(e) {
181
+ const t = new A(e.width / 2, e.height, 256);
182
+ return t.translate(0, e.height / 2, 0), t;
183
+ }
184
+ _createWallGeometry(e) {
185
+ const t = new l(
186
+ e.width,
187
+ e.height,
188
+ e.depth || 0.05,
189
+ 16
190
+ );
191
+ return t.translate(0, e.height / 2, 0), t;
192
+ }
193
+ }
194
+ const O = (n) => {
195
+ const s = g(n);
196
+ s && s.children.find((e) => {
197
+ const t = e;
198
+ if (t.isTransformControlsRoot && t.controls)
199
+ return t.controls.detach(), !0;
200
+ const i = e;
201
+ return i.isTransformControls && i.detach ? (i.detach(), !0) : !1;
202
+ });
203
+ };
204
+ export {
205
+ H as A,
206
+ D as P,
207
+ N as a,
208
+ O as d
209
+ };
@@ -0,0 +1 @@
1
+ "use strict";var d=Object.defineProperty;var u=(i,r,e)=>r in i?d(i,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[r]=e;var s=(i,r,e)=>u(i,typeof r!="symbol"?r+"":r,e);const n=require("three/webgpu"),h=require("./FileTypes-B-MjfMGd.cjs"),m=require("./contributesToBounds-C1mva__U.cjs");class p extends h.DIVELightComponent{constructor(){super(new n.AmbientLight(16777215,1));s(this,"isAmbientLightComponent",!0);this.name="AmbientLightComponent"}}const _=.1,c=.8,l=512;class w extends h.DIVELightComponent{constructor(){super(new n.PointLight(16777215,1));s(this,"isPointLightComponent",!0);s(this,"_handle");s(this,"_handleMaterial");this.name="PointLightComponent";const e=this._light;e.castShadow=!0,e.shadow.mapSize.width=l,e.shadow.mapSize.height=l,this._handleMaterial=new n.MeshBasicMaterial({color:this._light.color,transparent:!0,opacity:c,side:n.FrontSide}),this._handle=new n.Mesh(new n.SphereGeometry(_,32,32),this._handleMaterial),this._handle.layers.mask=m.PROXY_LAYER_MASK,this.contribute(this._handle)}get handle(){return this._handle}setColor(e){super.setColor(e),this._handleMaterial.color=e}setIntensity(e){super.setIntensity(e),this._handleMaterial.opacity=Math.min(e*c,c)}dispose(){super.dispose(),this._handle.geometry.dispose(),this._handleMaterial.dispose()}}const C=64,G=32;class y extends h.MeshComponent{constructor(){super();s(this,"isPrimitiveComponent",!0);s(this,"_geometry",null);this.name="PrimitiveComponent",this._material=new n.MeshStandardMaterial,this._mesh=new n.Mesh(new n.BufferGeometry,this._material),this._mesh.name="PrimitiveMesh",this._mesh.layers.mask=m.PRODUCT_LAYER_MASK,this._mesh.castShadow=!0,this._mesh.receiveShadow=!0,this.contribute(this._mesh)}get geometry(){return this._geometry}setGeometry(e){const t=this._assembleGeometry(e);t&&(this._geometry=e,t.computeVertexNormals(),t.computeBoundingBox(),t.computeBoundingSphere(),this._mesh.geometry.dispose(),this._mesh.geometry=t)}copy(e){return super.copy(e),e.geometry&&this.setGeometry(e.geometry),this}_assembleGeometry(e){switch(this._material.flatShading=!1,e.name.toLowerCase()){case"cylinder":return this._createCylinderGeometry(e);case"sphere":return this._createSphereGeometry(e);case"pyramid":return this._material.flatShading=!0,this._createPyramidGeometry(e);case"cube":case"box":case"plane":return this._createBoxGeometry(e);case"cone":return this._createConeGeometry(e);case"wall":return this._createWallGeometry(e);default:return console.warn("PrimitiveComponent.setGeometry: Invalid geometry type:",e.name.toLowerCase()),null}}_createCylinderGeometry(e){const t=new n.CylinderGeometry(e.width/2,e.width/2,e.height,64);return t.translate(0,e.height/2,0),t}_createSphereGeometry(e){return new n.SphereGeometry(e.width/2,C,G)}_createPyramidGeometry(e){const t=new Float32Array([-e.width/2,0,-e.depth/2,e.width/2,0,-e.depth/2,e.width/2,0,e.depth/2,-e.width/2,0,e.depth/2,0,e.height,0]),o=new Uint16Array([0,1,2,0,2,3,0,4,1,1,4,2,2,4,3,3,4,0]),a=new n.BufferGeometry;return a.setAttribute("position",new n.BufferAttribute(t,3)),a.setIndex(new n.BufferAttribute(o,1)),a}_createBoxGeometry(e){const t=new n.BoxGeometry(e.width,e.height,e.depth);return t.translate(0,e.height/2,0),t}_createConeGeometry(e){const t=new n.ConeGeometry(e.width/2,e.height,256);return t.translate(0,e.height/2,0),t}_createWallGeometry(e){const t=new n.BoxGeometry(e.width,e.height,e.depth||.05,16);return t.translate(0,e.height/2,0),t}}const f=i=>{const r=h.findSceneRecursive(i);r&&r.children.find(e=>{const t=e;if(t.isTransformControlsRoot&&t.controls)return t.controls.detach(),!0;const o=e;return o.isTransformControls&&o.detach?(o.detach(),!0):!1})};exports.AmbientLightComponent=p;exports.PointLightComponent=w;exports.PrimitiveComponent=y;exports.detachTransformControls=f;
@@ -1 +1 @@
1
- "use strict";const n=require("./FileTypes-Cgyf8ocm.cjs");function o(e){var t;const i=(e.split("/").pop()||"").split(/[?#]/)[0];return!i.includes(".")||i.endsWith(".")?"":((t=i.split(".").pop())==null?void 0:t.toLowerCase())||""}function r(e){return e.toLowerCase()in n.FILE_TYPES}exports.getFileTypeFromUri=o;exports.isFileTypeSupported=r;
1
+ "use strict";const n=require("./FileTypes-B-MjfMGd.cjs");function o(e){var t;const i=(e.split("/").pop()||"").split(/[?#]/)[0];return!i.includes(".")||i.endsWith(".")?"":((t=i.split(".").pop())==null?void 0:t.toLowerCase())||""}function s(e){return e.toLowerCase()in n.FILE_TYPES}exports.getFileTypeFromUri=o;exports.isFileExtensionSupported=s;
@@ -1,4 +1,4 @@
1
- import { F as n } from "./FileTypes-DiYB3WBp.mjs";
1
+ import { F as n } from "./FileTypes-D3Dxr2dj.mjs";
2
2
  function r(e) {
3
3
  var i;
4
4
  const t = (e.split("/").pop() || "").split(/[?#]/)[0];
@@ -0,0 +1 @@
1
+ "use strict";function n(e,r){return e?e[r]===!0:!1}function i(e,r){if(e)return n(e,r)?e:i(e.parent,r)}function t(e){if(!e)return!1;let r=e;for(;r;){if(!r.visible)return!1;r=r.parent}return!0}exports.findInterface=i;exports.implementsInterface=n;exports.isVisibleInHierarchy=t;
@@ -0,0 +1,21 @@
1
+ function n(r, e) {
2
+ return r ? r[e] === !0 : !1;
3
+ }
4
+ function i(r, e) {
5
+ if (r)
6
+ return n(r, e) ? r : i(r.parent, e);
7
+ }
8
+ function f(r) {
9
+ if (!r) return !1;
10
+ let e = r;
11
+ for (; e; ) {
12
+ if (!e.visible) return !1;
13
+ e = e.parent;
14
+ }
15
+ return !0;
16
+ }
17
+ export {
18
+ f as a,
19
+ i as f,
20
+ n as i
21
+ };
@@ -0,0 +1,100 @@
1
+ import { LineSegments, Mesh, Vector3, Box3, ColorRepresentation, Sphere } from 'three/webgpu';
2
+ import { BoundingBox } from '../../engine/boundingbox/BoundingBox.ts';
3
+ import { DIVEComponent } from '../../engine/component/Component.ts';
4
+ import { DIVENode } from '../../engine/node/Node.ts';
5
+ /**
6
+ * Keeps a {@link BoundingBox} around the node it is attached to, and can draw it.
7
+ *
8
+ * The measurement itself is `BoundingBox`, which knows nothing about nodes. What
9
+ * this adds is the node: it always encloses its owner, and it watches that owner
10
+ * so the numbers are never behind the scene.
11
+ *
12
+ * Watched, and therefore free:
13
+ *
14
+ * - a child node or a contributed object arriving or leaving (`childadded` /
15
+ * `childremoved`), which is how a finished asset load reaches this -- the
16
+ * loader contributes the file's roots to the node
17
+ * - a component arriving or leaving (`componentadded` / `componentremoved`)
18
+ * - the node moving, turning or scaling (`object-transform`), whatever moved it
19
+ *
20
+ * Not watched, because nothing announces it: geometry swapped in place on a mesh
21
+ * that is already there. Call {@link refresh} after that.
22
+ *
23
+ * An event only marks the box stale; the measurement happens when someone reads
24
+ * it. That matters because a glTF with fifty root nodes arrives as fifty
25
+ * `childadded` events, and re-measuring per event would traverse the subtree
26
+ * fifty times for one load.
27
+ *
28
+ * @module
29
+ */
30
+ export declare class BoundingBoxComponent extends DIVEComponent {
31
+ readonly isBoundingBoxComponent: true;
32
+ private _boundingBox;
33
+ private _oriented;
34
+ private _stale;
35
+ private _boxHelper;
36
+ private _sphereHelper;
37
+ private _invalidate;
38
+ constructor();
39
+ /** The measurement, current as of this read. */
40
+ get boundingBox(): BoundingBox;
41
+ /** The box itself, in the frame it was measured in. */
42
+ get box(): Box3;
43
+ /** Width, height and depth, in the frame the box was measured in. */
44
+ get size(): Vector3;
45
+ /** The centre of the box, in world space. */
46
+ get center(): Vector3;
47
+ /** The sphere around the box, in world space. */
48
+ get sphere(): Sphere;
49
+ /** The radius of that sphere. */
50
+ get radius(): number;
51
+ /** Whether the box is aligned to its owner rather than to the world axes. */
52
+ get oriented(): boolean;
53
+ /**
54
+ * The wireframe box, for anyone that wants to style or inspect it.
55
+ *
56
+ * Measures first, like every other read: a helper handed out unplaced would
57
+ * be a matrix from before whatever last changed the node.
58
+ */
59
+ get boxHelper(): LineSegments;
60
+ /** The wireframe sphere, placed the same way. */
61
+ get sphereHelper(): Mesh;
62
+ /**
63
+ * Chooses between a world-aligned and an owner-aligned box.
64
+ *
65
+ * @param oriented - Whether to align the box to the owner.
66
+ */
67
+ setOriented(oriented: boolean): this;
68
+ /**
69
+ * Marks the box stale, so the next read measures again.
70
+ *
71
+ * Only needed for changes nothing announces -- a geometry swapped in place on
72
+ * a mesh that is already in the node. Everything that goes through the node's
73
+ * own API arrives here as an event.
74
+ */
75
+ refresh(): this;
76
+ /**
77
+ * @param visible - Whether the box wireframe is drawn.
78
+ */
79
+ setBoxHelperVisible(visible: boolean): void;
80
+ /**
81
+ * @param visible - Whether the sphere wireframe is drawn.
82
+ */
83
+ setSphereHelperVisible(visible: boolean): void;
84
+ /**
85
+ * @param color - The helper colour.
86
+ */
87
+ setHelperColor(color: ColorRepresentation): void;
88
+ /** Keeps a drawn box glued to the node while anything moves it. */
89
+ tick(): void;
90
+ protected onAttach(owner: DIVENode): void;
91
+ protected onDetach(previousOwner: DIVENode): void;
92
+ /** Re-encloses the owner if anything has happened since the last read. */
93
+ private _measure;
94
+ /** Puts the helpers where the measurement says they belong. */
95
+ private _place;
96
+ /** Ticks only while there is something drawn to keep up to date. */
97
+ private _refreshTick;
98
+ copy(source: this): this;
99
+ dispose(): void;
100
+ }
@@ -0,0 +1 @@
1
+ export * from './BoundingBoxComponent.ts';
@@ -0,0 +1,75 @@
1
+ import { Camera, Vector3Like } from 'three/webgpu';
2
+ import { DIVEComponent } from '../../engine/component/Component.ts';
3
+ export declare abstract class DIVECameraComponent extends DIVEComponent {
4
+ readonly isDIVECameraComponent: true;
5
+ /**
6
+ * Everything a camera can show.
7
+ *
8
+ * Deliberately every layer, including `DEFAULT_LAYER_MASK` — three puts an
9
+ * object on layer 0 unless someone says otherwise, and the transform gizmo is
10
+ * one of them, so an editor that left it out would hide whatever never picked
11
+ * a layer.
12
+ *
13
+ * `COORDINATE_LAYER_MASK` is the one left out. The orientation display adds its
14
+ * axes to the same scene and draws them with its own camera in the corner;
15
+ * having that bit here would draw them a second time in the middle of the
16
+ * viewport.
17
+ */
18
+ static readonly EDITOR_VIEW_LAYER_MASK: number;
19
+ /**
20
+ * What an end user sees: the content and the ground it stands on.
21
+ *
22
+ * A short list on purpose, and one that has to be opted into. Everything that
23
+ * exists to help build a scene stays out — the gizmo, the helper lines, the
24
+ * proxies for entities without geometry — and so does `DEFAULT_LAYER_MASK`,
25
+ * because it is the catch-all: anything that never chose a layer is a thing
26
+ * nobody decided to show an end user.
27
+ */
28
+ static readonly LIVE_VIEW_LAYER_MASK: number;
29
+ /** Told whenever {@link setCameraLayer} changed what is visible. */
30
+ onSetCameraLayer: (mask: number) => void;
31
+ protected _camera: Camera;
32
+ /**
33
+ * @param camera - The three camera this component owns.
34
+ */
35
+ constructor(camera: Camera);
36
+ /** The three camera this component owns. */
37
+ get camera(): Camera;
38
+ /**
39
+ * Switches between what an editor shows and what an end user sees.
40
+ *
41
+ * @param layer - Which of the two.
42
+ */
43
+ setCameraLayer(layer: 'LIVE' | 'EDITOR'): void;
44
+ /**
45
+ * Turns the node this camera sits on to face a point.
46
+ *
47
+ * Not `owner.lookAt`: three's `Object3D.lookAt` swaps eye and target unless the
48
+ * object reports `isCamera`, so a plain node comes out oriented 180 degrees the
49
+ * other way -- its `+Z` at the target instead of its `-Z`. What follows is the
50
+ * camera branch, applied to the node.
51
+ *
52
+ * @param target - The point to face, in world space.
53
+ */
54
+ lookAt(target: Vector3Like): void;
55
+ /**
56
+ * Takes on what the source camera is allowed to see.
57
+ *
58
+ * The layer mask only; `onSetCameraLayer` is wiring a caller installed, not
59
+ * state, and a clone that inherited the callback would report to a listener
60
+ * that never asked for it.
61
+ *
62
+ * @param source - The component to copy from.
63
+ */
64
+ copy(source: this): this;
65
+ /**
66
+ * Fits the camera to a new viewport.
67
+ *
68
+ * Abstract because what a viewport means differs: a perspective camera changes
69
+ * its aspect, an orthographic one its extents.
70
+ *
71
+ * @param width - Viewport width in pixels.
72
+ * @param height - Viewport height in pixels.
73
+ */
74
+ abstract onResize(width: number, height: number): void;
75
+ }
@@ -0,0 +1,2 @@
1
+ export * from './CameraComponent.ts';
2
+ export * from './perspective/PerspectiveCameraComponent.ts';
@@ -0,0 +1,39 @@
1
+ import { PerspectiveCamera } from 'three/webgpu';
2
+ import { DIVECameraComponent } from '../CameraComponent.ts';
3
+ export type DIVEPerspectiveCameraSettings = {
4
+ /** Field of view in degrees */
5
+ fov: number;
6
+ /** Near clipping plane */
7
+ near: number;
8
+ /** Far clipping plane */
9
+ far: number;
10
+ };
11
+ export declare const DIVEPerspectiveCameraDefaultSettings: Required<DIVEPerspectiveCameraSettings>;
12
+ /**
13
+ * Gives a node a perspective view of the scene.
14
+ *
15
+ * Settings arrive through {@link applySettings} rather than the constructor, which
16
+ * takes no arguments: `Object3D.clone()` calls `new this.constructor()`, so a
17
+ * required parameter would make cloning a node throw.
18
+ *
19
+ * @module
20
+ */
21
+ export declare class PerspectiveCameraComponent extends DIVECameraComponent {
22
+ readonly isPerspectiveCameraComponent: true;
23
+ constructor();
24
+ get camera(): PerspectiveCamera;
25
+ /**
26
+ * Applies whatever the settings carry, leaving the rest as it is.
27
+ *
28
+ * @param settings - Field of view, near and far plane.
29
+ */
30
+ applySettings(settings: Partial<DIVEPerspectiveCameraSettings>): void;
31
+ /**
32
+ * Takes on the source's settings. Aspect is left out: it comes from the
33
+ * viewport through {@link onResize}, not from whoever configured the camera.
34
+ *
35
+ * @param source - The component to copy from.
36
+ */
37
+ copy(source: this): this;
38
+ onResize(width: number, height: number): void;
39
+ }
@@ -0,0 +1,50 @@
1
+ import { Mesh } from 'three/webgpu';
2
+ import { DIVEComponent } from '../../engine/component/Component.ts';
3
+ /**
4
+ * An infinite shader-based grid that follows the camera.
5
+ *
6
+ * Draws anti-aliased minor and major grid lines with a radial distance fade. The
7
+ * plane is finite and snaps to the camera in whole cells, which is what makes it
8
+ * look endless: the fade hides the edge, and snapping keeps the lines from
9
+ * crawling as the camera moves.
10
+ *
11
+ * The camera comes from `onBeforeRender` on the contributed mesh, which is the
12
+ * sanctioned way for a component to get one -- `tick` has no view context, and
13
+ * the grid has to react to whichever camera is rendering rather than to time.
14
+ *
15
+ * Visibility lives on the mesh rather than on a node, so hiding the grid never
16
+ * touches whatever else its node carries.
17
+ *
18
+ * @module
19
+ */
20
+ export declare class GridComponent extends DIVEComponent {
21
+ readonly isGridComponent: true;
22
+ private _mesh;
23
+ private _material;
24
+ private _uniforms;
25
+ private _gridSize;
26
+ constructor();
27
+ /** The plane the grid is drawn on. */
28
+ get mesh(): Mesh;
29
+ /** Whether the grid is drawn. */
30
+ get visible(): boolean;
31
+ /** Distance between minor grid lines in meters. */
32
+ get gridSize(): number;
33
+ /** How many cells apart the thicker major lines are drawn. */
34
+ get majorLineEvery(): number;
35
+ /**
36
+ * @param visible - Whether the grid is drawn.
37
+ */
38
+ setVisibility(visible: boolean): this;
39
+ /**
40
+ * @param size - Distance between minor grid lines in meters. Also the step
41
+ * the plane snaps to, so the lines stay put as the camera moves.
42
+ */
43
+ setGridSize(size: number): this;
44
+ /**
45
+ * @param n - Draw a thicker major line every N cells.
46
+ */
47
+ setMajorLineEvery(n: number): this;
48
+ copy(source: this): this;
49
+ dispose(): void;
50
+ }
@@ -1,11 +1,7 @@
1
- export * from './floor/Floor.ts';
2
- export * from './gizmo/Gizmo.ts';
3
- export * from './grid/Grid.ts';
4
- export * from './group/Group.ts';
1
+ export * from './camera/index.ts';
2
+ export * from './grid/GridComponent.ts';
3
+ export * from './line/index.ts';
5
4
  export * from './light/index.ts';
6
- export * from './model/Model.ts';
7
- export * from './node/Node.ts';
8
- export * from './primitive/Primitive.ts';
9
- export * from './root/Root.ts';
10
- export * from './spritetext/SpriteText.ts';
11
- export * from './boundingbox/BoundingBox.ts';
5
+ export * from './mesh/index.ts';
6
+ export * from './spritetext/SpriteTextComponent.ts';
7
+ export * from './boundingbox/index.ts';
@@ -0,0 +1,65 @@
1
+ import { Color, Light } from 'three/webgpu';
2
+ import { DIVEComponent } from '../../engine/component/Component.ts';
3
+ /**
4
+ * Base class for every light a node can carry.
5
+ *
6
+ * Exists so callers never have to know *which* kind of light a node holds: a
7
+ * scene light is a node with a hemisphere and a directional component, and
8
+ * applying colour or intensity to it is the same loop as for a single point
9
+ * light. That is what keeps the state layer free of per-light-type branching.
10
+ *
11
+ * Takes constructor arguments, unlike concrete components: it is abstract and
12
+ * therefore never the target of `new this.constructor()` in `clone()`.
13
+ *
14
+ * @module
15
+ */
16
+ export declare abstract class DIVELightComponent extends DIVEComponent {
17
+ readonly isDIVELightComponent: true;
18
+ protected _light: Light;
19
+ /**
20
+ * Scales the intensity handed to {@link setIntensity}.
21
+ *
22
+ * Lets a multi-light node keep its relative balance -- a scene light's
23
+ * directional part has always been brighter than its hemisphere part -- while
24
+ * callers still deal in a single value.
25
+ */
26
+ private _intensityFactor;
27
+ /**
28
+ * @param light - The three light this component owns.
29
+ * @param intensityFactor - Multiplier applied to the requested intensity.
30
+ */
31
+ constructor(light: Light, intensityFactor?: number);
32
+ /**
33
+ * The three light this component owns.
34
+ */
35
+ get light(): Light;
36
+ /**
37
+ * @param color - The light colour.
38
+ */
39
+ setColor(color: Color): void;
40
+ /**
41
+ * @param intensity - The light intensity, before the component's factor.
42
+ */
43
+ setIntensity(intensity: number): void;
44
+ /**
45
+ * @param enabled - Whether the light contributes to the scene.
46
+ */
47
+ setEnabled(enabled: boolean): void;
48
+ /**
49
+ * Takes on the source's colour, brightness, direction and on/off state.
50
+ *
51
+ * Goes through the setters rather than writing the light, so a subclass that
52
+ * mirrors them onto a proxy -- `PointLightComponent` and its handle -- keeps
53
+ * up. {@link setIntensity} applies the factor, so the stored value has to be
54
+ * divided back out first; both components are the same class and therefore
55
+ * carry the same factor.
56
+ *
57
+ * The light's position is direction rather than placement for a hemisphere or
58
+ * a directional light, and unused for the others, so copying it is right in
59
+ * every case.
60
+ *
61
+ * @param source - The component to copy from.
62
+ */
63
+ copy(source: this): this;
64
+ dispose(): void;
65
+ }