@shopware-ag/dive 3.0.4 → 3.0.6
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-hZPj76ce.cjs +1 -0
- package/build/chunks/AssetCache-kR5gKTDf.mjs +109 -0
- package/build/chunks/{AssetLoader-DRh_mxDJ.mjs → AssetLoader-IE1YVWYL.mjs} +3 -3
- package/build/chunks/{AssetLoader-u2K9n5c0.cjs → AssetLoader-NuQXJfHL.cjs} +1 -1
- package/build/chunks/{FileTypes-DdMaOWay.mjs → FileTypes-DLAWiGQa.mjs} +372 -365
- package/build/chunks/FileTypes-IZ9BrQ2x.cjs +29 -0
- package/build/chunks/{PerspectiveCamera-B5TvUzTa.mjs → PerspectiveCamera-35cBnxwG.mjs} +2 -2
- package/build/chunks/{isFileTypeSupported-BeQj9Us_.mjs → isFileTypeSupported-D7Sy7zU-.mjs} +1 -1
- package/build/chunks/{isFileTypeSupported-AjtLMEgD.cjs → isFileTypeSupported-dgHlqizJ.cjs} +1 -1
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +63 -61
- package/build/engine/Dive.d.ts +4 -1
- package/build/engine/canvas/CanvasLifecycleManager.d.ts +2 -10
- package/build/engine/clock/Clock.d.ts +2 -1
- package/build/engine/environment/Environment.d.ts +2 -2
- package/build/engine/index.d.ts +2 -0
- package/build/engine/promise/abortable/AbortablePromise.d.ts +17 -0
- package/build/engine/promise/deferred/DeferredPromise.d.ts +18 -0
- package/build/engine/renderer/Renderer.d.ts +1 -1
- package/build/engine/view/View.d.ts +2 -4
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +1 -1
- package/build/plugins/assetcache/index.cjs +1 -1
- package/build/plugins/assetcache/index.mjs +1 -1
- package/build/plugins/assetcache/src/chunk/Chunk.d.ts +3 -0
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +2 -2
- package/build/plugins/mediacreator/index.cjs +1 -1
- package/build/plugins/mediacreator/index.mjs +5 -5
- 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 +10 -9
- package/build/plugins/quickview/index.cjs +1 -1
- package/build/plugins/quickview/index.mjs +17 -17
- package/build/plugins/state/index.cjs +1 -1
- package/build/plugins/state/index.mjs +1 -1
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +2 -2
- package/package.json +1 -1
- package/build/chunks/AssetCache-CXEvPmw4.cjs +0 -1
- package/build/chunks/AssetCache-Cx3yjE1M.mjs +0 -81
- package/build/chunks/FileTypes-DR0AEnSo.cjs +0 -29
package/build/dive.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var b=Object.defineProperty;var O=(r,i,e)=>i in r?b(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var n=(r,i,e)=>O(r,typeof i!="symbol"?i+"":i,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./chunks/FileTypes-DR0AEnSo.cjs"),u=require("./chunks/PerspectiveCamera-DwQUmkDv.cjs"),_=require("./chunks/AxisHelperColors-BrGqktN5.cjs"),s=require("three/webgpu"),V=require("./chunks/findInterface-C6mrvf_t.cjs"),y=require("./chunks/isFileTypeSupported-AjtLMEgD.cjs"),w=require("./chunks/network-error-CdDXil5g.cjs"),A=require("./chunks/parse-error-Dy_EE4rL.cjs"),x=require("./chunks/PovSchema-Co9FznEz.cjs");class m extends s.Object3D{constructor(e,t,o,h,a){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVERadialHandle",this.axis=e,this._color.set(a),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1;const l=new s.TorusGeometry(t,.01,13,48,o);this._lineMaterial=new s.MeshBasicMaterial({color:a,depthTest:!1,depthWrite:!1});const d=new s.Mesh(l,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,this.add(d);const g=new s.TorusGeometry(t,.1,3,48,o),E=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(g,E),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this.add(this._colliderMesh),this.lookAt(h)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}function p(r,i){const e=(r+"e").split("e");return+(e[0]+"e"+(+e[1]+(i||0)))}function R(r,i=0){const e=p(r,+i);return p(Math.ceil(e),-i)}function v(r,i=0){const e=p(r,+i);return p(Math.floor(e),-i)}function P(r,i=0){if(r<0)return-P(-r,i);const e=p(r,+i);return p(Math.round(e),-i)}function H(r,i,e){return Math.atan2(r.clone().cross(i).dot(e),i.clone().dot(r))}function G(r,i=0){const e=p(r,+i);return p(Math.round(e),-i).toFixed(i)}function z(r,i=0){const e=p(r,+i);return p(Math.trunc(e),-i)}function L(r){return(s.MathUtils.radToDeg(r)+360)%360}function C(r){return s.MathUtils.degToRad(r)}const S={ceilExp:R,floorExp:v,roundExp:P,toFixedExp:G,truncateExp:z,signedAngleTo:H,radToDeg:L,degToRad:C};class Y extends s.Object3D{constructor(e){super();n(this,"children");n(this,"_controller");n(this,"_startRot");this.name="DIVERotateGizmo",this.children=[],this._startRot=null,this._controller=e,this.add(new m("x",1,Math.PI/2,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new m("y",1,-Math.PI/2,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new m("z",1,Math.PI/2,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startRot||this.parent&&this.parent.parent&&(this.parent.parent.onHover("rotate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startRot=t.rotation.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startRot||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragCurrent.clone().sub(this.parent.parent.position).normalize(),h=t.dragStart.clone().sub(this.parent.parent.position).normalize(),a=S.signedAngleTo(h,o,e.forwardVector),l=new s.Euler(this._startRot.x+e.forwardVector.x*a,this._startRot.y+e.forwardVector.y*a,this._startRot.z+e.forwardVector.z*a);this.parent.parent.onChange(void 0,l)}onHandleDragEnd(e){this._startRot=null,this.handleHighlight(e.axis,!1,!1)}}class D extends s.Object3D{constructor(e,t,o,h){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVEAxisHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._highlight=!1,this._hovered=!1;const a=new s.CylinderGeometry(.01,.01,t,13);this._lineMaterial=new s.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const l=new s.Mesh(a,this._lineMaterial);l.layers.mask=u.UI_LAYER_MASK,l.renderOrder=1/0,l.rotateX(Math.PI/2),l.translateY(t/2),this.add(l);const d=new s.CylinderGeometry(.1,.1,t,3),g=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(d,g),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}class T extends s.Object3D{constructor(e){super();n(this,"_controller");n(this,"children");n(this,"_startPos");this.name="DIVETranslateGizmo",this.children=[],this._startPos=null,this._controller=e,this.add(new D("x",1,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new D("y",1,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new D("z",1,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startPos||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startPos=t.position.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startPos||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(this._startPos.clone().add(o))}onHandleDragEnd(e){this._startPos=null,this.handleHighlight(e.axis,!1,!1)}}class M extends s.Object3D{constructor(e,t,o,h,a=.05){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");n(this,"_box");n(this,"_boxSize");this.name="DIVEScaleHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1,this._boxSize=a;const l=new s.CylinderGeometry(.01,.01,t-a/2,13);this._lineMaterial=new s.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const d=new s.Mesh(l,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,d.rotateX(Math.PI/2),d.translateY(t/2-a/4),this.add(d),this._box=new s.Mesh(new s.BoxGeometry(a,a,a),this._lineMaterial),this._box.layers.mask=u.UI_LAYER_MASK,this._box.renderOrder=1/0,this._box.rotateX(Math.PI/2),this._box.translateY(t-a/2),this._box.rotateZ(o.x*Math.PI/2),this._box.rotateX(o.z*Math.PI/2),this.add(this._box);const g=new s.CylinderGeometry(.1,.1,t+a/2,3),E=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(g,E),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}update(e){this._box.scale.copy(new s.Vector3(1,1,1).sub(this.forwardVector).add(e.clone().multiply(this.forwardVector)))}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHoverAxis(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHoverAxis(this,!1)}onDragStart(){this.parent&&this.parent.onAxisDragStart(this)}onDrag(e){this.parent&&this.parent.onAxisDrag(this,e)}onDragEnd(){this.parent&&this.parent.onAxisDragEnd(this)}}class j extends s.Object3D{constructor(e){super();n(this,"isHoverable",!0);n(this,"children");n(this,"_controller");n(this,"_startScale");this.name="DIVEScaleGizmo",this.children=[],this._startScale=null,this._controller=e,this.add(new M("x",1,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new M("y",1,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new M("z",1,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}update(e){this.children.forEach(t=>{t.update(e)})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHoverAxis(e,t){this._startScale||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onAxisDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startScale=t.scale.clone(),this.handleHighlight(e.axis,!0,!0))}onAxisDrag(e,t){if(!this._startScale||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(void 0,void 0,this._startScale.clone().add(o))}onAxisDragEnd(e){this._startScale=null,this.handleHighlight(e.axis,!1,!1)}}class N extends s.Object3D{constructor(){super();n(this,"_meshX");n(this,"_meshY");n(this,"_meshZ");this.name="DIVEGizmoPlane";const e=new s.MeshBasicMaterial({transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1,side:2}),t=new s.PlaneGeometry(100,100,2,2),o=e.clone();o.color.set(16711680),this._meshX=new s.Mesh(t,o),this._meshX.layers.mask=u.UI_LAYER_MASK,this._meshX.rotateY(Math.PI/2);const h=new s.PlaneGeometry(100,100,2,2),a=e.clone();a.color.set(65280),this._meshY=new s.Mesh(h,a),this._meshY.layers.mask=u.UI_LAYER_MASK,this._meshY.rotateX(-Math.PI/2);const l=new s.PlaneGeometry(100,100,2,2),d=e.clone();d.color.set(255),this._meshZ=new s.Mesh(l,d),this._meshZ.layers.mask=u.UI_LAYER_MASK}get XPlane(){return this._meshX}get YPlane(){return this._meshY}get ZPlane(){return this._meshZ}assemble(e,t){if(this.clear(),e==="translate"||e==="scale")switch(t){case"x":this.add(this._meshY),this.add(this._meshZ);break;case"y":this.add(this._meshX),this.add(this._meshZ);break;case"z":this.add(this._meshX),this.add(this._meshY);break}else if(e==="rotate")switch(t){case"x":this.add(this._meshX);break;case"y":this.add(this._meshY);break;case"z":this.add(this._meshZ);break}}}class F extends s.Object3D{constructor(e){super();n(this,"_mode");n(this,"_gizmoNode");n(this,"_translateGizmo");n(this,"_rotateGizmo");n(this,"_scaleGizmo");n(this,"_gizmoPlane");n(this,"_object");this.name="DIVEGizmo",e.addEventListener("change",()=>{const t=e.getDistance()/2.5;this.scale.set(t,t,t)}),this._mode="translate",this._gizmoNode=new s.Object3D,this.add(this._gizmoNode),this._translateGizmo=new T(e),this._rotateGizmo=new Y(e),this._scaleGizmo=new j(e),this._gizmoPlane=new N,this._gizmoPlane.visible=!1,this._object=null}get mode(){return this._mode}set mode(e){this._mode=e,this.assemble()}set debug(e){this._translateGizmo.debug=e,this._rotateGizmo.debug=e,this._scaleGizmo.debug=e}get gizmoNode(){return this._gizmoNode}get gizmoPlane(){return this._gizmoPlane}get object(){return this._object}attach(e){return this._object=e,this.assemble(),this}detach(){return this._object=null,this.assemble(),this}onHover(e,t,o){o&&this._gizmoPlane.assemble(e,t)}onChange(e,t,o){this.object!==null&&(e&&(this.position.copy(e),this.object.position.copy(e)),t&&this.object.rotation.copy(t),o&&(this.object.scale.copy(o),this._scaleGizmo.update(o)))}assemble(){this._gizmoNode.clear(),this._gizmoPlane.clear(),this._translateGizmo.reset(),this._rotateGizmo.reset(),this._scaleGizmo.reset(),this.object!==null&&(this._mode==="translate"&&this._gizmoNode.add(this._translateGizmo),this._mode==="rotate"&&this._gizmoNode.add(this._rotateGizmo),this._mode==="scale"&&this._gizmoNode.add(this._scaleGizmo),this.add(this._gizmoPlane))}}class U{constructor(){n(this,"isMovable",!0)}}class K{constructor(){n(this,"isSelectable",!0)}}function X(r,i){return i.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(o=>{if(o==="constructor")return;const h=Object.getOwnPropertyDescriptor(e.prototype,o);Object.defineProperty(r.prototype,o,h)});const t=new e;Object.getOwnPropertyNames(t).forEach(o=>{const h=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(r.prototype,o,h)})}),r}function f(r,i=new WeakMap){if(r===null||typeof r!="object")return r;if(i.has(r))return i.get(r);if(r instanceof Date)return new Date(r.getTime());if(r instanceof RegExp)return new RegExp(r.source,r.flags);if(Array.isArray(r)){const a=[];i.set(r,a);for(let l=0;l<r.length;l++)a[l]=f(r[l],i);return a}if(r instanceof Map){const a=new Map;i.set(r,a);for(const[l,d]of r)a.set(f(l,i),f(d,i));return a}if(r instanceof Set){const a=new Set;i.set(r,a);for(const l of r)a.add(f(l,i));return a}const e=r;if(typeof e.clone=="function"){const a=e.clone();return i.set(r,a),a}const t=Object.create(Object.getPrototypeOf(r));i.set(r,t);const o=Object.getOwnPropertyNames(r);for(const a of o){const l=Object.getOwnPropertyDescriptor(r,a);if(l)if(l.value!==void 0){const d=f(l.value,i);Object.defineProperty(t,a,{...l,value:d})}else Object.defineProperty(t,a,l)}const h=Object.getOwnPropertySymbols(r);for(const a of h){const l=Object.getOwnPropertyDescriptor(r,a);if(l)if(l.value!==void 0){const d=f(l.value,i);Object.defineProperty(t,a,{...l,value:d})}else Object.defineProperty(t,a,l)}return t}const I=(r,i)=>{if(Object.keys(r).length===0&&Object.keys(i).length===0)return{};if(typeof r!="object"||typeof i!="object")return i;let e={};return Object.keys(i).forEach(t=>{if(!Object.keys(r).includes(t)){e={...e,[t]:i[t]};return}if(Array.isArray(i[t])){if(!Array.isArray(r[t])){e={...e,[t]:i[t]};return}const o=r[t],h=i[t];if(o.length===0&&h.length===0){e={...e};return}if(o.length!==h.length){e={...e,[t]:i[t]};return}const a=[];if(h.forEach((l,d)=>{const g=I(o[d],h[d]);Object.keys(g).length&&a.push(h[d])}),Object.keys(a).length){e={...e,[t]:a};return}return}if(typeof i[t]=="object"){if(typeof r[t]!="object"){e={...e,[t]:i[t]};return}const o=I(r[t],i[t]);if(Object.keys(o).length){e={...e,[t]:o};return}}r[t]!==i[t]&&(e={...e,[t]:i[t]})}),e};function q(r){return r.entityType==="group"}function B(r){return r.entityType==="light"}function Z(r){return r.entityType==="primitive"}exports.BoundingBox=c.BoundingBox;exports.DIVE=c.DIVE;exports.DIVEAmbientLight=c.DIVEAmbientLight;exports.DIVECanvasLifecycleManager=c.DIVECanvasLifecycleManager;exports.DIVEClock=c.DIVEClock;exports.DIVEDefaultSettings=c.DIVEDefaultSettings;exports.DIVEEnvironment=c.DIVEEnvironment;exports.DIVEEnvironmentDefaultSettings=c.DIVEEnvironmentDefaultSettings;exports.DIVEFloor=c.DIVEFloor;exports.DIVEGrid=c.DIVEGrid;exports.DIVEGroup=c.DIVEGroup;exports.DIVEModel=c.DIVEModel;exports.DIVENode=c.DIVENode;exports.DIVEPointLight=c.DIVEPointLight;exports.DIVEPrimitive=c.DIVEPrimitive;exports.DIVERenderer=c.DIVERenderer;exports.DIVERendererDefaultSettings=c.DIVERendererDefaultSettings;exports.DIVERoot=c.DIVERoot;exports.DIVEScene=c.DIVEScene;exports.DIVESceneDefaultSettings=c.DIVESceneDefaultSettings;exports.DIVESceneLight=c.DIVESceneLight;exports.DIVEView=c.DIVEView;exports.FILE_TYPES=c.FILE_TYPES;exports.GRID_MAJOR_LINE_COLOR=c.GRID_MAJOR_LINE_COLOR;exports.GRID_MINOR_LINE_COLOR=c.GRID_MINOR_LINE_COLOR;exports.SUPPORTED_FILE_TYPES=c.SUPPORTED_FILE_TYPES;exports.findSceneRecursive=c.findSceneRecursive;exports.COORDINATE_LAYER_MASK=u.COORDINATE_LAYER_MASK;exports.DEFAULT_LAYER_MASK=u.DEFAULT_LAYER_MASK;exports.DIVEPerspectiveCamera=u.DIVEPerspectiveCamera;exports.DIVEPerspectiveCameraDefaultSettings=u.DIVEPerspectiveCameraDefaultSettings;exports.HELPER_LAYER_MASK=u.HELPER_LAYER_MASK;exports.PRODUCT_LAYER_MASK=u.PRODUCT_LAYER_MASK;exports.UI_LAYER_MASK=u.UI_LAYER_MASK;exports.AxesColorBlue=_.AxesColorBlue;exports.AxesColorBlueLetter=_.AxesColorBlueLetter;exports.AxesColorGreen=_.AxesColorGreen;exports.AxesColorGreenLetter=_.AxesColorGreenLetter;exports.AxesColorRed=_.AxesColorRed;exports.AxesColorRedLetter=_.AxesColorRedLetter;exports.findInterface=V.findInterface;exports.implementsInterface=V.implementsInterface;exports.getFileTypeFromUri=y.getFileTypeFromUri;exports.isFileTypeSupported=y.isFileTypeSupported;exports.FileContentError=w.FileContentError;exports.NetworkError=w.NetworkError;exports.FileTypeError=A.FileTypeError;exports.ParseError=A.ParseError;exports.isModelSchema=x.isModelSchema;exports.isPovSchema=x.isPovSchema;exports.DIVEGizmo=F;exports.DIVEMath=S;exports.DIVEMovable=U;exports.DIVESelectable=K;exports.applyMixins=X;exports.deepClone=f;exports.getObjectDelta=I;exports.isGroupSchema=q;exports.isLightSchema=B;exports.isPrimitiveSchema=Z;
|
|
1
|
+
"use strict";var b=Object.defineProperty;var O=(r,i,e)=>i in r?b(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var n=(r,i,e)=>O(r,typeof i!="symbol"?i+"":i,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./chunks/FileTypes-IZ9BrQ2x.cjs"),u=require("./chunks/PerspectiveCamera-DwQUmkDv.cjs"),_=require("./chunks/AxisHelperColors-BrGqktN5.cjs"),s=require("three/webgpu"),V=require("./chunks/findInterface-C6mrvf_t.cjs"),y=require("./chunks/isFileTypeSupported-dgHlqizJ.cjs"),w=require("./chunks/network-error-CdDXil5g.cjs"),A=require("./chunks/parse-error-Dy_EE4rL.cjs"),P=require("./chunks/PovSchema-Co9FznEz.cjs");class m extends s.Object3D{constructor(e,t,o,h,a){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVERadialHandle",this.axis=e,this._color.set(a),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1;const l=new s.TorusGeometry(t,.01,13,48,o);this._lineMaterial=new s.MeshBasicMaterial({color:a,depthTest:!1,depthWrite:!1});const d=new s.Mesh(l,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,this.add(d);const g=new s.TorusGeometry(t,.1,3,48,o),E=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(g,E),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this.add(this._colliderMesh),this.lookAt(h)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}function p(r,i){const e=(r+"e").split("e");return+(e[0]+"e"+(+e[1]+(i||0)))}function R(r,i=0){const e=p(r,+i);return p(Math.ceil(e),-i)}function v(r,i=0){const e=p(r,+i);return p(Math.floor(e),-i)}function x(r,i=0){if(r<0)return-x(-r,i);const e=p(r,+i);return p(Math.round(e),-i)}function H(r,i,e){return Math.atan2(r.clone().cross(i).dot(e),i.clone().dot(r))}function G(r,i=0){const e=p(r,+i);return p(Math.round(e),-i).toFixed(i)}function z(r,i=0){const e=p(r,+i);return p(Math.trunc(e),-i)}function L(r){return(s.MathUtils.radToDeg(r)+360)%360}function C(r){return s.MathUtils.degToRad(r)}const S={ceilExp:R,floorExp:v,roundExp:x,toFixedExp:G,truncateExp:z,signedAngleTo:H,radToDeg:L,degToRad:C};class Y extends s.Object3D{constructor(e){super();n(this,"children");n(this,"_controller");n(this,"_startRot");this.name="DIVERotateGizmo",this.children=[],this._startRot=null,this._controller=e,this.add(new m("x",1,Math.PI/2,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new m("y",1,-Math.PI/2,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new m("z",1,Math.PI/2,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startRot||this.parent&&this.parent.parent&&(this.parent.parent.onHover("rotate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startRot=t.rotation.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startRot||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragCurrent.clone().sub(this.parent.parent.position).normalize(),h=t.dragStart.clone().sub(this.parent.parent.position).normalize(),a=S.signedAngleTo(h,o,e.forwardVector),l=new s.Euler(this._startRot.x+e.forwardVector.x*a,this._startRot.y+e.forwardVector.y*a,this._startRot.z+e.forwardVector.z*a);this.parent.parent.onChange(void 0,l)}onHandleDragEnd(e){this._startRot=null,this.handleHighlight(e.axis,!1,!1)}}class D extends s.Object3D{constructor(e,t,o,h){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVEAxisHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._highlight=!1,this._hovered=!1;const a=new s.CylinderGeometry(.01,.01,t,13);this._lineMaterial=new s.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const l=new s.Mesh(a,this._lineMaterial);l.layers.mask=u.UI_LAYER_MASK,l.renderOrder=1/0,l.rotateX(Math.PI/2),l.translateY(t/2),this.add(l);const d=new s.CylinderGeometry(.1,.1,t,3),g=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(d,g),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}class T extends s.Object3D{constructor(e){super();n(this,"_controller");n(this,"children");n(this,"_startPos");this.name="DIVETranslateGizmo",this.children=[],this._startPos=null,this._controller=e,this.add(new D("x",1,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new D("y",1,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new D("z",1,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startPos||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startPos=t.position.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startPos||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(this._startPos.clone().add(o))}onHandleDragEnd(e){this._startPos=null,this.handleHighlight(e.axis,!1,!1)}}class M extends s.Object3D{constructor(e,t,o,h,a=.05){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");n(this,"_box");n(this,"_boxSize");this.name="DIVEScaleHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1,this._boxSize=a;const l=new s.CylinderGeometry(.01,.01,t-a/2,13);this._lineMaterial=new s.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const d=new s.Mesh(l,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,d.rotateX(Math.PI/2),d.translateY(t/2-a/4),this.add(d),this._box=new s.Mesh(new s.BoxGeometry(a,a,a),this._lineMaterial),this._box.layers.mask=u.UI_LAYER_MASK,this._box.renderOrder=1/0,this._box.rotateX(Math.PI/2),this._box.translateY(t-a/2),this._box.rotateZ(o.x*Math.PI/2),this._box.rotateX(o.z*Math.PI/2),this.add(this._box);const g=new s.CylinderGeometry(.1,.1,t+a/2,3),E=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(g,E),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}update(e){this._box.scale.copy(new s.Vector3(1,1,1).sub(this.forwardVector).add(e.clone().multiply(this.forwardVector)))}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHoverAxis(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHoverAxis(this,!1)}onDragStart(){this.parent&&this.parent.onAxisDragStart(this)}onDrag(e){this.parent&&this.parent.onAxisDrag(this,e)}onDragEnd(){this.parent&&this.parent.onAxisDragEnd(this)}}class j extends s.Object3D{constructor(e){super();n(this,"isHoverable",!0);n(this,"children");n(this,"_controller");n(this,"_startScale");this.name="DIVEScaleGizmo",this.children=[],this._startScale=null,this._controller=e,this.add(new M("x",1,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new M("y",1,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new M("z",1,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}update(e){this.children.forEach(t=>{t.update(e)})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHoverAxis(e,t){this._startScale||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onAxisDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startScale=t.scale.clone(),this.handleHighlight(e.axis,!0,!0))}onAxisDrag(e,t){if(!this._startScale||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(void 0,void 0,this._startScale.clone().add(o))}onAxisDragEnd(e){this._startScale=null,this.handleHighlight(e.axis,!1,!1)}}class N extends s.Object3D{constructor(){super();n(this,"_meshX");n(this,"_meshY");n(this,"_meshZ");this.name="DIVEGizmoPlane";const e=new s.MeshBasicMaterial({transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1,side:2}),t=new s.PlaneGeometry(100,100,2,2),o=e.clone();o.color.set(16711680),this._meshX=new s.Mesh(t,o),this._meshX.layers.mask=u.UI_LAYER_MASK,this._meshX.rotateY(Math.PI/2);const h=new s.PlaneGeometry(100,100,2,2),a=e.clone();a.color.set(65280),this._meshY=new s.Mesh(h,a),this._meshY.layers.mask=u.UI_LAYER_MASK,this._meshY.rotateX(-Math.PI/2);const l=new s.PlaneGeometry(100,100,2,2),d=e.clone();d.color.set(255),this._meshZ=new s.Mesh(l,d),this._meshZ.layers.mask=u.UI_LAYER_MASK}get XPlane(){return this._meshX}get YPlane(){return this._meshY}get ZPlane(){return this._meshZ}assemble(e,t){if(this.clear(),e==="translate"||e==="scale")switch(t){case"x":this.add(this._meshY),this.add(this._meshZ);break;case"y":this.add(this._meshX),this.add(this._meshZ);break;case"z":this.add(this._meshX),this.add(this._meshY);break}else if(e==="rotate")switch(t){case"x":this.add(this._meshX);break;case"y":this.add(this._meshY);break;case"z":this.add(this._meshZ);break}}}class F extends s.Object3D{constructor(e){super();n(this,"_mode");n(this,"_gizmoNode");n(this,"_translateGizmo");n(this,"_rotateGizmo");n(this,"_scaleGizmo");n(this,"_gizmoPlane");n(this,"_object");this.name="DIVEGizmo",e.addEventListener("change",()=>{const t=e.getDistance()/2.5;this.scale.set(t,t,t)}),this._mode="translate",this._gizmoNode=new s.Object3D,this.add(this._gizmoNode),this._translateGizmo=new T(e),this._rotateGizmo=new Y(e),this._scaleGizmo=new j(e),this._gizmoPlane=new N,this._gizmoPlane.visible=!1,this._object=null}get mode(){return this._mode}set mode(e){this._mode=e,this.assemble()}set debug(e){this._translateGizmo.debug=e,this._rotateGizmo.debug=e,this._scaleGizmo.debug=e}get gizmoNode(){return this._gizmoNode}get gizmoPlane(){return this._gizmoPlane}get object(){return this._object}attach(e){return this._object=e,this.assemble(),this}detach(){return this._object=null,this.assemble(),this}onHover(e,t,o){o&&this._gizmoPlane.assemble(e,t)}onChange(e,t,o){this.object!==null&&(e&&(this.position.copy(e),this.object.position.copy(e)),t&&this.object.rotation.copy(t),o&&(this.object.scale.copy(o),this._scaleGizmo.update(o)))}assemble(){this._gizmoNode.clear(),this._gizmoPlane.clear(),this._translateGizmo.reset(),this._rotateGizmo.reset(),this._scaleGizmo.reset(),this.object!==null&&(this._mode==="translate"&&this._gizmoNode.add(this._translateGizmo),this._mode==="rotate"&&this._gizmoNode.add(this._rotateGizmo),this._mode==="scale"&&this._gizmoNode.add(this._scaleGizmo),this.add(this._gizmoPlane))}}class U{constructor(){n(this,"isMovable",!0)}}class K{constructor(){n(this,"isSelectable",!0)}}function X(r,i){return i.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(o=>{if(o==="constructor")return;const h=Object.getOwnPropertyDescriptor(e.prototype,o);Object.defineProperty(r.prototype,o,h)});const t=new e;Object.getOwnPropertyNames(t).forEach(o=>{const h=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(r.prototype,o,h)})}),r}function f(r,i=new WeakMap){if(r===null||typeof r!="object")return r;if(i.has(r))return i.get(r);if(r instanceof Date)return new Date(r.getTime());if(r instanceof RegExp)return new RegExp(r.source,r.flags);if(Array.isArray(r)){const a=[];i.set(r,a);for(let l=0;l<r.length;l++)a[l]=f(r[l],i);return a}if(r instanceof Map){const a=new Map;i.set(r,a);for(const[l,d]of r)a.set(f(l,i),f(d,i));return a}if(r instanceof Set){const a=new Set;i.set(r,a);for(const l of r)a.add(f(l,i));return a}const e=r;if(typeof e.clone=="function"){const a=e.clone();return i.set(r,a),a}const t=Object.create(Object.getPrototypeOf(r));i.set(r,t);const o=Object.getOwnPropertyNames(r);for(const a of o){const l=Object.getOwnPropertyDescriptor(r,a);if(l)if(l.value!==void 0){const d=f(l.value,i);Object.defineProperty(t,a,{...l,value:d})}else Object.defineProperty(t,a,l)}const h=Object.getOwnPropertySymbols(r);for(const a of h){const l=Object.getOwnPropertyDescriptor(r,a);if(l)if(l.value!==void 0){const d=f(l.value,i);Object.defineProperty(t,a,{...l,value:d})}else Object.defineProperty(t,a,l)}return t}const I=(r,i)=>{if(Object.keys(r).length===0&&Object.keys(i).length===0)return{};if(typeof r!="object"||typeof i!="object")return i;let e={};return Object.keys(i).forEach(t=>{if(!Object.keys(r).includes(t)){e={...e,[t]:i[t]};return}if(Array.isArray(i[t])){if(!Array.isArray(r[t])){e={...e,[t]:i[t]};return}const o=r[t],h=i[t];if(o.length===0&&h.length===0){e={...e};return}if(o.length!==h.length){e={...e,[t]:i[t]};return}const a=[];if(h.forEach((l,d)=>{const g=I(o[d],h[d]);Object.keys(g).length&&a.push(h[d])}),Object.keys(a).length){e={...e,[t]:a};return}return}if(typeof i[t]=="object"){if(typeof r[t]!="object"){e={...e,[t]:i[t]};return}const o=I(r[t],i[t]);if(Object.keys(o).length){e={...e,[t]:o};return}}r[t]!==i[t]&&(e={...e,[t]:i[t]})}),e};function q(r){return r.entityType==="group"}function B(r){return r.entityType==="light"}function Z(r){return r.entityType==="primitive"}exports.BoundingBox=c.BoundingBox;exports.DIVE=c.DIVE;exports.DIVEAbortablePromise=c.DIVEAbortablePromise;exports.DIVEAmbientLight=c.DIVEAmbientLight;exports.DIVECanvasLifecycleManager=c.DIVECanvasLifecycleManager;exports.DIVEClock=c.DIVEClock;exports.DIVEDefaultSettings=c.DIVEDefaultSettings;exports.DIVEDeferredPromise=c.DIVEDeferredPromise;exports.DIVEEnvironment=c.DIVEEnvironment;exports.DIVEEnvironmentDefaultSettings=c.DIVEEnvironmentDefaultSettings;exports.DIVEFloor=c.DIVEFloor;exports.DIVEGrid=c.DIVEGrid;exports.DIVEGroup=c.DIVEGroup;exports.DIVEModel=c.DIVEModel;exports.DIVENode=c.DIVENode;exports.DIVEPointLight=c.DIVEPointLight;exports.DIVEPrimitive=c.DIVEPrimitive;exports.DIVERenderer=c.DIVERenderer;exports.DIVERendererDefaultSettings=c.DIVERendererDefaultSettings;exports.DIVERoot=c.DIVERoot;exports.DIVEScene=c.DIVEScene;exports.DIVESceneDefaultSettings=c.DIVESceneDefaultSettings;exports.DIVESceneLight=c.DIVESceneLight;exports.DIVEView=c.DIVEView;exports.FILE_TYPES=c.FILE_TYPES;exports.GRID_MAJOR_LINE_COLOR=c.GRID_MAJOR_LINE_COLOR;exports.GRID_MINOR_LINE_COLOR=c.GRID_MINOR_LINE_COLOR;exports.SUPPORTED_FILE_TYPES=c.SUPPORTED_FILE_TYPES;exports.findSceneRecursive=c.findSceneRecursive;exports.COORDINATE_LAYER_MASK=u.COORDINATE_LAYER_MASK;exports.DEFAULT_LAYER_MASK=u.DEFAULT_LAYER_MASK;exports.DIVEPerspectiveCamera=u.DIVEPerspectiveCamera;exports.DIVEPerspectiveCameraDefaultSettings=u.DIVEPerspectiveCameraDefaultSettings;exports.HELPER_LAYER_MASK=u.HELPER_LAYER_MASK;exports.PRODUCT_LAYER_MASK=u.PRODUCT_LAYER_MASK;exports.UI_LAYER_MASK=u.UI_LAYER_MASK;exports.AxesColorBlue=_.AxesColorBlue;exports.AxesColorBlueLetter=_.AxesColorBlueLetter;exports.AxesColorGreen=_.AxesColorGreen;exports.AxesColorGreenLetter=_.AxesColorGreenLetter;exports.AxesColorRed=_.AxesColorRed;exports.AxesColorRedLetter=_.AxesColorRedLetter;exports.findInterface=V.findInterface;exports.implementsInterface=V.implementsInterface;exports.getFileTypeFromUri=y.getFileTypeFromUri;exports.isFileTypeSupported=y.isFileTypeSupported;exports.FileContentError=w.FileContentError;exports.NetworkError=w.NetworkError;exports.FileTypeError=A.FileTypeError;exports.ParseError=A.ParseError;exports.isModelSchema=P.isModelSchema;exports.isPovSchema=P.isPovSchema;exports.DIVEGizmo=F;exports.DIVEMath=S;exports.DIVEMovable=U;exports.DIVESelectable=K;exports.applyMixins=X;exports.deepClone=f;exports.getObjectDelta=I;exports.isGroupSchema=q;exports.isLightSchema=B;exports.isPrimitiveSchema=Z;
|
package/build/dive.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
var S = Object.defineProperty;
|
|
2
2
|
var A = (r, s, t) => s in r ? S(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
3
3
|
var i = (r, s, t) => A(r, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
-
import { B as ot, b as ht, d as lt, e as ct, f as dt,
|
|
5
|
-
import { U as d } from "./chunks/PerspectiveCamera-
|
|
6
|
-
import { C as
|
|
4
|
+
import { B as ot, b as ht, d as lt, e as ct, f as dt, g as pt, D as ut, h as ft, i as _t, j as gt, k as mt, l as Dt, m as Et, c as yt, n as wt, o as Mt, p as xt, q as It, r as Pt, s as Vt, t as bt, u as Ht, v as vt, w as zt, F as Ot, G as St, x as At, S as Gt, y as Rt } from "./chunks/FileTypes-DLAWiGQa.mjs";
|
|
5
|
+
import { U as d } from "./chunks/PerspectiveCamera-35cBnxwG.mjs";
|
|
6
|
+
import { C as Yt, a as jt, D as Lt, b as Ct, H as Nt, P as Xt } from "./chunks/PerspectiveCamera-35cBnxwG.mjs";
|
|
7
7
|
import { A as I, a as P, b as V } from "./chunks/AxisHelperColors-JLBHYQDi.mjs";
|
|
8
|
-
import { e as
|
|
9
|
-
import { Object3D as f, Color as b, Vector3 as c, TorusGeometry as H, MeshBasicMaterial as g, Mesh as p, MathUtils as z, Euler as G, CylinderGeometry as D, BoxGeometry as R, PlaneGeometry as
|
|
10
|
-
import { f as
|
|
11
|
-
import { g as
|
|
12
|
-
import { F as
|
|
13
|
-
import { F as
|
|
14
|
-
import { i as
|
|
15
|
-
class
|
|
8
|
+
import { e as Zt, d as qt, c as Qt } from "./chunks/AxisHelperColors-JLBHYQDi.mjs";
|
|
9
|
+
import { Object3D as f, Color as b, Vector3 as c, TorusGeometry as H, MeshBasicMaterial as g, Mesh as p, MathUtils as z, Euler as G, CylinderGeometry as D, BoxGeometry as R, PlaneGeometry as y } from "three/webgpu";
|
|
10
|
+
import { f as kt, i as Ut } from "./chunks/findInterface-DbJ5qzbc.mjs";
|
|
11
|
+
import { g as Kt, i as Jt } from "./chunks/isFileTypeSupported-D7Sy7zU-.mjs";
|
|
12
|
+
import { F as te, N as ee } from "./chunks/network-error-BONfHWQq.mjs";
|
|
13
|
+
import { F as se, P as ie } from "./chunks/parse-error-DfOPyLWM.mjs";
|
|
14
|
+
import { i as ae, a as oe } from "./chunks/PovSchema-DWWvr_ED.mjs";
|
|
15
|
+
class w extends f {
|
|
16
16
|
constructor(t, e, n, o, a) {
|
|
17
17
|
super();
|
|
18
18
|
i(this, "isHoverable", !0);
|
|
@@ -134,7 +134,7 @@ class Z extends f {
|
|
|
134
134
|
i(this, "_controller");
|
|
135
135
|
i(this, "_startRot");
|
|
136
136
|
this.name = "DIVERotateGizmo", this.children = [], this._startRot = null, this._controller = t, this.add(
|
|
137
|
-
new
|
|
137
|
+
new w(
|
|
138
138
|
"x",
|
|
139
139
|
1,
|
|
140
140
|
Math.PI / 2,
|
|
@@ -142,7 +142,7 @@ class Z extends f {
|
|
|
142
142
|
I
|
|
143
143
|
)
|
|
144
144
|
), this.add(
|
|
145
|
-
new
|
|
145
|
+
new w(
|
|
146
146
|
"y",
|
|
147
147
|
1,
|
|
148
148
|
-Math.PI / 2,
|
|
@@ -150,7 +150,7 @@ class Z extends f {
|
|
|
150
150
|
P
|
|
151
151
|
)
|
|
152
152
|
), this.add(
|
|
153
|
-
new
|
|
153
|
+
new w(
|
|
154
154
|
"z",
|
|
155
155
|
1,
|
|
156
156
|
Math.PI / 2,
|
|
@@ -484,11 +484,11 @@ class W extends f {
|
|
|
484
484
|
depthTest: !1,
|
|
485
485
|
depthWrite: !1,
|
|
486
486
|
side: 2
|
|
487
|
-
}), e = new
|
|
487
|
+
}), e = new y(100, 100, 2, 2), n = t.clone();
|
|
488
488
|
n.color.set(16711680), this._meshX = new p(e, n), this._meshX.layers.mask = d, this._meshX.rotateY(Math.PI / 2);
|
|
489
|
-
const o = new
|
|
489
|
+
const o = new y(100, 100, 2, 2), a = t.clone();
|
|
490
490
|
a.color.set(65280), this._meshY = new p(o, a), this._meshY.layers.mask = d, this._meshY.rotateX(-Math.PI / 2);
|
|
491
|
-
const h = new
|
|
491
|
+
const h = new y(100, 100, 2, 2), l = t.clone();
|
|
492
492
|
l.color.set(255), this._meshZ = new p(h, l), this._meshZ.layers.mask = d;
|
|
493
493
|
}
|
|
494
494
|
get XPlane() {
|
|
@@ -742,63 +742,65 @@ function it(r) {
|
|
|
742
742
|
}
|
|
743
743
|
export {
|
|
744
744
|
V as AxesColorBlue,
|
|
745
|
-
|
|
745
|
+
Zt as AxesColorBlueLetter,
|
|
746
746
|
P as AxesColorGreen,
|
|
747
|
-
|
|
747
|
+
qt as AxesColorGreenLetter,
|
|
748
748
|
I as AxesColorRed,
|
|
749
|
-
|
|
749
|
+
Qt as AxesColorRedLetter,
|
|
750
750
|
ot as BoundingBox,
|
|
751
|
-
|
|
752
|
-
|
|
751
|
+
Yt as COORDINATE_LAYER_MASK,
|
|
752
|
+
jt as DEFAULT_LAYER_MASK,
|
|
753
753
|
ht as DIVE,
|
|
754
|
-
lt as
|
|
755
|
-
ct as
|
|
756
|
-
dt as
|
|
757
|
-
pt as
|
|
758
|
-
ut as
|
|
759
|
-
ft as
|
|
760
|
-
_t as
|
|
754
|
+
lt as DIVEAbortablePromise,
|
|
755
|
+
ct as DIVEAmbientLight,
|
|
756
|
+
dt as DIVECanvasLifecycleManager,
|
|
757
|
+
pt as DIVEClock,
|
|
758
|
+
ut as DIVEDefaultSettings,
|
|
759
|
+
ft as DIVEDeferredPromise,
|
|
760
|
+
_t as DIVEEnvironment,
|
|
761
|
+
gt as DIVEEnvironmentDefaultSettings,
|
|
762
|
+
mt as DIVEFloor,
|
|
761
763
|
J as DIVEGizmo,
|
|
762
|
-
|
|
763
|
-
|
|
764
|
+
Dt as DIVEGrid,
|
|
765
|
+
Et as DIVEGroup,
|
|
764
766
|
F as DIVEMath,
|
|
765
|
-
|
|
767
|
+
yt as DIVEModel,
|
|
766
768
|
$ as DIVEMovable,
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
769
|
+
wt as DIVENode,
|
|
770
|
+
Lt as DIVEPerspectiveCamera,
|
|
771
|
+
Ct as DIVEPerspectiveCameraDefaultSettings,
|
|
772
|
+
Mt as DIVEPointLight,
|
|
773
|
+
xt as DIVEPrimitive,
|
|
774
|
+
It as DIVERenderer,
|
|
775
|
+
Pt as DIVERendererDefaultSettings,
|
|
776
|
+
Vt as DIVERoot,
|
|
777
|
+
bt as DIVEScene,
|
|
778
|
+
Ht as DIVESceneDefaultSettings,
|
|
779
|
+
vt as DIVESceneLight,
|
|
778
780
|
tt as DIVESelectable,
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
781
|
+
zt as DIVEView,
|
|
782
|
+
Ot as FILE_TYPES,
|
|
783
|
+
te as FileContentError,
|
|
784
|
+
se as FileTypeError,
|
|
785
|
+
St as GRID_MAJOR_LINE_COLOR,
|
|
786
|
+
At as GRID_MINOR_LINE_COLOR,
|
|
787
|
+
Nt as HELPER_LAYER_MASK,
|
|
788
|
+
ee as NetworkError,
|
|
789
|
+
Xt as PRODUCT_LAYER_MASK,
|
|
790
|
+
ie as ParseError,
|
|
791
|
+
Gt as SUPPORTED_FILE_TYPES,
|
|
790
792
|
d as UI_LAYER_MASK,
|
|
791
793
|
et as applyMixins,
|
|
792
794
|
m as deepClone,
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
795
|
+
kt as findInterface,
|
|
796
|
+
Rt as findSceneRecursive,
|
|
797
|
+
Kt as getFileTypeFromUri,
|
|
796
798
|
v as getObjectDelta,
|
|
797
|
-
|
|
798
|
-
|
|
799
|
+
Ut as implementsInterface,
|
|
800
|
+
Jt as isFileTypeSupported,
|
|
799
801
|
rt as isGroupSchema,
|
|
800
802
|
st as isLightSchema,
|
|
801
|
-
|
|
802
|
-
|
|
803
|
+
ae as isModelSchema,
|
|
804
|
+
oe as isPovSchema,
|
|
803
805
|
it as isPrimitiveSchema
|
|
804
806
|
};
|
package/build/engine/Dive.d.ts
CHANGED
|
@@ -70,8 +70,11 @@ export declare class DIVE {
|
|
|
70
70
|
get canvas(): HTMLCanvasElement;
|
|
71
71
|
get scene(): DIVEScene;
|
|
72
72
|
get clock(): DIVEClock;
|
|
73
|
+
/**
|
|
74
|
+
* @deprecated Use startAsync() instead, which returns a promise that resolves when the engine is fully initialized.
|
|
75
|
+
*/
|
|
73
76
|
start(): void;
|
|
74
77
|
startAsync(): Promise<void>;
|
|
75
78
|
stop(): void;
|
|
76
|
-
|
|
79
|
+
disposeAsync(): Promise<void>;
|
|
77
80
|
}
|
|
@@ -11,21 +11,13 @@ export declare class DIVECanvasLifecycleManager {
|
|
|
11
11
|
private _height;
|
|
12
12
|
private _canvas;
|
|
13
13
|
private _disposed;
|
|
14
|
-
private
|
|
15
|
-
private _observedParent;
|
|
16
|
-
private _pendingStableLayout;
|
|
14
|
+
private _pollCanvasParent;
|
|
17
15
|
private _healthyCanvasPromise;
|
|
18
|
-
private _resolveHealthyCanvas;
|
|
19
16
|
constructor(canvas: HTMLCanvasElement, _onResize: ResizeHandler);
|
|
20
17
|
tick(): void;
|
|
21
18
|
setCanvas(canvas: HTMLCanvasElement): void;
|
|
22
|
-
waitForHealthyCanvas(
|
|
19
|
+
waitForHealthyCanvas(): Promise<DIVECanvasLayout | null>;
|
|
23
20
|
dispose(): void;
|
|
24
|
-
private _checkCanvasHealth;
|
|
25
21
|
private _applyResize;
|
|
26
|
-
private _hasHealthySize;
|
|
27
|
-
private _getCanvasLayout;
|
|
28
|
-
private _invalidateCanvasHealth;
|
|
29
|
-
private _resolvePendingWaiters;
|
|
30
22
|
}
|
|
31
23
|
export {};
|
|
@@ -7,7 +7,8 @@ export declare class DIVEClock {
|
|
|
7
7
|
private _lastTime;
|
|
8
8
|
private _isRunning;
|
|
9
9
|
private _tickers;
|
|
10
|
-
|
|
10
|
+
private _animationRequestId;
|
|
11
|
+
startAsync(): Promise<void>;
|
|
11
12
|
stop(): void;
|
|
12
13
|
addTicker(ticker: DIVETicker): void;
|
|
13
14
|
hasTicker(ticker: DIVETicker): boolean;
|
|
@@ -53,7 +53,7 @@ export declare const DIVEEnvironmentDefaultSettings: DIVEEnvironmentSettings;
|
|
|
53
53
|
*/
|
|
54
54
|
export declare class DIVEEnvironment {
|
|
55
55
|
private originalBackground;
|
|
56
|
-
private
|
|
56
|
+
private _webgpurenderer;
|
|
57
57
|
private scene;
|
|
58
58
|
private pmrem;
|
|
59
59
|
private currentEnvRT;
|
|
@@ -66,7 +66,7 @@ export declare class DIVEEnvironment {
|
|
|
66
66
|
private _initRequested;
|
|
67
67
|
private _disposed;
|
|
68
68
|
constructor(renderer: WebGPURenderer, scene: Scene, options?: Partial<DIVEEnvironmentSettings>);
|
|
69
|
-
|
|
69
|
+
initAsync(): Promise<void>;
|
|
70
70
|
/**
|
|
71
71
|
* Disposes the environment.
|
|
72
72
|
*/
|
package/build/engine/index.d.ts
CHANGED
|
@@ -4,5 +4,7 @@ export * from './clock/Clock.ts';
|
|
|
4
4
|
export * from './renderer/Renderer.ts';
|
|
5
5
|
export * from './environment/Environment.ts';
|
|
6
6
|
export * from './canvas/CanvasLifecycleManager.ts';
|
|
7
|
+
export * from './promise/deferred/DeferredPromise.ts';
|
|
8
|
+
export * from './promise/abortable/AbortablePromise.ts';
|
|
7
9
|
export * from './scene/Scene.ts';
|
|
8
10
|
export * from './view/View.ts';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class DIVEAbortablePromise<T> implements Promise<T> {
|
|
2
|
+
private _executor;
|
|
3
|
+
readonly isDIVEAbortablePromise: true;
|
|
4
|
+
readonly [Symbol.toStringTag]: string;
|
|
5
|
+
private _abortController;
|
|
6
|
+
private _promise;
|
|
7
|
+
private _settled;
|
|
8
|
+
constructor(_executor: (signal: AbortSignal) => Promise<T>);
|
|
9
|
+
get signal(): AbortSignal;
|
|
10
|
+
get pending(): boolean;
|
|
11
|
+
get settled(): boolean;
|
|
12
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
13
|
+
catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
14
|
+
finally(onfinally?: (() => void) | null): Promise<T>;
|
|
15
|
+
abort(reason?: unknown): void;
|
|
16
|
+
private _execute;
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class DIVEDeferredPromise<T> implements Promise<T> {
|
|
2
|
+
readonly isDIVEDeferredPromise: true;
|
|
3
|
+
readonly [Symbol.toStringTag]: string;
|
|
4
|
+
private _promise;
|
|
5
|
+
private _resolve;
|
|
6
|
+
private _reject;
|
|
7
|
+
private _settled;
|
|
8
|
+
constructor();
|
|
9
|
+
get settled(): boolean;
|
|
10
|
+
get pending(): boolean;
|
|
11
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
12
|
+
catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
13
|
+
finally(onfinally?: (() => void) | null): Promise<T>;
|
|
14
|
+
resolve(value: T | PromiseLike<T>): void;
|
|
15
|
+
reject(reason?: unknown): void;
|
|
16
|
+
reset(): this;
|
|
17
|
+
private _createPromise;
|
|
18
|
+
}
|
|
@@ -81,7 +81,7 @@ export declare class DIVERenderer {
|
|
|
81
81
|
get environment(): DIVEEnvironment;
|
|
82
82
|
get canvas(): HTMLCanvasElement;
|
|
83
83
|
get initialized(): boolean;
|
|
84
|
-
|
|
84
|
+
initAsync(): Promise<void>;
|
|
85
85
|
/**
|
|
86
86
|
* @deprecated Use {@link DIVERenderer.tick} instead.
|
|
87
87
|
*/
|
|
@@ -12,18 +12,16 @@ export declare class DIVEView implements DIVETicker {
|
|
|
12
12
|
private _renderer;
|
|
13
13
|
private _canvasLifecycleManager;
|
|
14
14
|
private _initPromise;
|
|
15
|
-
private _initAbortController;
|
|
16
15
|
constructor(_scene: DIVEScene, _camera: DIVEPerspectiveCamera, _settings: Partial<DIVERendererSettings>);
|
|
17
16
|
get renderer(): DIVERenderer;
|
|
18
17
|
get camera(): DIVEPerspectiveCamera;
|
|
19
18
|
get canvas(): HTMLCanvasElement;
|
|
20
19
|
tick(): void;
|
|
21
|
-
|
|
20
|
+
initAsync(): Promise<void>;
|
|
22
21
|
dispose(): void;
|
|
23
22
|
onResize(width: number, height: number): void;
|
|
24
|
-
setCanvas(canvas: HTMLCanvasElement): void
|
|
23
|
+
setCanvas(canvas: HTMLCanvasElement): Promise<void>;
|
|
25
24
|
pause(): void;
|
|
26
25
|
resume(): void;
|
|
27
|
-
private _abortInit;
|
|
28
26
|
private _handleCanvasResize;
|
|
29
27
|
}
|
|
@@ -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-NuQXJfHL.cjs");require("three/examples/jsm/loaders/DRACOLoader.js");const w=require("../../chunks/AssetExporter-Cdxb04b3.cjs");var m=(o=>(o.AR_DESKTOP_PLATFORM_ERROR="ar-desktop-platform-error",o.AR_QUICK_LOOK_NOT_SAFARI_ERROR="ar-quicklook-not-safari-error",o.AR_QUICK_LOOK_VERSION_MISMATCH_ERROR="ar-quicklook-version-mismatch-error",o.AR_QUICK_LOOK_UNKNOWN_ERROR="ar-quicklook-unknown-error",o))(m||{});class a extends Error{constructor(r,t){super(r);l(this,"type");this.name=this.constructor.name,this.type=t,Object.setPrototypeOf(this,new.target.prototype)}}class R extends a{constructor(){super("AR features are not supported on desktop platforms.","ar-desktop-platform-error")}}class p extends a{constructor(){super("ARQuickLook on iOS is only available in Safari.","ar-quicklook-not-safari-error")}}class d extends a{constructor(e,r){super(`ARQuickLook requires iOS version ${r} or later. Current version: ${e}.`,"ar-quicklook-version-mismatch-error"),this.currentVersion=e,this.requiredVersion=r}}class u extends a{constructor(){super("An unknown ARQuickLook compatibility error occurred.","ar-quicklook-unknown-error")}}const k=12;class S{constructor(){l(this,"converter",new A.AssetConverter(new O.AssetLoader,new w.AssetExporter))}async launch(e,r){if(c.SystemInfo.getBrowser()!==c.EBrowser.SAFARI)return Promise.reject(new p);const t=c.SystemInfo.getIOSVersion();if(t&&t.major<k)return Promise.reject(new d(t.full,k));if(!t)return Promise.reject(new u);if(!c.SystemInfo.getSupportsARQuickLook())return Promise.reject(new u);const n=await this.convertToUSDZ(e,r);return this.launchARQuickLook(n,r)}async convertToUSDZ(e,r){const t=await this.converter.convert(e).to("usdz",{quickLookCompatible:!0,ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}}}),n=new Blob([t],{type:"model/vnd.usdz+zip"});return URL.createObjectURL(n)}launchARQuickLook(e,r){return new Promise(t=>{(r==null?void 0:r.arScale)==="fixed"&&(e=e.concat("#allowsContentScaling=0"));const n=document.createElement("a");n.innerHTML="<picture></picture>",n.rel="ar",n.href=e,n.download="scene.usdz",t(),n.click()})}}class _{launch(e,r){const t=self.location.toString(),n=document.createElement("a"),s=this._createParams(t,e,r),i=this._createIntent(t,e,s);n.setAttribute("href",i),n.click()}_createParams(e,r,t){const n=new URL(r,e),s=new URLSearchParams(n.search);return s.set("mode","ar_preferred"),this._applyScaleOption(s,t),this._applyPlacementOption(s,t),this._applySoundOption(s,e),this._applyLinkOption(s,e),s}_applyScaleOption(e,r){(r==null?void 0:r.arScale)==="fixed"&&e.set("resizable","false")}_applyPlacementOption(e,r){(r==null?void 0:r.arPlacement)==="vertical"&&e.set("enable_vertical_placement","true")}_applySoundOption(e,r){if(e.has("sound")){const t=new URL(e.get("sound"),r);e.set("sound",t.toString())}}_applyLinkOption(e,r){if(e.has("link")){const t=new URL(e.get("link"),r);e.set("link",t.toString())}}_createIntent(e,r,t){const n=new URL(e),s=new URL(r,e),i="#model-viewer-no-ar-fallback";return n.hash=i,`intent://arvr.google.com/scene-viewer/1.2?${t.toString()+"&file="+s.toString()}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(n.toString())};end;`}}class L{async launch(e,r){const t=c.SystemInfo.getSystem();return t===c.ESystem.IOS?new S().launch(e,r):t===c.ESystem.ANDROID?new _().launch(e,r):Promise.reject(new R)}}exports.ARDesktopPlatformError=R;exports.ARError=a;exports.ARQuickLook=S;exports.ARQuickLookNotSafariError=p;exports.ARQuickLookUnknownError=u;exports.ARQuickLookVersionMismatchError=d;exports.ARSystem=L;exports.EARErrorType=m;exports.SceneViewer=_;
|
|
@@ -3,7 +3,7 @@ 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-IE1YVWYL.mjs";
|
|
7
7
|
import "three/examples/jsm/loaders/DRACOLoader.js";
|
|
8
8
|
import { A as f } from "../../chunks/AssetExporter-DLL_vJae.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 || {});
|
|
@@ -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-hZPj76ce.cjs");exports.AssetCache=e.AssetCache;exports.Chunk=e.Chunk;
|
|
@@ -11,6 +11,9 @@ export declare class Chunk {
|
|
|
11
11
|
get createdAt(): Date;
|
|
12
12
|
get updatedAt(): Date;
|
|
13
13
|
get arrayBuffer(): ArrayBuffer | null;
|
|
14
|
+
private _getHeader;
|
|
15
|
+
private _concatChunks;
|
|
16
|
+
private _readBodyWithReader;
|
|
14
17
|
constructor(_uri: string);
|
|
15
18
|
load(): Promise<ArrayBuffer>;
|
|
16
19
|
}
|
|
@@ -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-NuQXJfHL.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-IE1YVWYL.mjs";
|
|
2
|
+
import { D as s, a as t } from "../../chunks/AssetLoader-IE1YVWYL.mjs";
|
|
3
3
|
export {
|
|
4
4
|
o as AssetLoader,
|
|
5
5
|
s as DRACOWorker,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var p=Object.defineProperty;var y=(c,t,e)=>t in c?p(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var a=(c,t,e)=>y(c,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("three/webgpu"),w=require("../../chunks/PerspectiveCamera-DwQUmkDv.cjs");class b{constructor(t,e,r){a(this,"_renderer");a(this,"_scene");a(this,"_controller");this._renderer=t,this._scene=e,this._controller=r}async generateMedia(t){const{position:e,target:r,resolution:i}=t,{width:o,height:s}=i,h=this._controller.object.position.clone(),d=this._controller.object.quaternion.clone(),l=this._controller.target.clone(),n=this._renderer.canvas.clientWidth||o,g=this._renderer.canvas.clientHeight||s;try{return"onResize"in this._controller.object&&this._controller.object.onResize(o,s),this._controller.object.position.copy(e),this._controller.target.copy(r),this._controller.update(),(await this.drawCanvas(void 0,i)).toDataURL()}finally{this._controller.object.position.copy(h),this._controller.object.quaternion.copy(d),this._controller.target.copy(l),this._controller.update(),"onResize"in this._controller.object&&this._controller.object.onResize(n,g)}}async drawCanvas(t,e){await this._renderer.
|
|
1
|
+
"use strict";var p=Object.defineProperty;var y=(c,t,e)=>t in c?p(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var a=(c,t,e)=>y(c,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("three/webgpu"),w=require("../../chunks/PerspectiveCamera-DwQUmkDv.cjs");class b{constructor(t,e,r){a(this,"_renderer");a(this,"_scene");a(this,"_controller");this._renderer=t,this._scene=e,this._controller=r}async generateMedia(t){const{position:e,target:r,resolution:i}=t,{width:o,height:s}=i,h=this._controller.object.position.clone(),d=this._controller.object.quaternion.clone(),l=this._controller.target.clone(),n=this._renderer.canvas.clientWidth||o,g=this._renderer.canvas.clientHeight||s;try{return"onResize"in this._controller.object&&this._controller.object.onResize(o,s),this._controller.object.position.copy(e),this._controller.target.copy(r),this._controller.update(),(await this.drawCanvas(void 0,i)).toDataURL()}finally{this._controller.object.position.copy(h),this._controller.object.quaternion.copy(d),this._controller.target.copy(l),this._controller.update(),"onResize"in this._controller.object&&this._controller.object.onResize(n,g)}}async drawCanvas(t,e){await this._renderer.initAsync();const r=this._renderer.webgpurenderer,i=Math.max(1,(e==null?void 0:e.width)??(t==null?void 0:t.width)??(t==null?void 0:t.clientWidth)??this._renderer.canvas.clientWidth),o=Math.max(1,(e==null?void 0:e.height)??(t==null?void 0:t.height)??(t==null?void 0:t.clientHeight)??this._renderer.canvas.clientHeight),s=new _.RenderTarget(i,o,{colorSpace:_.SRGBColorSpace}),h=r.getRenderTarget(),d=this._controller.object.layers.mask;try{r.setRenderTarget(s),this._controller.object.layers.mask=w.DIVEPerspectiveCamera.LIVE_VIEW_LAYER_MASK,r.render(this._scene,this._controller.object);const l=await r.readRenderTargetPixelsAsync(s,0,0,i,o),n=t??document.createElement("canvas");return n.width=i,n.height=o,this._writePixelsToCanvas(n,l,i,o),n}finally{this._controller.object.layers.mask=d,r.setRenderTarget(h),s.dispose()}}_writePixelsToCanvas(t,e,r,i){const o=t.getContext("2d");if(!o)throw new Error("MediaCreator.drawCanvas: 2D canvas context is not available.");const s=o.createImageData(r,i);s.data.set(new Uint8ClampedArray(Array.from(e))),o.putImageData(s,0,0)}}exports.MediaCreator=b;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var g = Object.defineProperty;
|
|
2
2
|
var p = (c, t, e) => t in c ? g(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
|
|
3
3
|
var a = (c, t, e) => p(c, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { RenderTarget as
|
|
5
|
-
import { D as b } from "../../chunks/PerspectiveCamera-
|
|
4
|
+
import { RenderTarget as y, SRGBColorSpace as w } from "three/webgpu";
|
|
5
|
+
import { D as b } from "../../chunks/PerspectiveCamera-35cBnxwG.mjs";
|
|
6
6
|
class T {
|
|
7
7
|
constructor(t, e, r) {
|
|
8
8
|
a(this, "_renderer");
|
|
@@ -19,15 +19,15 @@ class T {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
async drawCanvas(t, e) {
|
|
22
|
-
await this._renderer.
|
|
22
|
+
await this._renderer.initAsync();
|
|
23
23
|
const r = this._renderer.webgpurenderer, i = Math.max(
|
|
24
24
|
1,
|
|
25
25
|
(e == null ? void 0 : e.width) ?? (t == null ? void 0 : t.width) ?? (t == null ? void 0 : t.clientWidth) ?? this._renderer.canvas.clientWidth
|
|
26
26
|
), o = Math.max(
|
|
27
27
|
1,
|
|
28
28
|
(e == null ? void 0 : e.height) ?? (t == null ? void 0 : t.height) ?? (t == null ? void 0 : t.clientHeight) ?? this._renderer.canvas.clientHeight
|
|
29
|
-
), s = new
|
|
30
|
-
colorSpace:
|
|
29
|
+
), s = new y(i, o, {
|
|
30
|
+
colorSpace: w
|
|
31
31
|
}), h = r.getRenderTarget(), d = this._controller.object.layers.mask;
|
|
32
32
|
try {
|
|
33
33
|
r.setRenderTarget(s), this._controller.object.layers.mask = b.LIVE_VIEW_LAYER_MASK, r.render(this._scene, this._controller.object);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../chunks/FileTypes-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../chunks/FileTypes-IZ9BrQ2x.cjs");exports.OrbitController=t.OrbitController;exports.OrbitControllerDefaultSettings=t.OrbitControllerDefaultSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var p=Object.defineProperty;var c=(s,r,e)=>r in s?p(s,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[r]=e;var o=(s,r,e)=>c(s,typeof r!="symbol"?r+"":r,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("three/webgpu");require("../../chunks/FileTypes-
|
|
1
|
+
"use strict";var p=Object.defineProperty;var c=(s,r,e)=>r in s?p(s,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[r]=e;var o=(s,r,e)=>c(s,typeof r!="symbol"?r+"":r,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("three/webgpu");require("../../chunks/FileTypes-IZ9BrQ2x.cjs");const h=require("../../chunks/PerspectiveCamera-DwQUmkDv.cjs");require("three/examples/jsm/loaders/HDRLoader.js");require("three/tsl");const n=require("../../chunks/AxisHelperColors-BrGqktN5.cjs"),_=require("three-spritetext");class l extends t.Object3D{constructor(){super();o(this,"_axesHelper");this._axesHelper=new t.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 t.Color(n.AxesColorRed),new t.Color(n.AxesColorGreen),new t.Color(n.AxesColorBlue));const e=new _("X",.2,n.AxesColorRedLetter),i=new _("Y",.2,n.AxesColorGreenLetter),a=new _("Z",.2,n.AxesColorBlueLetter);e.layers.mask=h.COORDINATE_LAYER_MASK,i.layers.mask=h.COORDINATE_LAYER_MASK,a.layers.mask=h.COORDINATE_LAYER_MASK,e.position.set(.7,0,0),i.position.set(0,.7,0),a.position.set(0,0,.7),this._axesHelper.add(e),this._axesHelper.add(i),this._axesHelper.add(a),this.add(this._axesHelper)}setFromCameraMatrix(e){this._axesHelper.rotation.setFromRotationMatrix(new t.Matrix4().extractRotation(e).invert())}}class d{constructor(r,e,i){o(this,"uuid",t.MathUtils.generateUUID());o(this,"_axes");o(this,"_orthographicCamera");o(this,"_restoreViewport",new t.Vector4);this._renderer=r,this._scene=e,this._camera=i,this._orthographicCamera=new t.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 l,this._axes.name="OrientationDisplayAxes",this._scene.add(this._axes)}tick(){var a;if(!this._renderer.webgpurenderer.initialized)return;const r=this._scene.background??null,e=this._renderer.webgpurenderer.autoClear;this._scene.background=null,this._renderer.webgpurenderer.getViewport(this._restoreViewport);const i=((a=this._renderer.webgpurenderer.domElement)==null?void 0:a.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._camera.matrix),this._renderer.webgpurenderer.render(this._scene,this._orthographicCamera),this._renderer.webgpurenderer.setViewport(this._restoreViewport),this._renderer.webgpurenderer.autoClear=e,this._scene.background=r}dispose(){this._scene.remove(this._axes),this._scene.remove(this._orthographicCamera)}}exports.OrientationDisplay=d;exports.OrientationDisplayAxes=l;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var p = Object.defineProperty;
|
|
2
2
|
var _ = (t, r, e) => r in t ? p(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
3
|
var i = (t, r, e) => _(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
-
import { Object3D as l, AxesHelper as
|
|
5
|
-
import "../../chunks/FileTypes-
|
|
6
|
-
import { C as o } from "../../chunks/PerspectiveCamera-
|
|
4
|
+
import { Object3D as l, AxesHelper as d, Color as n, Matrix4 as c, OrthographicCamera as m, MathUtils as x, Vector4 as w } from "three/webgpu";
|
|
5
|
+
import "../../chunks/FileTypes-DLAWiGQa.mjs";
|
|
6
|
+
import { C as o } from "../../chunks/PerspectiveCamera-35cBnxwG.mjs";
|
|
7
7
|
import "three/examples/jsm/loaders/HDRLoader.js";
|
|
8
8
|
import "three/tsl";
|
|
9
|
-
import { A as u, a as
|
|
9
|
+
import { A as u, a as g, b as C, c as b, d as A, e as H } from "../../chunks/AxisHelperColors-JLBHYQDi.mjs";
|
|
10
10
|
import h from "three-spritetext";
|
|
11
11
|
class k extends l {
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
14
|
i(this, "_axesHelper");
|
|
15
|
-
this._axesHelper = new
|
|
15
|
+
this._axesHelper = new d(0.5), this._axesHelper.layers.mask = o, this._axesHelper.material.depthTest = !1, this._axesHelper.position.set(0, 0, -1), this._axesHelper.setColors(
|
|
16
16
|
new n(u),
|
|
17
|
-
new n(
|
|
18
|
-
new n(
|
|
17
|
+
new n(g),
|
|
18
|
+
new n(C)
|
|
19
19
|
);
|
|
20
|
-
const e = new h("X", 0.2,
|
|
20
|
+
const e = new h("X", 0.2, b), s = new h("Y", 0.2, A), a = new h("Z", 0.2, H);
|
|
21
21
|
e.layers.mask = o, s.layers.mask = o, a.layers.mask = o, e.position.set(0.7, 0, 0), s.position.set(0, 0.7, 0), a.position.set(0, 0, 0.7), this._axesHelper.add(e), this._axesHelper.add(s), this._axesHelper.add(a), this.add(this._axesHelper);
|
|
22
22
|
}
|
|
23
23
|
setFromCameraMatrix(e) {
|
|
24
24
|
this._axesHelper.rotation.setFromRotationMatrix(
|
|
25
|
-
new
|
|
25
|
+
new c().extractRotation(e).invert()
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -43,6 +43,7 @@ class L {
|
|
|
43
43
|
}
|
|
44
44
|
tick() {
|
|
45
45
|
var a;
|
|
46
|
+
if (!this._renderer.webgpurenderer.initialized) return;
|
|
46
47
|
const r = this._scene.background ?? null, e = this._renderer.webgpurenderer.autoClear;
|
|
47
48
|
this._scene.background = null, this._renderer.webgpurenderer.getViewport(this._restoreViewport);
|
|
48
49
|
const s = ((a = this._renderer.webgpurenderer.domElement) == null ? void 0 : a.clientHeight) ?? this._restoreViewport.w;
|