@shopware-ag/dive 4.0.1 → 4.1.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/build/chunks/{AssetCache-DnAAa719.mjs → AssetCache-BukUxOQj.mjs} +8 -9
- package/build/chunks/AssetCache-qEEswhJh.cjs +1 -0
- package/build/chunks/{AssetExporter-CoL-QXkB.cjs → AssetExporter-42qgIOkb.cjs} +1 -1
- package/build/chunks/{AssetExporter-CD2iuQce.mjs → AssetExporter-B92XZQEe.mjs} +1 -1
- package/build/chunks/AssetLoader-Bn4R6_rn.cjs +3 -0
- package/build/chunks/{AssetLoader-Bkp3fWZz.mjs → AssetLoader-DvbdFdyg.mjs} +53 -55
- package/build/chunks/{FileTypes-D3Dxr2dj.mjs → FileTypes-C8BdyVai.mjs} +887 -492
- package/build/chunks/FileTypes-DTCnNV95.cjs +29 -0
- package/build/chunks/GridNode-BJ35_54X.cjs +1 -0
- package/build/chunks/GridNode-CRviKlfb.mjs +58 -0
- package/build/chunks/{ModelComponent-Cmu0EX0r.cjs → ModelComponent-CHIXv2a6.cjs} +1 -1
- package/build/chunks/{ModelComponent-WA0kLOEY.mjs → ModelComponent-DEUhl62p.mjs} +2 -2
- package/build/chunks/OrbitController-Cq5Q1m82.cjs +1 -0
- package/build/chunks/{OrbitController-DxCbrQVB.mjs → OrbitController-DgAc7NaY.mjs} +3 -4
- package/build/chunks/{SpriteTextComponent-BpoKLOjA.cjs → SpriteTextComponent-IYbrESut.cjs} +1 -1
- package/build/chunks/{SpriteTextComponent-DIZFqao0.mjs → SpriteTextComponent-JwWMzAKh.mjs} +1 -1
- package/build/chunks/{contributesToBounds-DYmHYES4.mjs → contributesToBounds-DK3AK1Lq.mjs} +4 -3
- package/build/chunks/{contributesToBounds-C1mva__U.cjs → contributesToBounds-Dmh3K2n5.cjs} +1 -1
- package/build/chunks/{detachTransformControls-CZ2cd5hx.cjs → detachTransformControls-C6Zej6b_.cjs} +1 -1
- package/build/chunks/{detachTransformControls-B4iRF1bw.mjs → detachTransformControls-DRCqBDEX.mjs} +2 -2
- package/build/chunks/draco_decoder-C69s_Ovp.cjs +34 -0
- package/build/chunks/draco_decoder-C9dq_cZY.mjs +37 -0
- package/build/chunks/draco_decoder-CPiEz08P.cjs +1 -0
- package/build/chunks/draco_decoder-kYeZ1HbP.mjs +4 -0
- package/build/chunks/draco_wasm_wrapper-DXbP0W2R.cjs +117 -0
- package/build/chunks/draco_wasm_wrapper-FC39lTlO.mjs +120 -0
- package/build/chunks/{isFileExtensionSupported-B1q2eWs7.cjs → isFileExtensionSupported-CY90yqQo.cjs} +1 -1
- package/build/chunks/{isFileExtensionSupported-BqOqU3-h.mjs → isFileExtensionSupported-DRnGwWT2.mjs} +1 -1
- package/build/components/camera/CameraComponent.d.ts +2 -1
- package/build/components/grid/GridComponent.d.ts +51 -1
- package/build/components/index.d.ts +1 -0
- package/build/components/softshadow/SoftShadowComponent.d.ts +197 -0
- package/build/components/softshadow/index.d.ts +1 -0
- package/build/constants/GridColors.d.ts +46 -2
- package/build/constants/VisibilityLayerMask.d.ts +12 -0
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +105 -101
- package/build/engine/node/Node.d.ts +2 -0
- package/build/engine/renderer/Renderer.d.ts +21 -1
- package/build/engine/scene/Scene.d.ts +9 -9
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +2 -2
- package/build/plugins/assetcache/index.cjs +1 -1
- package/build/plugins/assetcache/index.mjs +1 -1
- package/build/plugins/assetexporter/index.cjs +1 -1
- package/build/plugins/assetexporter/index.mjs +1 -1
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +2 -2
- package/build/plugins/assetloader/src/draco/DracoLoader.d.ts +0 -1
- package/build/plugins/mediacreator/index.cjs +1 -1
- package/build/plugins/mediacreator/index.mjs +3 -4
- package/build/plugins/orbitcontroller/index.cjs +1 -1
- package/build/plugins/orbitcontroller/index.mjs +1 -1
- package/build/plugins/orientationdisplay/index.cjs +1 -1
- package/build/plugins/orientationdisplay/index.mjs +5 -6
- package/build/plugins/quickview/index.cjs +1 -1
- package/build/plugins/quickview/index.mjs +7 -8
- package/build/plugins/shader/index.cjs +1 -1
- package/build/plugins/shader/index.mjs +3 -2
- package/build/plugins/shader/src/index.d.ts +1 -0
- package/build/plugins/shader/src/shaders/BlurNode.d.ts +43 -0
- package/build/plugins/shader/src/shaders/GridNode.d.ts +4 -0
- package/build/plugins/state/index.cjs +1 -1
- package/build/plugins/state/index.mjs +151 -163
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +8 -9
- package/package.json +2 -2
- package/build/chunks/AssetCache-CUVFS7wk.cjs +0 -1
- package/build/chunks/AssetLoader-DnVvCd41.cjs +0 -3
- package/build/chunks/FileTypes-B-MjfMGd.cjs +0 -29
- package/build/chunks/GridNode-0R5ZnzR6.mjs +0 -30
- package/build/chunks/GridNode-iqnu86_v.cjs +0 -1
- package/build/chunks/OrbitController-CAJIiZeE.cjs +0 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { Color, Mesh, ColorRepresentation, Scene, WebGPURenderer } from 'three/webgpu';
|
|
2
|
+
import { DIVEComponent } from '../../engine/component/Component.ts';
|
|
3
|
+
import { DIVENode } from '../../engine/node/Node.ts';
|
|
4
|
+
/**
|
|
5
|
+
* A soft contact shadow under the node it is attached to, baked once.
|
|
6
|
+
*
|
|
7
|
+
* What it draws is not a shadow map and does not come from any light: a camera
|
|
8
|
+
* under the node looks up and records how close the geometry above it comes to
|
|
9
|
+
* the ground, and that gets blurred and put on a plane. So it costs one
|
|
10
|
+
* transparent quad per frame however complicated the model is, the softness is a
|
|
11
|
+
* number rather than a consequence of a light's size, and it does not flicker or
|
|
12
|
+
* crawl the way a shadow map does at grazing angles.
|
|
13
|
+
*
|
|
14
|
+
* The trade is that it is baked. It holds for a model that stands still --
|
|
15
|
+
* which is what it is for -- and anything that moves, turns or reshapes the node
|
|
16
|
+
* needs another bake. The same events {@link BoundingBoxComponent} watches mark
|
|
17
|
+
* it stale, and {@link tick} re-bakes it by itself; {@link setAutoBake} turns
|
|
18
|
+
* that off for a caller that would rather decide, such as an editor dragging a
|
|
19
|
+
* gizmo.
|
|
20
|
+
*
|
|
21
|
+
* The bake needs a renderer and a scene, which a component has no way to ask
|
|
22
|
+
* for. Both arrive through `onBeforeRender` on the contributed plane -- the
|
|
23
|
+
* sanctioned route, and the same one {@link GridComponent} uses for its camera.
|
|
24
|
+
* The first frame therefore draws nothing, and the shadow appears in the second.
|
|
25
|
+
* {@link bake} is there for a caller that has a renderer and does not want to
|
|
26
|
+
* wait for that.
|
|
27
|
+
*
|
|
28
|
+
* The plane sits on {@link SHADOW_LAYER_MASK}, which keeps it out of bounding
|
|
29
|
+
* boxes, exports and picking -- and, since the bake camera renders
|
|
30
|
+
* {@link PRODUCT_LAYER_MASK}, out of its own shadow. Everything else on the
|
|
31
|
+
* product layer within the frustum is captured, so a model standing next to
|
|
32
|
+
* another one is shaded by it too.
|
|
33
|
+
*
|
|
34
|
+
* @module
|
|
35
|
+
*/
|
|
36
|
+
export declare class SoftShadowComponent extends DIVEComponent {
|
|
37
|
+
readonly isSoftShadowComponent: true;
|
|
38
|
+
private _mesh;
|
|
39
|
+
private _material;
|
|
40
|
+
/** Where the bake ends up, and what the plane samples. Never swapped. */
|
|
41
|
+
private _target;
|
|
42
|
+
/** The other half of the blur ping-pong. */
|
|
43
|
+
private _scratch;
|
|
44
|
+
private _quad;
|
|
45
|
+
private _blurToScratch;
|
|
46
|
+
private _blurToTarget;
|
|
47
|
+
private _horizontal;
|
|
48
|
+
private _vertical;
|
|
49
|
+
private _camera;
|
|
50
|
+
private _depthMaterial;
|
|
51
|
+
private _opacity;
|
|
52
|
+
private _darkness;
|
|
53
|
+
/** How high the bake frustum reaches, so the shader can normalise depth. */
|
|
54
|
+
private _reach;
|
|
55
|
+
private _bounds;
|
|
56
|
+
private _stale;
|
|
57
|
+
private _needsBake;
|
|
58
|
+
private _resolution;
|
|
59
|
+
private _softness;
|
|
60
|
+
private _autoBake;
|
|
61
|
+
/** World-space extent of the plane, which is what a blur radius is in UV of. */
|
|
62
|
+
private _width;
|
|
63
|
+
private _depth;
|
|
64
|
+
private _renderer;
|
|
65
|
+
private _scene;
|
|
66
|
+
private _invalidate;
|
|
67
|
+
constructor();
|
|
68
|
+
/** The plane the shadow is drawn on. */
|
|
69
|
+
get mesh(): Mesh;
|
|
70
|
+
/** Whether the shadow is drawn. */
|
|
71
|
+
get visible(): boolean;
|
|
72
|
+
/** The shadow colour. */
|
|
73
|
+
get color(): Color;
|
|
74
|
+
/** How opaque the shadow is drawn, 0 to 1. */
|
|
75
|
+
get opacity(): number;
|
|
76
|
+
/** How dark the shadow goes where something touches the ground, 0 to 1. */
|
|
77
|
+
get darkness(): number;
|
|
78
|
+
/** How far the shadow spreads past what casts it, in meters. */
|
|
79
|
+
get softness(): number;
|
|
80
|
+
/** Edge length of the shadow texture, in pixels. */
|
|
81
|
+
get resolution(): number;
|
|
82
|
+
/** Whether {@link tick} re-bakes the shadow when it goes stale. */
|
|
83
|
+
get autoBake(): boolean;
|
|
84
|
+
/** Whether the shadow on screen is behind what the node looks like now. */
|
|
85
|
+
get needsBake(): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* @param visible - Whether the shadow is drawn.
|
|
88
|
+
*/
|
|
89
|
+
setVisibility(visible: boolean): this;
|
|
90
|
+
/**
|
|
91
|
+
* Costs no bake: the bake writes alpha, and this is the colour under it.
|
|
92
|
+
*
|
|
93
|
+
* @param color - The shadow colour.
|
|
94
|
+
*/
|
|
95
|
+
setColor(color: ColorRepresentation): this;
|
|
96
|
+
/**
|
|
97
|
+
* Costs no bake either, which makes it the one to animate or tie to a slider.
|
|
98
|
+
*
|
|
99
|
+
* @param opacity - How opaque the shadow is drawn, 0 to 1.
|
|
100
|
+
*/
|
|
101
|
+
setOpacity(opacity: number): this;
|
|
102
|
+
/**
|
|
103
|
+
* How dark the shadow goes directly under the model.
|
|
104
|
+
*
|
|
105
|
+
* Baked into the texture, unlike {@link setOpacity}, because it is a curve
|
|
106
|
+
* over height rather than one value over the whole plane.
|
|
107
|
+
*
|
|
108
|
+
* @param darkness - The darkness at ground contact, 0 to 1.
|
|
109
|
+
*/
|
|
110
|
+
setDarkness(darkness: number): this;
|
|
111
|
+
/**
|
|
112
|
+
* How far the shadow spreads past what casts it.
|
|
113
|
+
*
|
|
114
|
+
* In meters, so it stays put when the model is swapped for a bigger one.
|
|
115
|
+
* The plane grows with it -- {@link PADDING_FACTOR} radii past the bounds --
|
|
116
|
+
* so raising this never clips the falloff.
|
|
117
|
+
*
|
|
118
|
+
* @param softness - The spread in meters.
|
|
119
|
+
*/
|
|
120
|
+
setSoftness(softness: number): this;
|
|
121
|
+
/**
|
|
122
|
+
* @param resolution - Edge length of the shadow texture in pixels.
|
|
123
|
+
*/
|
|
124
|
+
setResolution(resolution: number): this;
|
|
125
|
+
/**
|
|
126
|
+
* Whether the component re-bakes itself when the node changes.
|
|
127
|
+
*
|
|
128
|
+
* On by default. Worth turning off while something drags the node around,
|
|
129
|
+
* where every frame would otherwise pay for a bake nobody sees.
|
|
130
|
+
*
|
|
131
|
+
* @param autoBake - Whether to re-bake on tick.
|
|
132
|
+
*/
|
|
133
|
+
setAutoBake(autoBake: boolean): this;
|
|
134
|
+
/**
|
|
135
|
+
* Marks the shadow stale, so it is baked again.
|
|
136
|
+
*
|
|
137
|
+
* Only needed for changes nothing announces -- a geometry swapped in place
|
|
138
|
+
* on a mesh that is already in the node. Everything that goes through the
|
|
139
|
+
* node's own API arrives here as an event.
|
|
140
|
+
*/
|
|
141
|
+
refresh(): this;
|
|
142
|
+
/**
|
|
143
|
+
* Renders the shadow.
|
|
144
|
+
*
|
|
145
|
+
* Four passes: the silhouette from below, then the blur twice over, each
|
|
146
|
+
* horizontal and vertical. All of it on the GPU, nothing read back, so this
|
|
147
|
+
* is synchronous -- but it does render the scene, so it is not something to
|
|
148
|
+
* call every frame by choice.
|
|
149
|
+
*
|
|
150
|
+
* Puts back everything it borrows from the renderer and the scene, including
|
|
151
|
+
* on the way out of a failure, because the live view renders from the same
|
|
152
|
+
* two.
|
|
153
|
+
*
|
|
154
|
+
* @param renderer - An initialised renderer.
|
|
155
|
+
* @param scene - The scene the node stands in.
|
|
156
|
+
*/
|
|
157
|
+
bake(renderer: WebGPURenderer, scene: Scene): this;
|
|
158
|
+
/**
|
|
159
|
+
* Keeps the plane under the node, and bakes when something has changed.
|
|
160
|
+
*
|
|
161
|
+
* Enrolled only while there is something to do: a bake turns the tick off
|
|
162
|
+
* again, and an event turns it back on.
|
|
163
|
+
*/
|
|
164
|
+
tick(): void;
|
|
165
|
+
protected onAttach(owner: DIVENode): void;
|
|
166
|
+
protected onDetach(previousOwner: DIVENode): void;
|
|
167
|
+
copy(source: this): this;
|
|
168
|
+
dispose(): void;
|
|
169
|
+
/** Re-encloses the owner if anything has happened since the last read. */
|
|
170
|
+
private _measure;
|
|
171
|
+
/**
|
|
172
|
+
* Sizes the plane to the bounds and puts it under them.
|
|
173
|
+
*
|
|
174
|
+
* World-aligned and flat on the lowest point of the node, whatever the
|
|
175
|
+
* owner's own transform is -- which is why the owner's world matrix is
|
|
176
|
+
* multiplied back out: a contributed object would otherwise be transformed
|
|
177
|
+
* by it a second time.
|
|
178
|
+
*/
|
|
179
|
+
private _place;
|
|
180
|
+
/** Points the bake camera up through the bounds from the plane. */
|
|
181
|
+
private _aim;
|
|
182
|
+
/** Matches both targets to the configured resolution. */
|
|
183
|
+
private _resize;
|
|
184
|
+
/**
|
|
185
|
+
* One separable blur: horizontal into the scratch target, vertical back.
|
|
186
|
+
*
|
|
187
|
+
* The radius is in meters and the taps step in UV, so each direction is
|
|
188
|
+
* divided by the extent of the plane along it -- which is what keeps a
|
|
189
|
+
* shadow on a wide, shallow plane from being blurred into an oval.
|
|
190
|
+
*
|
|
191
|
+
* @param renderer - The renderer to draw with.
|
|
192
|
+
* @param scale - The radius for this pass, relative to {@link softness}.
|
|
193
|
+
*/
|
|
194
|
+
private _blur;
|
|
195
|
+
/** Marks the shadow current, and stops the tick until something changes. */
|
|
196
|
+
private _settle;
|
|
197
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SoftShadowComponent.ts';
|
|
@@ -1,2 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ColorRepresentation } from 'three/webgpu';
|
|
2
|
+
/**
|
|
3
|
+
* What a grid preset settles: how the two kinds of line read against the ground
|
|
4
|
+
* they sit on, and nothing else.
|
|
5
|
+
*
|
|
6
|
+
* Opacity rather than a paler color, because paler only works in one direction:
|
|
7
|
+
* on a dark ground the way to a quieter line is darker, on a light one it is
|
|
8
|
+
* lighter, and opacity is the same move on both. It is also the only one open
|
|
9
|
+
* to a transparent canvas, where the ground is a page the engine cannot read.
|
|
10
|
+
*/
|
|
11
|
+
export type DIVEGridColors = {
|
|
12
|
+
/** Color of the minor grid lines. */
|
|
13
|
+
minorLineColor: ColorRepresentation;
|
|
14
|
+
/** Color of the major grid lines. */
|
|
15
|
+
majorLineColor: ColorRepresentation;
|
|
16
|
+
/** How opaque the minor grid lines are drawn, 0 to 1. */
|
|
17
|
+
minorLineOpacity: number;
|
|
18
|
+
/** How opaque the major grid lines are drawn, 0 to 1. */
|
|
19
|
+
majorLineOpacity: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Lines for a grid that sits on something light -- a white floor, or a page in
|
|
23
|
+
* its light theme.
|
|
24
|
+
*
|
|
25
|
+
* The minor lines carry the pattern and the major ones the reading of it, so
|
|
26
|
+
* the two are a step apart rather than a shade: close together they read as one
|
|
27
|
+
* grid drawn badly.
|
|
28
|
+
*/
|
|
29
|
+
export declare const DIVEGridOnLightColors: DIVEGridColors;
|
|
30
|
+
/**
|
|
31
|
+
* Lines for a grid that sits on something dark -- a dark floor, or a page in
|
|
32
|
+
* its dark theme.
|
|
33
|
+
*
|
|
34
|
+
* Lighter than the ground rather than darker, and by less than the light
|
|
35
|
+
* preset's step: on a dark ground the same contrast reads louder, and a grid
|
|
36
|
+
* that shouts is furniture drawing attention to itself.
|
|
37
|
+
*/
|
|
38
|
+
export declare const DIVEGridOnDarkColors: DIVEGridColors;
|
|
39
|
+
/**
|
|
40
|
+
* Lines that hold on either ground, for a viewer that does not know which it is
|
|
41
|
+
* standing on.
|
|
42
|
+
*
|
|
43
|
+
* A compromise by construction: mid grey never disappears into white or into
|
|
44
|
+
* black, and never reads as well on either as the preset made for it.
|
|
45
|
+
*/
|
|
46
|
+
export declare const DIVEGridOnAnyColors: DIVEGridColors;
|
|
@@ -26,3 +26,15 @@ export declare const FLOOR_LAYER_MASK = 32;
|
|
|
26
26
|
* picked at all.
|
|
27
27
|
*/
|
|
28
28
|
export declare const PROXY_LAYER_MASK = 64;
|
|
29
|
+
/**
|
|
30
|
+
* A baked contact shadow under a model.
|
|
31
|
+
*
|
|
32
|
+
* Its own bit for the same reason the floor has one: the shadow has to be drawn
|
|
33
|
+
* in both views, but it is not geometry. `PRODUCT_LAYER_MASK` would put it into
|
|
34
|
+
* bounding boxes, scene exports and picking, and it is the one thing the bake
|
|
35
|
+
* must never capture -- the bake camera renders `PRODUCT_LAYER_MASK`, so this
|
|
36
|
+
* bit is what keeps the plane out of its own shadow. `FLOOR_LAYER_MASK` would
|
|
37
|
+
* tie it to the ground plane, and hiding the floor would take the shadow with
|
|
38
|
+
* it.
|
|
39
|
+
*/
|
|
40
|
+
export declare const SHADOW_LAYER_MASK = 128;
|
package/build/dive.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var P=Object.defineProperty;var h=(e,t,n)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var m=(e,t,n)=>h(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/FileTypes-DTCnNV95.cjs"),f=require("./chunks/AxisHelperColors-BrGqktN5.cjs"),E=require("./chunks/contributesToBounds-Dmh3K2n5.cjs"),C=require("./chunks/detachTransformControls-C6Zej6b_.cjs"),M=require("./chunks/ModelComponent-CHIXv2a6.cjs"),y=require("./chunks/SpriteTextComponent-IYbrESut.cjs"),L=require("./chunks/collectAnimations-C3HfZHte.cjs"),I=require("./chunks/isVisibleInHierarchy-D9JcLqR5.cjs"),D=require("./chunks/isFileExtensionSupported-CY90yqQo.cjs"),S=require("three/webgpu"),A=require("./chunks/network-error-CdDXil5g.cjs"),g=require("./chunks/parse-error-Dy_EE4rL.cjs");class R{constructor(){m(this,"isMovable",!0)}}class _{constructor(){m(this,"isSelectable",!0)}}function T(e,t){return t.forEach(n=>{Object.getOwnPropertyNames(n.prototype).forEach(c=>{if(c==="constructor")return;const l=Object.getOwnPropertyDescriptor(n.prototype,c);Object.defineProperty(e.prototype,c,l)});const r=new n;Object.getOwnPropertyNames(r).forEach(c=>{const l=Object.getOwnPropertyDescriptor(r,c);Object.defineProperty(e.prototype,c,l)})}),e}function a(e,t=new WeakMap){if(e===null||typeof e!="object")return e;if(t.has(e))return t.get(e);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e)){const i=[];t.set(e,i);for(let s=0;s<e.length;s++)i[s]=a(e[s],t);return i}if(e instanceof Map){const i=new Map;t.set(e,i);for(const[s,u]of e)i.set(a(s,t),a(u,t));return i}if(e instanceof Set){const i=new Set;t.set(e,i);for(const s of e)i.add(a(s,t));return i}const n=e;if(typeof n.clone=="function"){const i=n.clone();return t.set(e,i),i}const r=Object.create(Object.getPrototypeOf(e));t.set(e,r);const c=Object.getOwnPropertyNames(e);for(const i of c){const s=Object.getOwnPropertyDescriptor(e,i);if(s)if(s.value!==void 0){const u=a(s.value,t);Object.defineProperty(r,i,{...s,value:u})}else Object.defineProperty(r,i,s)}const l=Object.getOwnPropertySymbols(e);for(const i of l){const s=Object.getOwnPropertyDescriptor(e,i);if(s)if(s.value!==void 0){const u=a(s.value,t);Object.defineProperty(r,i,{...s,value:u})}else Object.defineProperty(r,i,s)}return r}const d=(e,t)=>{if(Object.keys(e).length===0&&Object.keys(t).length===0)return{};if(typeof e!="object"||typeof t!="object")return t;let n={};return Object.keys(t).forEach(r=>{if(!Object.keys(e).includes(r)){n={...n,[r]:t[r]};return}if(Array.isArray(t[r])){if(!Array.isArray(e[r])){n={...n,[r]:t[r]};return}const c=e[r],l=t[r];if(c.length===0&&l.length===0){n={...n};return}if(c.length!==l.length){n={...n,[r]:t[r]};return}const i=[];if(l.forEach((s,u)=>{const O=d(c[u],l[u]);Object.keys(O).length&&i.push(l[u])}),Object.keys(i).length){n={...n,[r]:i};return}return}if(typeof t[r]=="object"){if(typeof e[r]!="object"){n={...n,[r]:t[r]};return}const c=d(e[r],t[r]);if(Object.keys(c).length){n={...n,[r]:c};return}}e[r]!==t[r]&&(n={...n,[r]:t[r]})}),n};function x(e){return o.SUPPORTED_MIME_TYPES.includes(e.toLowerCase())}function F(e){return D.isFileExtensionSupported(D.getFileTypeFromUri(e))}function p(e,t){const n=(e+"e").split("e");return+(n[0]+"e"+(+n[1]+(t||0)))}function Y(e,t=0){const n=p(e,+t);return p(Math.ceil(n),-t)}function w(e,t=0){const n=p(e,+t);return p(Math.floor(n),-t)}function V(e,t=0){if(e<0)return-V(-e,t);const n=p(e,+t);return p(Math.round(n),-t)}function B(e,t,n){return Math.atan2(e.clone().cross(t).dot(n),t.clone().dot(e))}function U(e,t=0){const n=p(e,+t);return p(Math.round(n),-t).toFixed(t)}function K(e,t=0){const n=p(e,+t);return p(Math.trunc(n),-t)}function b(e){return(S.MathUtils.radToDeg(e)+360)%360}function G(e){return S.MathUtils.degToRad(e)}const v={ceilExp:Y,floorExp:w,roundExp:V,toFixedExp:U,truncateExp:K,signedAngleTo:B,radToDeg:b,degToRad:G};exports.BoundingBox=o.BoundingBox;exports.BoundingBoxComponent=o.BoundingBoxComponent;exports.DIVE=o.DIVE;exports.DIVEAbortablePromise=o.DIVEAbortablePromise;exports.DIVECameraComponent=o.DIVECameraComponent;exports.DIVECanvasLifecycleManager=o.DIVECanvasLifecycleManager;exports.DIVEClock=o.DIVEClock;exports.DIVEComponent=o.DIVEComponent;exports.DIVEDefaultSettings=o.DIVEDefaultSettings;exports.DIVEDeferredPromise=o.DIVEDeferredPromise;exports.DIVEEnvironment=o.DIVEEnvironment;exports.DIVEEnvironmentDefaultSettings=o.DIVEEnvironmentDefaultSettings;exports.DIVEGridDefaultSettings=o.DIVEGridDefaultSettings;exports.DIVEGridOnAnyColors=o.DIVEGridOnAnyColors;exports.DIVEGridOnDarkColors=o.DIVEGridOnDarkColors;exports.DIVEGridOnLightColors=o.DIVEGridOnLightColors;exports.DIVELightComponent=o.DIVELightComponent;exports.DIVENode=o.DIVENode;exports.DIVEPerspectiveCameraDefaultSettings=o.DIVEPerspectiveCameraDefaultSettings;exports.DIVERenderer=o.DIVERenderer;exports.DIVERendererDefaultSettings=o.DIVERendererDefaultSettings;exports.DIVERoot=o.DIVERoot;exports.DIVEScene=o.DIVEScene;exports.DIVESceneDefaultSettings=o.DIVESceneDefaultSettings;exports.DIVEView=o.DIVEView;exports.DirectionalLightComponent=o.DirectionalLightComponent;exports.FILE_TYPES=o.FILE_TYPES;exports.FloorComponent=o.FloorComponent;exports.GridComponent=o.GridComponent;exports.HemisphereLightComponent=o.HemisphereLightComponent;exports.MeshComponent=o.MeshComponent;exports.MultiLineComponent=o.MultiLineComponent;exports.PerspectiveCameraComponent=o.PerspectiveCameraComponent;exports.SUPPORTED_FILE_TYPES=o.SUPPORTED_FILE_TYPES;exports.SUPPORTED_MIME_TYPES=o.SUPPORTED_MIME_TYPES;exports.SoftShadowComponent=o.SoftShadowComponent;exports.computeProductBounds=o.computeProductBounds;exports.contributedBy=o.contributedBy;exports.disposeComponents=o.disposeComponents;exports.findComponent=o.findComponent;exports.findSceneRecursive=o.findSceneRecursive;exports.isDIVEComponent=o.isDIVEComponent;exports.AxesColorBlue=f.AxesColorBlue;exports.AxesColorBlueLetter=f.AxesColorBlueLetter;exports.AxesColorGreen=f.AxesColorGreen;exports.AxesColorGreenLetter=f.AxesColorGreenLetter;exports.AxesColorRed=f.AxesColorRed;exports.AxesColorRedLetter=f.AxesColorRedLetter;exports.COORDINATE_LAYER_MASK=E.COORDINATE_LAYER_MASK;exports.DEFAULT_LAYER_MASK=E.DEFAULT_LAYER_MASK;exports.FLOOR_LAYER_MASK=E.FLOOR_LAYER_MASK;exports.HELPER_LAYER_MASK=E.HELPER_LAYER_MASK;exports.PRODUCT_LAYER_MASK=E.PRODUCT_LAYER_MASK;exports.PROXY_LAYER_MASK=E.PROXY_LAYER_MASK;exports.SHADOW_LAYER_MASK=E.SHADOW_LAYER_MASK;exports.UI_LAYER_MASK=E.UI_LAYER_MASK;exports.contributesToBounds=E.contributesToBounds;exports.AmbientLightComponent=C.AmbientLightComponent;exports.PointLightComponent=C.PointLightComponent;exports.PrimitiveComponent=C.PrimitiveComponent;exports.detachTransformControls=C.detachTransformControls;exports.ModelComponent=M.ModelComponent;exports.SpriteTextComponent=y.SpriteTextComponent;exports.collectAnimations=L.collectAnimations;exports.findInterface=I.findInterface;exports.implementsInterface=I.implementsInterface;exports.isVisibleInHierarchy=I.isVisibleInHierarchy;exports.getFileTypeFromUri=D.getFileTypeFromUri;exports.isFileExtensionSupported=D.isFileExtensionSupported;exports.FileContentError=A.FileContentError;exports.NetworkError=A.NetworkError;exports.FileTypeError=g.FileTypeError;exports.ParseError=g.ParseError;exports.DIVEMath=v;exports.DIVEMovable=R;exports.DIVESelectable=_;exports.applyMixins=T;exports.deepClone=a;exports.getObjectDelta=d;exports.isMimeTypeSupported=x;exports.isURIFileExtensionSupported=F;
|
package/build/dive.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
var g = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { h as
|
|
5
|
-
import { B as G, i as
|
|
6
|
-
import { b as
|
|
7
|
-
import { C as
|
|
8
|
-
import { A as
|
|
9
|
-
import { M as
|
|
10
|
-
import { S as
|
|
11
|
-
import { c as
|
|
12
|
-
import { f as
|
|
13
|
-
import { i as A, g as
|
|
2
|
+
var d = (e, t, r) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var l = (e, t, r) => d(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { h as O } from "./chunks/FileTypes-C8BdyVai.mjs";
|
|
5
|
+
import { B as G, i as H, c as j, j as v, D as b, k as W, l as q, a as z, b as J, m as X, n as Q, o as Z, p as $, q as k, r as ee, s as te, f as re, d as ne, t as oe, u as se, v as ae, w as ce, x as ie, y as fe, z as pe, A as le, F as ue, C as Ee, G as De, H as me, M as ge, E as de, P as Oe, S as Ae, I as he, J as ye, K as Ce, e as Ie, L as Se, g as Pe, N as xe } from "./chunks/FileTypes-C8BdyVai.mjs";
|
|
6
|
+
import { b as Ve, e as Le, a as Re, d as _e, A as Te, c as we } from "./chunks/AxisHelperColors-JLBHYQDi.mjs";
|
|
7
|
+
import { C as Ye, D as Ke, F as Be, H as Ne, P as Ue, a as Ge, S as He, U as je, c as ve } from "./chunks/contributesToBounds-DK3AK1Lq.mjs";
|
|
8
|
+
import { A as We, P as qe, a as ze, d as Je } from "./chunks/detachTransformControls-DRCqBDEX.mjs";
|
|
9
|
+
import { M as Qe } from "./chunks/ModelComponent-DEUhl62p.mjs";
|
|
10
|
+
import { S as $e } from "./chunks/SpriteTextComponent-JwWMzAKh.mjs";
|
|
11
|
+
import { c as et } from "./chunks/collectAnimations-BgYCN1le.mjs";
|
|
12
|
+
import { f as rt, i as nt, a as ot } from "./chunks/isVisibleInHierarchy-KzVGvDEw.mjs";
|
|
13
|
+
import { i as A, g as h } from "./chunks/isFileExtensionSupported-DRnGwWT2.mjs";
|
|
14
14
|
import { MathUtils as E } from "three/webgpu";
|
|
15
|
-
import { F as
|
|
16
|
-
import { F as
|
|
15
|
+
import { F as at, N as ct } from "./chunks/network-error-BONfHWQq.mjs";
|
|
16
|
+
import { F as ft, P as pt } from "./chunks/parse-error-DfOPyLWM.mjs";
|
|
17
17
|
class T {
|
|
18
18
|
constructor() {
|
|
19
|
-
|
|
19
|
+
l(this, "isMovable", !0);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
class w {
|
|
23
23
|
constructor() {
|
|
24
|
-
|
|
24
|
+
l(this, "isSelectable", !0);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
function F(e, t) {
|
|
@@ -110,7 +110,7 @@ function p(e, t = /* @__PURE__ */ new WeakMap()) {
|
|
|
110
110
|
}
|
|
111
111
|
return n;
|
|
112
112
|
}
|
|
113
|
-
const
|
|
113
|
+
const u = (e, t) => {
|
|
114
114
|
if (Object.keys(e).length === 0 && Object.keys(t).length === 0)
|
|
115
115
|
return {};
|
|
116
116
|
if (typeof e != "object" || typeof t != "object")
|
|
@@ -137,11 +137,11 @@ const l = (e, t) => {
|
|
|
137
137
|
}
|
|
138
138
|
const o = [];
|
|
139
139
|
if (c.forEach((s, f) => {
|
|
140
|
-
const
|
|
140
|
+
const m = u(
|
|
141
141
|
a[f],
|
|
142
142
|
c[f]
|
|
143
143
|
);
|
|
144
|
-
Object.keys(
|
|
144
|
+
Object.keys(m).length && o.push(c[f]);
|
|
145
145
|
}), Object.keys(o).length) {
|
|
146
146
|
r = { ...r, [n]: o };
|
|
147
147
|
return;
|
|
@@ -153,7 +153,7 @@ const l = (e, t) => {
|
|
|
153
153
|
r = { ...r, [n]: t[n] };
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
const a =
|
|
156
|
+
const a = u(
|
|
157
157
|
e[n],
|
|
158
158
|
t[n]
|
|
159
159
|
);
|
|
@@ -165,11 +165,11 @@ const l = (e, t) => {
|
|
|
165
165
|
e[n] !== t[n] && (r = { ...r, [n]: t[n] });
|
|
166
166
|
}), r;
|
|
167
167
|
};
|
|
168
|
-
function N(e) {
|
|
169
|
-
return d.includes(e.toLowerCase());
|
|
170
|
-
}
|
|
171
168
|
function Y(e) {
|
|
172
|
-
return
|
|
169
|
+
return O.includes(e.toLowerCase());
|
|
170
|
+
}
|
|
171
|
+
function K(e) {
|
|
172
|
+
return A(h(e));
|
|
173
173
|
}
|
|
174
174
|
function i(e, t) {
|
|
175
175
|
const r = (e + "e").split("e");
|
|
@@ -179,121 +179,125 @@ function y(e, t = 0) {
|
|
|
179
179
|
const r = i(e, +t);
|
|
180
180
|
return i(Math.ceil(r), -t);
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function C(e, t = 0) {
|
|
183
183
|
const r = i(e, +t);
|
|
184
184
|
return i(Math.floor(r), -t);
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
if (e < 0) return -
|
|
186
|
+
function D(e, t = 0) {
|
|
187
|
+
if (e < 0) return -D(-e, t);
|
|
188
188
|
const r = i(e, +t);
|
|
189
189
|
return i(Math.round(r), -t);
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function I(e, t, r) {
|
|
192
192
|
return Math.atan2(
|
|
193
193
|
e.clone().cross(t).dot(r),
|
|
194
194
|
t.clone().dot(e)
|
|
195
195
|
);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function S(e, t = 0) {
|
|
198
198
|
const r = i(e, +t);
|
|
199
199
|
return i(Math.round(r), -t).toFixed(t);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function P(e, t = 0) {
|
|
202
202
|
const r = i(e, +t);
|
|
203
203
|
return i(Math.trunc(r), -t);
|
|
204
204
|
}
|
|
205
205
|
function x(e) {
|
|
206
206
|
return (E.radToDeg(e) + 360) % 360;
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function M(e) {
|
|
209
209
|
return E.degToRad(e);
|
|
210
210
|
}
|
|
211
211
|
const B = {
|
|
212
212
|
ceilExp: y,
|
|
213
|
-
floorExp:
|
|
214
|
-
roundExp:
|
|
215
|
-
toFixedExp:
|
|
216
|
-
truncateExp:
|
|
217
|
-
signedAngleTo:
|
|
213
|
+
floorExp: C,
|
|
214
|
+
roundExp: D,
|
|
215
|
+
toFixedExp: S,
|
|
216
|
+
truncateExp: P,
|
|
217
|
+
signedAngleTo: I,
|
|
218
218
|
radToDeg: x,
|
|
219
|
-
degToRad:
|
|
219
|
+
degToRad: M
|
|
220
220
|
};
|
|
221
221
|
export {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
222
|
+
We as AmbientLightComponent,
|
|
223
|
+
Ve as AxesColorBlue,
|
|
224
|
+
Le as AxesColorBlueLetter,
|
|
225
|
+
Re as AxesColorGreen,
|
|
226
|
+
_e as AxesColorGreenLetter,
|
|
227
|
+
Te as AxesColorRed,
|
|
228
|
+
we as AxesColorRedLetter,
|
|
229
229
|
G as BoundingBox,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
230
|
+
H as BoundingBoxComponent,
|
|
231
|
+
Ye as COORDINATE_LAYER_MASK,
|
|
232
|
+
Ke as DEFAULT_LAYER_MASK,
|
|
233
|
+
j as DIVE,
|
|
234
|
+
v as DIVEAbortablePromise,
|
|
235
235
|
b as DIVECameraComponent,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
236
|
+
W as DIVECanvasLifecycleManager,
|
|
237
|
+
q as DIVEClock,
|
|
238
|
+
z as DIVEComponent,
|
|
239
|
+
J as DIVEDefaultSettings,
|
|
240
240
|
X as DIVEDeferredPromise,
|
|
241
241
|
Q as DIVEEnvironment,
|
|
242
242
|
Z as DIVEEnvironmentDefaultSettings,
|
|
243
|
-
$ as
|
|
243
|
+
$ as DIVEGridDefaultSettings,
|
|
244
|
+
k as DIVEGridOnAnyColors,
|
|
245
|
+
ee as DIVEGridOnDarkColors,
|
|
246
|
+
te as DIVEGridOnLightColors,
|
|
247
|
+
re as DIVELightComponent,
|
|
244
248
|
B as DIVEMath,
|
|
245
249
|
T as DIVEMovable,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
250
|
+
ne as DIVENode,
|
|
251
|
+
oe as DIVEPerspectiveCameraDefaultSettings,
|
|
252
|
+
se as DIVERenderer,
|
|
253
|
+
ae as DIVERendererDefaultSettings,
|
|
254
|
+
ce as DIVERoot,
|
|
255
|
+
ie as DIVEScene,
|
|
256
|
+
fe as DIVESceneDefaultSettings,
|
|
253
257
|
w as DIVESelectable,
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
ue as GRID_MINOR_LINE_COLOR,
|
|
263
|
-
le as GridComponent,
|
|
258
|
+
pe as DIVEView,
|
|
259
|
+
le as DirectionalLightComponent,
|
|
260
|
+
ue as FILE_TYPES,
|
|
261
|
+
Be as FLOOR_LAYER_MASK,
|
|
262
|
+
at as FileContentError,
|
|
263
|
+
ft as FileTypeError,
|
|
264
|
+
Ee as FloorComponent,
|
|
265
|
+
De as GridComponent,
|
|
264
266
|
Ne as HELPER_LAYER_MASK,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
267
|
+
me as HemisphereLightComponent,
|
|
268
|
+
ge as MeshComponent,
|
|
269
|
+
Qe as ModelComponent,
|
|
270
|
+
de as MultiLineComponent,
|
|
271
|
+
ct as NetworkError,
|
|
272
|
+
Ue as PRODUCT_LAYER_MASK,
|
|
273
|
+
Ge as PROXY_LAYER_MASK,
|
|
274
|
+
pt as ParseError,
|
|
275
|
+
Oe as PerspectiveCameraComponent,
|
|
276
|
+
qe as PointLightComponent,
|
|
277
|
+
ze as PrimitiveComponent,
|
|
278
|
+
He as SHADOW_LAYER_MASK,
|
|
279
|
+
Ae as SUPPORTED_FILE_TYPES,
|
|
280
|
+
O as SUPPORTED_MIME_TYPES,
|
|
281
|
+
he as SoftShadowComponent,
|
|
282
|
+
$e as SpriteTextComponent,
|
|
283
|
+
je as UI_LAYER_MASK,
|
|
280
284
|
F as applyMixins,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
+
et as collectAnimations,
|
|
286
|
+
ye as computeProductBounds,
|
|
287
|
+
Ce as contributedBy,
|
|
288
|
+
ve as contributesToBounds,
|
|
285
289
|
p as deepClone,
|
|
286
|
-
|
|
290
|
+
Je as detachTransformControls,
|
|
287
291
|
Ie as disposeComponents,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
Se as findComponent,
|
|
293
|
+
rt as findInterface,
|
|
294
|
+
Pe as findSceneRecursive,
|
|
295
|
+
h as getFileTypeFromUri,
|
|
296
|
+
u as getObjectDelta,
|
|
297
|
+
nt as implementsInterface,
|
|
298
|
+
xe as isDIVEComponent,
|
|
295
299
|
A as isFileExtensionSupported,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
300
|
+
Y as isMimeTypeSupported,
|
|
301
|
+
K as isURIFileExtensionSupported,
|
|
302
|
+
ot as isVisibleInHierarchy
|
|
299
303
|
};
|
|
@@ -182,6 +182,8 @@ export declare class DIVENode extends Object3D<DIVEEntityEventMap> implements DI
|
|
|
182
182
|
setToWorldOrigin(): void;
|
|
183
183
|
onSelect(): void;
|
|
184
184
|
onDeselect(): void;
|
|
185
|
+
/** Whether an object is this node or hangs anywhere below it. */
|
|
186
|
+
private _contains;
|
|
185
187
|
private _handleAddedToTree;
|
|
186
188
|
private _handleRemovedFromTree;
|
|
187
189
|
private _attachToScene;
|
|
@@ -44,9 +44,29 @@ export type DIVERendererSettings = {
|
|
|
44
44
|
/**
|
|
45
45
|
* Whether to use logarithmic depth buffer
|
|
46
46
|
*
|
|
47
|
-
* @
|
|
47
|
+
* Off, and {@link reversedDepthBuffer} on in its place: both answer the same
|
|
48
|
+
* question, and only one of them answers it in the projection. A logarithmic
|
|
49
|
+
* buffer has every fragment shader write its own depth, which costs early-z
|
|
50
|
+
* and makes every rasterizer-level depth bias a no-op -- `polygonOffset`
|
|
51
|
+
* included, which is how coplanar surfaces are normally settled.
|
|
52
|
+
*
|
|
53
|
+
* @default false
|
|
48
54
|
*/
|
|
49
55
|
logarithmicDepthBuffer: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether to use a reversed depth buffer
|
|
58
|
+
*
|
|
59
|
+
* Floating point depth is near-uniform in its exponent, and a reversed range
|
|
60
|
+
* lines that up with where a perspective divide puts its precision. That is
|
|
61
|
+
* what makes a near plane of a millimeter and a far plane of a kilometer
|
|
62
|
+
* survivable without writing depth per fragment.
|
|
63
|
+
*
|
|
64
|
+
* The WebGL backend needs `EXT_clip_control` for it; three warns and falls
|
|
65
|
+
* back to a plain depth buffer where the extension is missing.
|
|
66
|
+
*
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
reversedDepthBuffer: boolean;
|
|
50
70
|
/**
|
|
51
71
|
* Whether to enable shadows
|
|
52
72
|
*
|