@shopware-ag/dive 4.0.2 → 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-DadU3pjv.mjs → AssetCache-BukUxOQj.mjs} +1 -1
- package/build/chunks/{AssetCache-GSqD2GKD.cjs → AssetCache-qEEswhJh.cjs} +1 -1
- 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-Dwnjh3GI.mjs → AssetLoader-DvbdFdyg.mjs} +61 -62
- package/build/chunks/{FileTypes-CUga4xrG.mjs → FileTypes-C8BdyVai.mjs} +795 -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-DuBAn1uS.cjs → ModelComponent-CHIXv2a6.cjs} +1 -1
- package/build/chunks/{ModelComponent-Cpy9q21L.mjs → ModelComponent-DEUhl62p.mjs} +2 -2
- package/build/chunks/{OrbitController-CK4OclLu.cjs → OrbitController-Cq5Q1m82.cjs} +1 -1
- package/build/chunks/{OrbitController-DFf6ANcN.mjs → OrbitController-DgAc7NaY.mjs} +1 -1
- package/build/chunks/{SpriteTextComponent-Bho3ynCj.cjs → SpriteTextComponent-IYbrESut.cjs} +1 -1
- package/build/chunks/{SpriteTextComponent-DrBnD0_-.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-DFTq45Xl.cjs → detachTransformControls-C6Zej6b_.cjs} +1 -1
- package/build/chunks/{detachTransformControls-D6VK3L3-.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-CCEhBoz9.cjs → isFileExtensionSupported-CY90yqQo.cjs} +1 -1
- package/build/chunks/{isFileExtensionSupported-vz_2VJPi.mjs → isFileExtensionSupported-DRnGwWT2.mjs} +1 -1
- package/build/components/camera/CameraComponent.d.ts +2 -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/VisibilityLayerMask.d.ts +12 -0
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +63 -61
- package/build/engine/node/Node.d.ts +2 -0
- 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 +1 -1
- 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 +3 -3
- package/build/plugins/quickview/index.cjs +1 -1
- package/build/plugins/quickview/index.mjs +3 -3
- 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/state/index.cjs +1 -1
- package/build/plugins/state/index.mjs +3 -3
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +2 -2
- package/package.json +2 -2
- package/build/chunks/AssetLoader-BOBXNUHe.cjs +0 -3
- package/build/chunks/FileTypes-Cm1k0dUE.cjs +0 -29
- package/build/chunks/GridNode-CK4PiwHT.cjs +0 -1
- package/build/chunks/GridNode-KgFpPNWa.mjs +0 -30
|
@@ -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';
|
|
@@ -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 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-
|
|
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,20 +1,20 @@
|
|
|
1
1
|
var g = Object.defineProperty;
|
|
2
2
|
var d = (e, t, r) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var l = (e, t, r) => d(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { h as O } from "./chunks/FileTypes-
|
|
5
|
-
import { B 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
|
|
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
|
|
17
|
-
class
|
|
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
|
+
class T {
|
|
18
18
|
constructor() {
|
|
19
19
|
l(this, "isMovable", !0);
|
|
20
20
|
}
|
|
@@ -168,14 +168,14 @@ const u = (e, t) => {
|
|
|
168
168
|
function Y(e) {
|
|
169
169
|
return O.includes(e.toLowerCase());
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
return
|
|
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");
|
|
176
176
|
return +(r[0] + "e" + (+r[1] + (t || 0)));
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function y(e, t = 0) {
|
|
179
179
|
const r = i(e, +t);
|
|
180
180
|
return i(Math.ceil(r), -t);
|
|
181
181
|
}
|
|
@@ -194,11 +194,11 @@ function I(e, t, 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
|
}
|
|
@@ -208,30 +208,30 @@ function x(e) {
|
|
|
208
208
|
function M(e) {
|
|
209
209
|
return E.degToRad(e);
|
|
210
210
|
}
|
|
211
|
-
const
|
|
212
|
-
ceilExp:
|
|
211
|
+
const B = {
|
|
212
|
+
ceilExp: y,
|
|
213
213
|
floorExp: C,
|
|
214
214
|
roundExp: D,
|
|
215
|
-
toFixedExp:
|
|
216
|
-
truncateExp:
|
|
215
|
+
toFixedExp: S,
|
|
216
|
+
truncateExp: P,
|
|
217
217
|
signedAngleTo: I,
|
|
218
218
|
radToDeg: x,
|
|
219
219
|
degToRad: M
|
|
220
220
|
};
|
|
221
221
|
export {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
222
|
+
We as AmbientLightComponent,
|
|
223
|
+
Ve as AxesColorBlue,
|
|
224
|
+
Le as AxesColorBlueLetter,
|
|
225
|
+
Re as AxesColorGreen,
|
|
226
|
+
_e as AxesColorGreenLetter,
|
|
227
227
|
Te as AxesColorRed,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
228
|
+
we as AxesColorRedLetter,
|
|
229
|
+
G as BoundingBox,
|
|
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
236
|
W as DIVECanvasLifecycleManager,
|
|
237
237
|
q as DIVEClock,
|
|
@@ -245,8 +245,8 @@ export {
|
|
|
245
245
|
ee as DIVEGridOnDarkColors,
|
|
246
246
|
te as DIVEGridOnLightColors,
|
|
247
247
|
re as DIVELightComponent,
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
B as DIVEMath,
|
|
249
|
+
T as DIVEMovable,
|
|
250
250
|
ne as DIVENode,
|
|
251
251
|
oe as DIVEPerspectiveCameraDefaultSettings,
|
|
252
252
|
se as DIVERenderer,
|
|
@@ -259,43 +259,45 @@ export {
|
|
|
259
259
|
le as DirectionalLightComponent,
|
|
260
260
|
ue as FILE_TYPES,
|
|
261
261
|
Be as FLOOR_LAYER_MASK,
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
at as FileContentError,
|
|
263
|
+
ft as FileTypeError,
|
|
264
264
|
Ee as FloorComponent,
|
|
265
265
|
De as GridComponent,
|
|
266
|
-
|
|
266
|
+
Ne as HELPER_LAYER_MASK,
|
|
267
267
|
me as HemisphereLightComponent,
|
|
268
268
|
ge as MeshComponent,
|
|
269
|
-
|
|
269
|
+
Qe as ModelComponent,
|
|
270
270
|
de as MultiLineComponent,
|
|
271
|
-
|
|
271
|
+
ct as NetworkError,
|
|
272
272
|
Ue as PRODUCT_LAYER_MASK,
|
|
273
273
|
Ge as PROXY_LAYER_MASK,
|
|
274
|
-
|
|
274
|
+
pt as ParseError,
|
|
275
275
|
Oe as PerspectiveCameraComponent,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
276
|
+
qe as PointLightComponent,
|
|
277
|
+
ze as PrimitiveComponent,
|
|
278
|
+
He as SHADOW_LAYER_MASK,
|
|
279
|
+
Ae as SUPPORTED_FILE_TYPES,
|
|
279
280
|
O as SUPPORTED_MIME_TYPES,
|
|
280
|
-
|
|
281
|
-
|
|
281
|
+
he as SoftShadowComponent,
|
|
282
|
+
$e as SpriteTextComponent,
|
|
283
|
+
je as UI_LAYER_MASK,
|
|
282
284
|
F as applyMixins,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
285
|
+
et as collectAnimations,
|
|
286
|
+
ye as computeProductBounds,
|
|
287
|
+
Ce as contributedBy,
|
|
288
|
+
ve as contributesToBounds,
|
|
287
289
|
p as deepClone,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
Je as detachTransformControls,
|
|
291
|
+
Ie as disposeComponents,
|
|
292
|
+
Se as findComponent,
|
|
293
|
+
rt as findInterface,
|
|
292
294
|
Pe as findSceneRecursive,
|
|
293
|
-
|
|
295
|
+
h as getFileTypeFromUri,
|
|
294
296
|
u as getObjectDelta,
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
297
|
+
nt as implementsInterface,
|
|
298
|
+
xe as isDIVEComponent,
|
|
299
|
+
A as isFileExtensionSupported,
|
|
298
300
|
Y as isMimeTypeSupported,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
+
K as isURIFileExtensionSupported,
|
|
302
|
+
ot as isVisibleInHierarchy
|
|
301
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;
|
|
@@ -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-
|
|
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-Bn4R6_rn.cjs");require("three/examples/jsm/loaders/DRACOLoader.js");const w=require("../../chunks/AssetExporter-42qgIOkb.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,9 +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-
|
|
6
|
+
import { A as _ } from "../../chunks/AssetLoader-DvbdFdyg.mjs";
|
|
7
7
|
import "three/examples/jsm/loaders/DRACOLoader.js";
|
|
8
|
-
import { A as f } from "../../chunks/AssetExporter-
|
|
8
|
+
import { A as f } from "../../chunks/AssetExporter-B92XZQEe.mjs";
|
|
9
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 || {});
|
|
10
10
|
class a extends Error {
|
|
11
11
|
constructor(r, t) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetCache-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetCache-qEEswhJh.cjs");exports.AssetCache=e.AssetCache;exports.Chunk=e.Chunk;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetExporter-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetExporter-42qgIOkb.cjs");exports.AssetExporter=e.AssetExporter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetLoader-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/AssetLoader-Bn4R6_rn.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-
|
|
2
|
-
import { D as s, a as t } from "../../chunks/AssetLoader-
|
|
1
|
+
import { A as o } from "../../chunks/AssetLoader-DvbdFdyg.mjs";
|
|
2
|
+
import { D as s, a as t } from "../../chunks/AssetLoader-DvbdFdyg.mjs";
|
|
3
3
|
export {
|
|
4
4
|
o as AssetLoader,
|
|
5
5
|
s as DRACOWorker,
|
|
@@ -2,7 +2,6 @@ import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
|
|
|
2
2
|
export declare class DracoLoader extends DRACOLoader {
|
|
3
3
|
protected decoderPending: Promise<void> | null;
|
|
4
4
|
protected decoderConfig: {
|
|
5
|
-
type: 'js' | 'wasm';
|
|
6
5
|
wasmBinary: ArrayBuffer | null;
|
|
7
6
|
};
|
|
8
7
|
protected workerSourceURL: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var p=Object.defineProperty;var w=(a,e,t)=>e in a?p(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var h=(a,e,t)=>w(a,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("three/webgpu"),y=require("../../chunks/FileTypes-
|
|
1
|
+
"use strict";var p=Object.defineProperty;var w=(a,e,t)=>e in a?p(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var h=(a,e,t)=>w(a,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("three/webgpu"),y=require("../../chunks/FileTypes-DTCnNV95.cjs");require("three/examples/jsm/loaders/HDRLoader.js");class C{constructor(e,t,r){h(this,"_renderer");h(this,"_scene");h(this,"_controller");this._renderer=e,this._scene=t,this._controller=r}async generateMedia(e){const{position:t,target:r,resolution:i}=e,{width:o,height:s}=i,d=this._controller.object.owner.position.clone(),n=this._controller.target.clone(),g=this._renderer.canvas.clientWidth||o,_=this._renderer.canvas.clientHeight||s;try{return this._controller.object.onResize(o,s),this._controller.object.owner.position.copy(t),this._controller.target.copy(r),this._controller.update(),(await this.drawCanvas(void 0,i)).toDataURL()}finally{this._controller.object.owner.position.copy(d),this._controller.target.copy(n),this._controller.update(),this._controller.object.onResize(g,_)}}async drawCanvas(e,t){await this._renderer.initAsync();const r=this._renderer.webgpurenderer,i=Math.max(1,(t==null?void 0:t.width)??(e==null?void 0:e.width)??(e==null?void 0:e.clientWidth)??this._renderer.canvas.clientWidth),o=Math.max(1,(t==null?void 0:t.height)??(e==null?void 0:e.height)??(e==null?void 0:e.clientHeight)??this._renderer.canvas.clientHeight),s=new l.RenderTarget(i,o,{colorSpace:l.SRGBColorSpace}),d=r.getRenderTarget(),n=this._controller.object.camera,g=n.layers.mask;try{r.setRenderTarget(s),n.layers.mask=y.DIVECameraComponent.LIVE_VIEW_LAYER_MASK,r.render(this._scene,n);const _=await r.readRenderTargetPixelsAsync(s,0,0,i,o),c=e??document.createElement("canvas");return c.width=i,c.height=o,this._writePixelsToCanvas(c,_,i,o),c}finally{n.layers.mask=g,r.setRenderTarget(d),s.dispose()}}_writePixelsToCanvas(e,t,r,i){const o=e.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(t))),o.putImageData(s,0,0)}}exports.MediaCreator=C;
|
|
@@ -2,7 +2,7 @@ var l = Object.defineProperty;
|
|
|
2
2
|
var p = (a, t, r) => t in a ? l(a, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[t] = r;
|
|
3
3
|
var h = (a, t, r) => p(a, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
import { RenderTarget as w, SRGBColorSpace as y } from "three/webgpu";
|
|
5
|
-
import { D as C } from "../../chunks/FileTypes-
|
|
5
|
+
import { D as C } from "../../chunks/FileTypes-C8BdyVai.mjs";
|
|
6
6
|
import "three/examples/jsm/loaders/HDRLoader.js";
|
|
7
7
|
class D {
|
|
8
8
|
constructor(t, r, e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../chunks/OrbitController-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../chunks/OrbitController-Cq5Q1m82.cjs");exports.OrbitController=t.OrbitController;exports.OrbitControllerDefaultSettings=t.OrbitControllerDefaultSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _=Object.defineProperty;var c=(t,e,r)=>e in t?_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o=(t,e,r)=>c(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("three/webgpu"),d=require("../../chunks/FileTypes-
|
|
1
|
+
"use strict";var _=Object.defineProperty;var c=(t,e,r)=>e in t?_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o=(t,e,r)=>c(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("three/webgpu"),d=require("../../chunks/FileTypes-DTCnNV95.cjs"),h=require("../../chunks/contributesToBounds-Dmh3K2n5.cjs");require("three/examples/jsm/loaders/HDRLoader.js");const a=require("../../chunks/AxisHelperColors-BrGqktN5.cjs"),x=require("../../chunks/SpriteTextComponent-IYbrESut.cjs"),n=(t,e,r)=>{const i=new d.DIVENode;return i.position.set(r.x,r.y,r.z),i.layers.mask=h.COORDINATE_LAYER_MASK,i.addComponent(new x.SpriteTextComponent).setText(t).setTextHeight(.2).setColor(e),i};class p extends s.Object3D{constructor(){super();o(this,"_axesHelper");this._axesHelper=new s.AxesHelper(.5),this._axesHelper.layers.mask=h.COORDINATE_LAYER_MASK,this._axesHelper.material.depthTest=!1,this._axesHelper.position.set(0,0,-1),this._axesHelper.setColors(new s.Color(a.AxesColorRed),new s.Color(a.AxesColorGreen),new s.Color(a.AxesColorBlue)),this._axesHelper.add(n("X",a.AxesColorRedLetter,{x:.7,y:0,z:0}),n("Y",a.AxesColorGreenLetter,{x:0,y:.7,z:0}),n("Z",a.AxesColorBlueLetter,{x:0,y:0,z:.7})),this.add(this._axesHelper)}setFromCameraMatrix(r){this._axesHelper.rotation.setFromRotationMatrix(new s.Matrix4().extractRotation(r).invert())}}class u{constructor(e,r,i){o(this,"uuid",s.MathUtils.generateUUID());o(this,"_axes");o(this,"_orthographicCamera");o(this,"_restoreViewport",new s.Vector4);this._renderer=e,this._scene=r,this._cameraComponent=i,this._orthographicCamera=new s.OrthographicCamera(-1,1,1,-1,.1,100),this._orthographicCamera.name="OrientationDisplayCamera",this._orthographicCamera.layers.mask=h.COORDINATE_LAYER_MASK,this._scene.add(this._orthographicCamera),this._axes=new p,this._axes.name="OrientationDisplayAxes",this._scene.add(this._axes)}tick(){var l;if(!this._renderer.webgpurenderer.initialized)return;const e=this._scene.background??null,r=this._renderer.webgpurenderer.autoClear;this._scene.background=null,this._renderer.webgpurenderer.getViewport(this._restoreViewport);const i=((l=this._renderer.webgpurenderer.domElement)==null?void 0:l.clientHeight)??this._restoreViewport.w;this._renderer.webgpurenderer.setViewport(0,Math.max(0,i-150),150,150),this._renderer.webgpurenderer.autoClear=!1,this._axes.setFromCameraMatrix(this._cameraComponent.camera.matrixWorld),this._renderer.webgpurenderer.render(this._scene,this._orthographicCamera),this._renderer.webgpurenderer.setViewport(this._restoreViewport),this._renderer.webgpurenderer.autoClear=r,this._scene.background=e}dispose(){this._scene.remove(this._axes),this._scene.remove(this._orthographicCamera)}}exports.OrientationDisplay=u;exports.OrientationDisplayAxes=p;
|
|
@@ -2,11 +2,11 @@ var p = Object.defineProperty;
|
|
|
2
2
|
var _ = (t, e, r) => e in t ? p(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
3
|
var a = (t, e, r) => _(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
4
|
import { Object3D as d, AxesHelper as l, Color as o, Matrix4 as m, OrthographicCamera as c, MathUtils as x, Vector4 as C } from "three/webgpu";
|
|
5
|
-
import { d as u } from "../../chunks/FileTypes-
|
|
6
|
-
import { C as n } from "../../chunks/contributesToBounds-
|
|
5
|
+
import { d as u } from "../../chunks/FileTypes-C8BdyVai.mjs";
|
|
6
|
+
import { C as n } from "../../chunks/contributesToBounds-DK3AK1Lq.mjs";
|
|
7
7
|
import "three/examples/jsm/loaders/HDRLoader.js";
|
|
8
8
|
import { A as w, a as g, b, c as A, d as H, e as y } from "../../chunks/AxisHelperColors-JLBHYQDi.mjs";
|
|
9
|
-
import { S as V } from "../../chunks/SpriteTextComponent-
|
|
9
|
+
import { S as V } from "../../chunks/SpriteTextComponent-JwWMzAKh.mjs";
|
|
10
10
|
const i = (t, e, r) => {
|
|
11
11
|
const s = new u();
|
|
12
12
|
return s.position.set(r.x, r.y, r.z), s.layers.mask = n, s.addComponent(new V()).setText(t).setTextHeight(0.2).setColor(e), s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../chunks/FileTypes-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../chunks/FileTypes-DTCnNV95.cjs");require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");const C=require("../../chunks/ModelComponent-CHIXv2a6.cjs"),S=require("../../chunks/OrbitController-Cq5Q1m82.cjs"),v={...i.DIVEDefaultSettings},w=c=>{i.disposeComponents(c),c.removeFromParent()};async function E(c,l){let s=!1;const e=new i.DIVE({...l,autoStart:!1});try{e.mainView.cameraComponent.owner.position.set(0,1,2);const{clientWidth:u,clientHeight:d}=e.mainView.canvas;u>0&&d>0&&e.mainView.cameraComponent.onResize(u,d);const a=new S.OrbitController(e.mainView.cameraComponent,e.mainView.canvas);e.clock.addTicker(a);let t=null,r=null,m=0,f=Promise.resolve();const b=()=>{const o=t??e.scene.root;new i.BoundingBox().enclose(o).isEmpty||a.focusObject(o)},p=()=>{t&&(w(t),t=null),r&&(r.destroyInstance(),r=null,e.scene.root.nodes.forEach(w))},g=e.disposeAsync.bind(e);e.disposeAsync=async()=>{s=!0,m++,a.dispose(),p(),await g()};const k=async o=>{r&&p(),t||(t=new i.DIVENode,t.name="QuickViewModel",t.addComponent(new C.ModelComponent),e.scene.root.add(t));const n=t;if(await n.requireComponent(C.ModelComponent).setFromURL(o),s){i.disposeComponents(n),n.removeFromParent();return}n.dropIt()},q=async o=>{p();const n=new(await Promise.resolve().then(()=>require("../state/index.cjs"))).State(e,a);if(r=n,await n.performAction("SET_STATE",o),s){n.destroyInstance(),e.scene.root.nodes.forEach(w);return}},y=o=>{const n=++m,h=f.then(()=>{if(!(n!==m||s))return typeof o=="string"?k(o):q(o)});return f=h.then(()=>{},()=>{}),h},V=Object.assign(e,{orbitController:a,load:y});return Object.defineProperties(V,{model:{get:()=>t,enumerable:!0},state:{get:()=>r,enumerable:!0}}),await y(c),b(),((l==null?void 0:l.autoStart)??!0)&&await e.startAsync(),V}catch(u){s=!0;try{await e.disposeAsync()}catch(d){console.error("Failed to clean up a QuickView:",d)}throw u}}exports.QuickView=E;exports.QuickViewDefaultSettings=v;
|