@needle-tools/engine 3.32.18-alpha → 3.32.18-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/needle-engine.js +5 -5
- package/dist/needle-engine.light.js +5 -5
- package/dist/needle-engine.light.min.js +1 -1
- package/dist/needle-engine.light.umd.cjs +22 -22
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/package.json +1 -1
- package/plugins/vite/dependency-watcher.js +3 -2
package/dist/needle-engine.js
CHANGED
|
@@ -23335,13 +23335,13 @@ class zy {
|
|
|
23335
23335
|
}
|
|
23336
23336
|
r(zy, "eventListeners", /* @__PURE__ */ new Map());
|
|
23337
23337
|
const RY = oA("debugdefines");
|
|
23338
|
-
TE('if(!globalThis[""3.32.18-alpha""]) globalThis[""3.32.18-alpha""] = "0.0.0";');
|
|
23338
|
+
TE('if(!globalThis[""3.32.18-alpha.1""]) globalThis[""3.32.18-alpha.1""] = "0.0.0";');
|
|
23339
23339
|
TE('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
|
|
23340
|
-
TE('if(!globalThis[""Fri Feb 09 2024 20:
|
|
23341
|
-
TE('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.32.18-alpha";');
|
|
23340
|
+
TE('if(!globalThis[""Fri Feb 09 2024 20:45:03 GMT+0800 (Pacific Standard Time)""]) globalThis[""Fri Feb 09 2024 20:45:03 GMT+0800 (Pacific Standard Time)""] = "unknown";');
|
|
23341
|
+
TE('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.32.18-alpha.1";');
|
|
23342
23342
|
TE('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
|
|
23343
|
-
TE('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Feb 09 2024 20:
|
|
23344
|
-
const hC = "3.32.18-alpha", bR = "undefined", hz = "Fri Feb 09 2024 20:
|
|
23343
|
+
TE('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Feb 09 2024 20:45:03 GMT+0800 (Pacific Standard Time)";');
|
|
23344
|
+
const hC = "3.32.18-alpha.1", bR = "undefined", hz = "Fri Feb 09 2024 20:45:03 GMT+0800 (Pacific Standard Time)";
|
|
23345
23345
|
RY && console.log(`Engine version: ${hC} (generator: ${bR})
|
|
23346
23346
|
Project built at ${hz}`);
|
|
23347
23347
|
const va = "needle_isActiveInHierarchy", MQ = "builtin_components", If = "needle_editor_guid";
|
|
@@ -23335,13 +23335,13 @@ class Xb {
|
|
|
23335
23335
|
}
|
|
23336
23336
|
u(Xb, "eventListeners", /* @__PURE__ */ new Map());
|
|
23337
23337
|
const XF = se("debugdefines");
|
|
23338
|
-
pp('if(!globalThis[""3.32.18-alpha""]) globalThis[""3.32.18-alpha""] = "0.0.0";');
|
|
23338
|
+
pp('if(!globalThis[""3.32.18-alpha.1""]) globalThis[""3.32.18-alpha.1""] = "0.0.0";');
|
|
23339
23339
|
pp('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
|
|
23340
|
-
pp('if(!globalThis[""Fri Feb 09 2024 20:
|
|
23341
|
-
pp('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.32.18-alpha";');
|
|
23340
|
+
pp('if(!globalThis[""Fri Feb 09 2024 20:45:09 GMT+0800 (Pacific Standard Time)""]) globalThis[""Fri Feb 09 2024 20:45:09 GMT+0800 (Pacific Standard Time)""] = "unknown";');
|
|
23341
|
+
pp('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.32.18-alpha.1";');
|
|
23342
23342
|
pp('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
|
|
23343
|
-
pp('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Feb 09 2024 20:
|
|
23344
|
-
const il = "3.32.18-alpha", bT = "undefined", G9 = "Fri Feb 09 2024 20:
|
|
23343
|
+
pp('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Feb 09 2024 20:45:09 GMT+0800 (Pacific Standard Time)";');
|
|
23344
|
+
const il = "3.32.18-alpha.1", bT = "undefined", G9 = "Fri Feb 09 2024 20:45:09 GMT+0800 (Pacific Standard Time)";
|
|
23345
23345
|
XF && console.log(`Engine version: ${il} (generator: ${bT})
|
|
23346
23346
|
Project built at ${G9}`);
|
|
23347
23347
|
const gh = "needle_isActiveInHierarchy", rf = "builtin_components", _0 = "needle_editor_guid";
|
|
@@ -3944,7 +3944,7 @@ Open this page console: `+e.toString())}const i=ja()||W0()&&wt();if(i&&(D9(),Vk(
|
|
|
3944
3944
|
}
|
|
3945
3945
|
}
|
|
3946
3946
|
`,Mo?.prepend(t),i===!0&&EC()<=0&&z9(),console.log("\u{1F335} Debug console has loaded")}},e.src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js",document.body.appendChild(e)}function H9(){return document.querySelector("#__vconsole .vc-switch")||null}function W9(){return document.querySelector("#__vconsole")||null}const X9=te("nodevlogs");function ms(i,e=Eo.Log){Ql(e,i)}function is(i){ms(i,Eo.Warn)}function Xk(i){ms(i,Eo.Error)}let DC;function wt(){return X9?!1:DC!==void 0?DC:un()}function q9(i){DC=i}const Iu=new Tp,Wr=new w,nh=new w,Hi=new Ie,qk={X:new w(1,0,0),Y:new w(0,1,0),Z:new w(0,0,1)},kC={type:"change"},Yk={type:"mouseDown"},Jk={type:"mouseUp",mode:null},Kk={type:"objectChange"};class Y9 extends ye{constructor(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const s=new LC;this._gizmo=s,this.add(s);const r=new tX;this._plane=r,this.add(r);const n=this;function o(v,b){let _=b;Object.defineProperty(n,v,{get:function(){return _!==void 0?_:b},set:function(S){_!==S&&(_=S,r[v]=S,s[v]=S,n.dispatchEvent({type:v+"-changed",value:S}),n.dispatchEvent(kC))}}),n[v]=b,r[v]=b,s[v]=b}o("camera",e),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const a=new w,l=new w,c=new Ie,u=new Ie,d=new w,p=new Ie,f=new w,m=new w,A=new w,y=0,g=new w;o("worldPosition",a),o("worldPositionStart",l),o("worldQuaternion",c),o("worldQuaternionStart",u),o("cameraPosition",d),o("cameraQuaternion",p),o("pointStart",f),o("pointEnd",m),o("rotationAxis",A),o("rotationAngle",y),o("eye",g),this._offset=new w,this._startNorm=new w,this._endNorm=new w,this._cameraScale=new w,this._parentPosition=new w,this._parentQuaternion=new Ie,this._parentQuaternionInv=new Ie,this._parentScale=new w,this._worldScaleStart=new w,this._worldQuaternionInv=new Ie,this._worldScale=new w,this._positionStart=new w,this._quaternionStart=new Ie,this._scaleStart=new w,this._getPointer=J9.bind(this),this._onPointerDown=Z9.bind(this),this._onPointerHover=K9.bind(this),this._onPointerMove=$9.bind(this),this._onPointerUp=eX.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;Iu.setFromCamera(e,this.camera);const t=OC(this._gizmo.picker[this.mode],Iu);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){Iu.setFromCamera(e,this.camera);const t=OC(this._plane,Iu,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,Yk.mode=this.mode,this.dispatchEvent(Yk)}}pointerMove(e){const t=this.axis,s=this.mode,r=this.object;let n=this.space;if(s==="scale"?n="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(n="world"),r===void 0||t===null||this.dragging===!1||e.button!==-1)return;Iu.setFromCamera(e,this.camera);const o=OC(this._plane,Iu,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),s==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),n==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),n==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),r.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(n==="local"&&(r.position.applyQuaternion(Hi.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this._quaternionStart)),n==="world"&&(r.parent&&r.position.add(Wr.setFromMatrixPosition(r.parent.matrixWorld)),t.search("X")!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.parent&&r.position.sub(Wr.setFromMatrixPosition(r.parent.matrixWorld))));else if(s==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),nh.set(a,a,a)}else Wr.copy(this.pointStart),nh.copy(this.pointEnd),Wr.applyQuaternion(this._worldQuaternionInv),nh.applyQuaternion(this._worldQuaternionInv),nh.divide(Wr),t.search("X")===-1&&(nh.x=1),t.search("Y")===-1&&(nh.y=1),t.search("Z")===-1&&(nh.z=1);r.scale.copy(this._scaleStart).multiply(nh),this.scaleSnap&&(t.search("X")!==-1&&(r.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(s==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Wr.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Wr.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(qk[t]),Wr.copy(qk[t]),n==="local"&&Wr.applyQuaternion(this.worldQuaternion),Wr.cross(this.eye),Wr.length()===0?l=!0:this.rotationAngle=this._offset.dot(Wr.normalize())*a),(t==="E"||l)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),n==="local"&&t!=="E"&&t!=="XYZE"?(r.quaternion.copy(this._quaternionStart),r.quaternion.multiply(Hi.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),r.quaternion.copy(Hi.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(kC),this.dispatchEvent(Kk)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(Jk.mode=this.mode,this.dispatchEvent(Jk)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(kC),this.dispatchEvent(Kk),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Iu}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function J9(i){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:i.button};{const e=this.domElement.getBoundingClientRect();return{x:(i.clientX-e.left)/e.width*2-1,y:-(i.clientY-e.top)/e.height*2+1,button:i.button}}}function K9(i){if(this.enabled)switch(i.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(i));break}}function Z9(i){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(i)),this.pointerDown(this._getPointer(i)))}function $9(i){this.enabled&&this.pointerMove(this._getPointer(i))}function eX(i){this.enabled&&(this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(i)))}function OC(i,e,t){const s=e.intersectObject(i,!0);for(let r=0;r<s.length;r++)if(s[r].object.visible||t)return s[r];return!1}const q0=new Ur,Bi=new w(0,1,0),Zk=new w(0,0,0),$k=new Te,Y0=new Ie,J0=new Ie,Qa=new w,eO=new Te,cg=new w(1,0,0),Ru=new w(0,1,0),hg=new w(0,0,1),K0=new w,ug=new w,dg=new w;class LC extends ye{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new ri({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new _s({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=e.clone();s.opacity=.15;const r=t.clone();r.opacity=.5;const n=e.clone();n.color.setHex(16711680);const o=e.clone();o.color.setHex(65280);const a=e.clone();a.color.setHex(255);const l=e.clone();l.color.setHex(16711680),l.opacity=.5;const c=e.clone();c.color.setHex(65280),c.opacity=.5;const u=e.clone();u.color.setHex(255),u.opacity=.5;const d=e.clone();d.opacity=.25;const p=e.clone();p.color.setHex(16776960),p.opacity=.25,e.clone().color.setHex(16776960);const f=e.clone();f.color.setHex(7895160);const m=new Ms(0,.04,.1,12);m.translate(0,.05,0);const A=new Fi(.08,.08,.08);A.translate(0,.04,0);const y=new gt;y.setAttribute("position",new ot([0,0,0,1,0,0],3));const g=new Ms(.0075,.0075,.5,3);g.translate(0,.25,0);function v(N,H){const L=new Pc(N,.0075,3,64,H*Math.PI*2);return L.rotateY(Math.PI/2),L.rotateX(Math.PI/2),L}function b(){const N=new gt;return N.setAttribute("position",new ot([0,0,0,1,1,1],3)),N}const _={X:[[new ve(m,n),[.5,0,0],[0,0,-Math.PI/2]],[new ve(m,n),[-.5,0,0],[0,0,Math.PI/2]],[new ve(g,n),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new ve(m,o),[0,.5,0]],[new ve(m,o),[0,-.5,0],[Math.PI,0,0]],[new ve(g,o)]],Z:[[new ve(m,a),[0,0,.5],[Math.PI/2,0,0]],[new ve(m,a),[0,0,-.5],[-Math.PI/2,0,0]],[new ve(g,a),null,[Math.PI/2,0,0]]],XYZ:[[new ve(new Rc(.1,0),d.clone()),[0,0,0]]],XY:[[new ve(new Fi(.15,.15,.01),u.clone()),[.15,.15,0]]],YZ:[[new ve(new Fi(.15,.15,.01),l.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new ve(new Fi(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},S={X:[[new ve(new Ms(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new ve(new Ms(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new ve(new Ms(.2,0,.6,4),s),[0,.3,0]],[new ve(new Ms(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new ve(new Ms(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new ve(new Ms(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new ve(new Rc(.2,0),s)]],XY:[[new ve(new Fi(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new ve(new Fi(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new ve(new Fi(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},M={START:[[new ve(new Rc(.01,2),r),null,null,null,"helper"]],END:[[new ve(new Rc(.01,2),r),null,null,null,"helper"]],DELTA:[[new xs(b(),r),null,null,null,"helper"]],X:[[new xs(y,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new xs(y,r.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new xs(y,r.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},C={XYZE:[[new ve(v(.5,1),f),null,[0,Math.PI/2,0]]],X:[[new ve(v(.5,.5),n)]],Y:[[new ve(v(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new ve(v(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new ve(v(.75,1),p),null,[0,Math.PI/2,0]]]},R={AXIS:[[new xs(y,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},I={XYZE:[[new ve(new Ta(.25,10,8),s)]],X:[[new ve(new Pc(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new ve(new Pc(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new ve(new Pc(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new ve(new Pc(.75,.1,2,24),s)]]},E={X:[[new ve(A,n),[.5,0,0],[0,0,-Math.PI/2]],[new ve(g,n),[0,0,0],[0,0,-Math.PI/2]],[new ve(A,n),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new ve(A,o),[0,.5,0]],[new ve(g,o)],[new ve(A,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new ve(A,a),[0,0,.5],[Math.PI/2,0,0]],[new ve(g,a),[0,0,0],[Math.PI/2,0,0]],[new ve(A,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new ve(new Fi(.15,.15,.01),u),[.15,.15,0]]],YZ:[[new ve(new Fi(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new ve(new Fi(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new ve(new Fi(.1,.1,.1),d.clone())]]},z={X:[[new ve(new Ms(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new ve(new Ms(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new ve(new Ms(.2,0,.6,4),s),[0,.3,0]],[new ve(new Ms(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new ve(new Ms(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new ve(new Ms(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new ve(new Fi(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new ve(new Fi(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new ve(new Fi(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new ve(new Fi(.2,.2,.2),s),[0,0,0]]]},F={X:[[new xs(y,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new xs(y,r.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new xs(y,r.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function q(N){const H=new ye;for(const L in N)for(let j=N[L].length;j--;){const Q=N[L][j][0].clone(),$=N[L][j][1],Z=N[L][j][2],se=N[L][j][3],Ae=N[L][j][4];Q.name=L,Q.tag=Ae,$&&Q.position.set($[0],$[1],$[2]),Z&&Q.rotation.set(Z[0],Z[1],Z[2]),se&&Q.scale.set(se[0],se[1],se[2]),Q.updateMatrix();const Ue=Q.geometry.clone();Ue.applyMatrix4(Q.matrix),Q.geometry=Ue,Q.renderOrder=1/0,Q.position.set(0,0,0),Q.rotation.set(0,0,0),Q.scale.set(1,1,1),H.add(Q)}return H}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=q(_)),this.add(this.gizmo.rotate=q(C)),this.add(this.gizmo.scale=q(E)),this.add(this.picker.translate=q(S)),this.add(this.picker.rotate=q(I)),this.add(this.picker.scale=q(z)),this.add(this.helper.translate=q(M)),this.add(this.helper.rotate=q(R)),this.add(this.helper.scale=q(F)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const t=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:J0;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let r=0;r<s.length;r++){const n=s[r];n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition);let o;if(this.camera.isOrthographicCamera?o=(this.camera.top-this.camera.bottom)/this.camera.zoom:o=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(o*this.size/4),n.tag==="helper"){n.visible=!1,n.name==="AXIS"?(n.visible=!!this.axis,this.axis==="X"&&(Hi.setFromEuler(q0.set(0,0,0)),n.quaternion.copy(t).multiply(Hi),Math.abs(Bi.copy(cg).applyQuaternion(t).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Y"&&(Hi.setFromEuler(q0.set(0,0,Math.PI/2)),n.quaternion.copy(t).multiply(Hi),Math.abs(Bi.copy(Ru).applyQuaternion(t).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(Hi.setFromEuler(q0.set(0,Math.PI/2,0)),n.quaternion.copy(t).multiply(Hi),Math.abs(Bi.copy(hg).applyQuaternion(t).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(Hi.setFromEuler(q0.set(0,Math.PI/2,0)),Bi.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix($k.lookAt(Zk,Bi,Ru)),n.quaternion.multiply(Hi),n.visible=this.dragging),this.axis==="E"&&(n.visible=!1)):n.name==="START"?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):n.name==="END"?(n.position.copy(this.worldPosition),n.visible=this.dragging):n.name==="DELTA"?(n.position.copy(this.worldPositionStart),n.quaternion.copy(this.worldQuaternionStart),Wr.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Wr.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(Wr),n.visible=this.dragging):(n.quaternion.copy(t),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=this.axis.search(n.name)!==-1));continue}n.quaternion.copy(t),this.mode==="translate"||this.mode==="scale"?(n.name==="X"&&Math.abs(Bi.copy(cg).applyQuaternion(t).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Y"&&Math.abs(Bi.copy(Ru).applyQuaternion(t).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Z"&&Math.abs(Bi.copy(hg).applyQuaternion(t).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XY"&&Math.abs(Bi.copy(hg).applyQuaternion(t).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="YZ"&&Math.abs(Bi.copy(cg).applyQuaternion(t).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XZ"&&Math.abs(Bi.copy(Ru).applyQuaternion(t).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(Y0.copy(t),Bi.copy(this.eye).applyQuaternion(Hi.copy(t).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix($k.lookAt(this.eye,Zk,Ru)),n.name==="X"&&(Hi.setFromAxisAngle(cg,Math.atan2(-Bi.y,Bi.z)),Hi.multiplyQuaternions(Y0,Hi),n.quaternion.copy(Hi)),n.name==="Y"&&(Hi.setFromAxisAngle(Ru,Math.atan2(Bi.x,Bi.z)),Hi.multiplyQuaternions(Y0,Hi),n.quaternion.copy(Hi)),n.name==="Z"&&(Hi.setFromAxisAngle(hg,Math.atan2(Bi.y,Bi.x)),Hi.multiplyQuaternions(Y0,Hi),n.quaternion.copy(Hi))),n.visible=n.visible&&(n.name.indexOf("X")===-1||this.showX),n.visible=n.visible&&(n.name.indexOf("Y")===-1||this.showY),n.visible=n.visible&&(n.name.indexOf("Z")===-1||this.showZ),n.visible=n.visible&&(n.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,this.enabled&&this.axis&&(n.name===this.axis||this.axis.split("").some(function(a){return n.name===a}))&&(n.material.color.setHex(16776960),n.material.opacity=1)}super.updateMatrixWorld(e)}}class tX extends ve{constructor(){super(new Ys(1e5,1e5,2,2),new ri({visible:!1,wireframe:!0,side:fi,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),K0.copy(cg).applyQuaternion(t==="local"?this.worldQuaternion:J0),ug.copy(Ru).applyQuaternion(t==="local"?this.worldQuaternion:J0),dg.copy(hg).applyQuaternion(t==="local"?this.worldQuaternion:J0),Bi.copy(ug),this.mode){case"translate":case"scale":switch(this.axis){case"X":Bi.copy(this.eye).cross(K0),Qa.copy(K0).cross(Bi);break;case"Y":Bi.copy(this.eye).cross(ug),Qa.copy(ug).cross(Bi);break;case"Z":Bi.copy(this.eye).cross(dg),Qa.copy(dg).cross(Bi);break;case"XY":Qa.copy(dg);break;case"YZ":Qa.copy(K0);break;case"XZ":Bi.copy(dg),Qa.copy(ug);break;case"XYZ":case"E":Qa.set(0,0,0);break}break;case"rotate":default:Qa.set(0,0,0)}Qa.length()===0?this.quaternion.copy(this.cameraQuaternion):(eO.lookAt(Wr.set(0,0,0),Qa,Bi),this.quaternion.setFromRotationMatrix(eO)),super.updateMatrixWorld(e)}}const iX=te("debugpatch");function Z0(i,e,t,s){const r=iX===e;if(!t&&!s)return;const n=e+"___needle";rX(i,e,t,s);const o=Object.getOwnPropertyDescriptor(i,e),a=i[e];r&&console.log("Patch",i.constructor.name,e,o,a),o?(r&&console.log("Apply patch with existing descriptor",i.constructor.name,e,o),typeof o.value=="function"&&(i[e]=iO(o.value,i,e))):(r&&console.log("Create patch with new property",i.constructor.name,e,o),Object.defineProperty(i,e,{set:function(l){if(typeof l=="function")this[n]=iO(l,i,e);else{const c=this[n];sO(i,e,this,c,l),this[n]=l,rO(i,e,this,c,l)}},get:function(){const l=this[n];return typeof l=="function"&&l[n]?l[n]:l}}))}function sX(i,e,t){const s=FC(i,e);if(s)for(let r=s.length-1;r>=0;r--){const n=s[r];n.prefix===t&&(n.prefix=null),n.postfix===t&&(n.postfix=null),!n.prefix&&!n.postfix&&s.splice(r,1)}}const tO=Symbol("Needle:Patches:WrappedFunction");function iO(i,e,t){if(i[tO])return i;const s=function(...r){sO(e,t,this,...r);const n=i.apply(this,r);return rO(e,t,this,n,...r),n};return s[tO]=!0,s}const $0="Needle:Patches";function UC(){return globalThis[$0]||(globalThis[$0]=new WeakMap),globalThis[$0]}function FC(i,e){const t=UC().get(i);return t?t.get(e):null}function rX(i,e,t,s){let r=UC().get(i);r||(r=new Map,UC().set(i,r));let n=r.get(e);n||(n=[],r.set(e,n)),n.push({prefix:t,postfix:s})}function sO(i,e,t,...s){var r;if(!t)return;const n=FC(i,e);if(n)for(const o of n)(r=o.prefix)==null||r.call(t,...s)}function rO(i,e,t,s,...r){var n;if(!t)return;const o=FC(i,e);if(o)for(const a of o)(n=a.postfix)==null||n.call(t,s,...r)}const nO=Symbol("gltf-loader-internal-usage-tracker"),nX=te("debugusers"),eb=class{constructor(i){h(this,"parser"),h(this,"_getDependency"),h(this,"_loadingId"),h(this,"_loadedObjects",new Set),this.parser=i,this._getDependency=this.parser.getDependency,this._loadingId=Date.now().toString()}get name(){return"NEEDLE_internal_usage_tracker"}static isLoading(i){return eb._loadingProcesses>0}beforeRoot(){eb._loadingProcesses++;const i=this,e=this._getDependency;return this.parser.getDependency=function(t,s){const r=e.call(this,t,s);return r.then(n=>(n&&(i._loadedObjects.add(n),n[nO]=i._loadingId),n)),r},null}afterRoot(i){eb._loadingProcesses--,this.parser.getDependency=this._getDependency;for(const e of this._loadedObjects)delete e[nO],e instanceof ye&&(e.parent||e instanceof ve&&(nX&&console.warn("> GLTF LOADER: Mesh not used in scene!",e),e.material=null,e.geometry=null));return null}};let NC=eb;h(NC,"_loadingProcesses",0);class oO{constructor(){window.addEventListener("unhandledrejection",e=>{var t;if(e.defaultPrevented)return;const s=(t=e?.reason)==null?void 0:t.path;if(s){const r=s[0];r&&r.tagName==="IMG"&&(console.warn(`Could not load image:
|
|
3947
|
-
`+r.src),e.preventDefault())}})}}const tb=te("trackresources");function aO(){return tb==="dispose"}let Pu=!0;tb===0&&(Pu=!1);function oX(i){Pu=i}function lO(){return Pu}const cO=Symbol("disposable");function zC(i,e){i&&(i[cO]=e,Bu&&console.warn("Set disposable",e,i))}const hO=Symbol("disposed");function aX(i){return i[hO]===!0}function Oi(i){var e;if(i){if(i[cO]===!1){Bu&&console.warn("Object is marked as not disposable",i);return}if(i[hO]=!0,i instanceof Vr)Oi(i.environment),Oi(i.background),Oi(i.customDepthMaterial),Oi(i.customDistanceMaterial);else if(i instanceof oa)Oi(i.geometry),Oi(i.material),Oi(i.skeleton),Oi(i.bindMatrix),Oi(i.bindMatrixInverse),Oi(i.customDepthMaterial),Oi(i.customDistanceMaterial),i.geometry=null,i.material=null;else if(i instanceof ve)Oi(i.geometry),Oi(i.material),Oi(i.customDepthMaterial),Oi(i.customDistanceMaterial),i.geometry=null,i.material=null;else if(i instanceof gt){kp(i);for(const t of Object.keys(i.attributes)){const s=i.attributes[t];Oi(s)}}else if(i instanceof Ze||i instanceof Tn)Bu&&console.warn("BufferAttribute dispose not supported",i.count);else if(i instanceof Array)for(const t of i)t instanceof Lt&&Oi(t);else if(i instanceof Lt){kp(i);for(const s of Object.keys(i)){const r=i[s];r instanceof Nt&&(Oi(r),i[s]=null)}const t=i.uniforms;if(t)for(const s of Object.keys(t)){const r=t[s];r instanceof Nt?(Oi(r),t[s]=null):r instanceof Me&&(Oi(r.value),r.value=null)}}else i instanceof Nt?(kp(i),kp(i.source),((e=i.source)==null?void 0:e.data)instanceof ImageBitmap&&kp(i.source.data)):i instanceof lm?(kp(i.boneTexture),i.boneTexture=null):i instanceof Wm||!(i instanceof ye)&&Bu&&console.warn("Unknown object type",i)}}function kp(i){i&&((Bu||aO()||tb)&&console.warn("\u{1F9E8} FREE",i),i instanceof ImageBitmap?i.close():i instanceof Rl?i.data=null:i.dispose())}function uO(i){(i instanceof ve||i instanceof oa)&&(i.material=null,i.geometry=null)}const lX=new Set;function jC(i,e,t=null,s){if(s||(s=lX,s.clear()),!i)return s;const r=i[pg];if(r)for(const n of r)s.has(n)||t?.call(null,n)!==!1&&(s.add(n),e&&jC(n,!0,t,s));return s}function cX(i){return i[fg]}const Bu=te("debugresourceusers")||te("debugmemory"),pg=Symbol("needle-resource-users"),fg=Symbol("needle-resource-users-count");function dn(i,e){Z0(i,e,function(t,s){Pu&&(ib(pg,this,t,!1),ib(pg,this,s,!0))})}Pu&&(dn(ve.prototype,"material"),dn(ve.prototype,"geometry"),dn(Lt.prototype,"map"),dn(Lt.prototype,"bumpMap"),dn(Lt.prototype,"alphaMap"),dn(Lt.prototype,"normalMap"),dn(Lt.prototype,"displacementMap"),dn(Lt.prototype,"roughnessMap"),dn(Lt.prototype,"metalnessMap"),dn(Lt.prototype,"emissiveMap"),dn(Lt.prototype,"specularMap"),dn(Lt.prototype,"envMap"),dn(Lt.prototype,"lightMap"),dn(Lt.prototype,"aoMap"),dn(Lt.prototype,"gradientMap"));function hX(i){if(Pu===!1)return;const e=i[pg];if(e)for(const t of e)ib(pg,t,i,!1)}Pu&&Z0(Lt.prototype,"dispose",function(){hX(this)});let GC=0;function ib(i,e,t,s){if(GC>0)return;if(Array.isArray(t)){for(const n of t)ib(i,e,n,s);return}if(!t)return;let r=t[i];if(r||(r=new Set),s){if(e&&!r.has(e)){r.add(e);let n=t[fg]||0;n+=1,t[fg]=n,Bu&&console.warn(`\u{1F7E2} Added user of "${t.type}"`,e,t,n,"users:",r)}}else if(e&&r.has(e)){r.delete(e);let n=t[fg]||0;n>0&&(n-=1,t[fg]=n),Bu&&console.warn(`\u{1F534} Removed user of "${t.type}"`,e,t,n,"users:",r),n<=0&&(NC.isLoading(t)||(tb&&console.warn(`\u{1F534} Removed all user of "${t.type}"`,t),aO()&&Oi(t)))}t[i]=r}try{Z0(Fl.prototype,"render",function(){GC++},function(){GC--})}catch(i){console.warn("Could not wrap WebGLRenderer.render",i)}var mg=(i=>(i.Added="component-added",i.Removing="removing-component",i))(mg||{});const dO=te("debugcomponentevents");class gg{static addComponentLifecylceEventListener(e,t){this.eventListeners.has(e)&&this.eventListeners.set(e,[]);let s=this.eventListeners.get(e);s||(s=[]),s.push(t),this.eventListeners.set(e,s),dO&&console.log("Added event listener for "+e,this.eventListeners)}static removeComponentLifecylceEventListener(e,t){const s=this.eventListeners.get(e);if(!s)return;const r=s.indexOf(t);r<0||s.splice(r,1)}static dispatchComponentLifecycleEvent(e,t){const s=this.eventListeners.get(e);if(dO&&console.log("Dispatching event "+e,s),!!s)for(const r of s)r(t)}}h(gg,"eventListeners",new Map);const pO=te("debugdefines");Op('if(!globalThis[""3.32.18-alpha""]) globalThis[""3.32.18-alpha""] = "0.0.0";'),Op('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),Op('if(!globalThis[""Fri Feb 09 2024 20:
|
|
3947
|
+
`+r.src),e.preventDefault())}})}}const tb=te("trackresources");function aO(){return tb==="dispose"}let Pu=!0;tb===0&&(Pu=!1);function oX(i){Pu=i}function lO(){return Pu}const cO=Symbol("disposable");function zC(i,e){i&&(i[cO]=e,Bu&&console.warn("Set disposable",e,i))}const hO=Symbol("disposed");function aX(i){return i[hO]===!0}function Oi(i){var e;if(i){if(i[cO]===!1){Bu&&console.warn("Object is marked as not disposable",i);return}if(i[hO]=!0,i instanceof Vr)Oi(i.environment),Oi(i.background),Oi(i.customDepthMaterial),Oi(i.customDistanceMaterial);else if(i instanceof oa)Oi(i.geometry),Oi(i.material),Oi(i.skeleton),Oi(i.bindMatrix),Oi(i.bindMatrixInverse),Oi(i.customDepthMaterial),Oi(i.customDistanceMaterial),i.geometry=null,i.material=null;else if(i instanceof ve)Oi(i.geometry),Oi(i.material),Oi(i.customDepthMaterial),Oi(i.customDistanceMaterial),i.geometry=null,i.material=null;else if(i instanceof gt){kp(i);for(const t of Object.keys(i.attributes)){const s=i.attributes[t];Oi(s)}}else if(i instanceof Ze||i instanceof Tn)Bu&&console.warn("BufferAttribute dispose not supported",i.count);else if(i instanceof Array)for(const t of i)t instanceof Lt&&Oi(t);else if(i instanceof Lt){kp(i);for(const s of Object.keys(i)){const r=i[s];r instanceof Nt&&(Oi(r),i[s]=null)}const t=i.uniforms;if(t)for(const s of Object.keys(t)){const r=t[s];r instanceof Nt?(Oi(r),t[s]=null):r instanceof Me&&(Oi(r.value),r.value=null)}}else i instanceof Nt?(kp(i),kp(i.source),((e=i.source)==null?void 0:e.data)instanceof ImageBitmap&&kp(i.source.data)):i instanceof lm?(kp(i.boneTexture),i.boneTexture=null):i instanceof Wm||!(i instanceof ye)&&Bu&&console.warn("Unknown object type",i)}}function kp(i){i&&((Bu||aO()||tb)&&console.warn("\u{1F9E8} FREE",i),i instanceof ImageBitmap?i.close():i instanceof Rl?i.data=null:i.dispose())}function uO(i){(i instanceof ve||i instanceof oa)&&(i.material=null,i.geometry=null)}const lX=new Set;function jC(i,e,t=null,s){if(s||(s=lX,s.clear()),!i)return s;const r=i[pg];if(r)for(const n of r)s.has(n)||t?.call(null,n)!==!1&&(s.add(n),e&&jC(n,!0,t,s));return s}function cX(i){return i[fg]}const Bu=te("debugresourceusers")||te("debugmemory"),pg=Symbol("needle-resource-users"),fg=Symbol("needle-resource-users-count");function dn(i,e){Z0(i,e,function(t,s){Pu&&(ib(pg,this,t,!1),ib(pg,this,s,!0))})}Pu&&(dn(ve.prototype,"material"),dn(ve.prototype,"geometry"),dn(Lt.prototype,"map"),dn(Lt.prototype,"bumpMap"),dn(Lt.prototype,"alphaMap"),dn(Lt.prototype,"normalMap"),dn(Lt.prototype,"displacementMap"),dn(Lt.prototype,"roughnessMap"),dn(Lt.prototype,"metalnessMap"),dn(Lt.prototype,"emissiveMap"),dn(Lt.prototype,"specularMap"),dn(Lt.prototype,"envMap"),dn(Lt.prototype,"lightMap"),dn(Lt.prototype,"aoMap"),dn(Lt.prototype,"gradientMap"));function hX(i){if(Pu===!1)return;const e=i[pg];if(e)for(const t of e)ib(pg,t,i,!1)}Pu&&Z0(Lt.prototype,"dispose",function(){hX(this)});let GC=0;function ib(i,e,t,s){if(GC>0)return;if(Array.isArray(t)){for(const n of t)ib(i,e,n,s);return}if(!t)return;let r=t[i];if(r||(r=new Set),s){if(e&&!r.has(e)){r.add(e);let n=t[fg]||0;n+=1,t[fg]=n,Bu&&console.warn(`\u{1F7E2} Added user of "${t.type}"`,e,t,n,"users:",r)}}else if(e&&r.has(e)){r.delete(e);let n=t[fg]||0;n>0&&(n-=1,t[fg]=n),Bu&&console.warn(`\u{1F534} Removed user of "${t.type}"`,e,t,n,"users:",r),n<=0&&(NC.isLoading(t)||(tb&&console.warn(`\u{1F534} Removed all user of "${t.type}"`,t),aO()&&Oi(t)))}t[i]=r}try{Z0(Fl.prototype,"render",function(){GC++},function(){GC--})}catch(i){console.warn("Could not wrap WebGLRenderer.render",i)}var mg=(i=>(i.Added="component-added",i.Removing="removing-component",i))(mg||{});const dO=te("debugcomponentevents");class gg{static addComponentLifecylceEventListener(e,t){this.eventListeners.has(e)&&this.eventListeners.set(e,[]);let s=this.eventListeners.get(e);s||(s=[]),s.push(t),this.eventListeners.set(e,s),dO&&console.log("Added event listener for "+e,this.eventListeners)}static removeComponentLifecylceEventListener(e,t){const s=this.eventListeners.get(e);if(!s)return;const r=s.indexOf(t);r<0||s.splice(r,1)}static dispatchComponentLifecycleEvent(e,t){const s=this.eventListeners.get(e);if(dO&&console.log("Dispatching event "+e,s),!!s)for(const r of s)r(t)}}h(gg,"eventListeners",new Map);const pO=te("debugdefines");Op('if(!globalThis[""3.32.18-alpha.1""]) globalThis[""3.32.18-alpha.1""] = "0.0.0";'),Op('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),Op('if(!globalThis[""Fri Feb 09 2024 20:45:09 GMT+0800 (Pacific Standard Time)""]) globalThis[""Fri Feb 09 2024 20:45:09 GMT+0800 (Pacific Standard Time)""] = "unknown";'),Op('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.32.18-alpha.1";'),Op('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),Op('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Feb 09 2024 20:45:09 GMT+0800 (Pacific Standard Time)";');const Hl="3.32.18-alpha.1",sb="undefined",uX="Fri Feb 09 2024 20:45:09 GMT+0800 (Pacific Standard Time)";pO&&console.log(`Engine version: ${Hl} (generator: ${sb})
|
|
3948
3948
|
Project built at ${uX}`);const Wl="needle_isActiveInHierarchy",Du="builtin_components",vg="needle_editor_guid";function Op(i){try{(0,eval)(i)}catch(e){pO&&console.error(e)}}const Ag=Symbol("NEEDLE_NEED_UPDATE_INSTANCE"),fO=Symbol("isUsingInstancing"),mO=Symbol("instancingRenderer"),QC=Symbol("instancingAutoUpdateBounds");class Pa{static isUsingInstancing(e){return e[fO]===!0}static getRenderer(e){return e[mO]||null}setAutoUpdateBounds(e,t){const s=Pa.getRenderer(e);s&&(s[QC]=t)}static markDirty(e,t=!0){if(e&&(this.isUsingInstancing(e)&&(e[Ag]=!0,e.matrixWorldNeedsUpdate=!0),t))for(const s of e.children)Pa.markDirty(s,!0)}}function ku(i,e){try{e?i(e):i()}catch(t){return console.error(t),!1}return!0}const VC=te("debugnewscripts"),dX=te("debughierarchy"),Wi=[];function pX(){return Wi.length>0}function rb(i){if(!(i.new_scripts.length<=0)){if(VC&&console.log("Register new components",i.new_scripts.length,[...i.new_scripts],i.alias?"element: "+i.alias:i.hash,i),i.new_scripts_pre_setup_callbacks.length>0){for(const e of i.new_scripts_pre_setup_callbacks)e&&e();i.new_scripts_pre_setup_callbacks.length=0}Wi.length=0,i.new_scripts.length>0&&Wi.push(...i.new_scripts),i.new_scripts.length=0;for(let e=0;e<Wi.length;e++)try{const t=Wi[e];if(t.isComponent!==!0){(wt()||VC)&&console.error(`Registered script is not a Needle Engine component.
|
|
3949
3949
|
The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
|
|
3950
3950
|
`,t),Wi.splice(e,1),e--;continue}if(t.destroyed)continue;if(!t.gameObject){console.error("MISSING GAMEOBJECT - will ignore",t),Wi.splice(e,1),e--;continue}t.context=i,yg(t.gameObject),HC(t,i)}catch(t){console.error(t),Xl(Wi[e],i),Wi.splice(e,1),e--}for(let e=0;e<Wi.length;e++)try{const t=Wi[e];if(t.destroyed){Xl(Wi[e],i),Wi.splice(e,1),e--;continue}if(t.registering)try{t.registering()}catch(s){console.error(s)}t.__internalAwake!==void 0&&(t.gameObject||console.error("MISSING GAMEOBJECT",t,t.gameObject),yg(t.gameObject),t.activeAndEnabled&&ku(t.__internalAwake.bind(t)))}catch(t){console.error(t),Xl(Wi[e],i),Wi.splice(e,1),e--}for(let e=0;e<Wi.length;e++)try{const t=Wi[e];if(t.destroyed||t.enabled===!1||(yg(t.gameObject),t.activeAndEnabled===!1))continue;t.__internalEnable!==void 0&&(t.enabled=!0,ku(t.__internalEnable.bind(t)))}catch(t){console.error(t),Xl(Wi[e],i),Wi.splice(e,1),e--}for(let e=0;e<Wi.length;e++)try{const t=Wi[e];if(t.destroyed||!t.gameObject)continue;i.new_script_start.push(t)}catch(t){console.error(t),Xl(Wi[e],i),Wi.splice(e,1),e--}Wi.length=0;for(const e of i.new_scripts_post_setup_callbacks)e&&e();i.new_scripts_post_setup_callbacks.length=0}}function fX(i){i&&(i.__internalDisable(!0),Xl(i,i.context))}function gO(i,e){for(let t=0;t<i.new_script_start.length;t++)try{const s=i.new_script_start[t];if(e!==void 0&&s.gameObject!==e||s.destroyed||s.activeAndEnabled===!1)continue;ku(s.__internalAwake.bind(s)),s.enabled&&(ku(s.__internalEnable.bind(s)),ku(s.__internalStart.bind(s)),i.new_script_start.splice(t,1),t--)}catch(s){console.error(s),Xl(i.new_script_start[t],i),i.new_script_start.splice(t,1),t--}}function HC(i,e){e.scripts.indexOf(i)===-1&&(e.scripts.push(i),i.earlyUpdate&&e.scripts_earlyUpdate.push(i),i.update&&e.scripts_update.push(i),i.lateUpdate&&e.scripts_lateUpdate.push(i),i.onBeforeRender&&e.scripts_onBeforeRender.push(i),i.onAfterRender&&e.scripts_onAfterRender.push(i),i.onPausedChanged&&e.scripts_pausedChanged.push(i),WC(i,null)&&e.new_scripts_xr.push(i),WC(i,"immersive-vr")&&e.scripts_immersive_vr.push(i),WC(i,"immersive-ar")&&e.scripts_immersive_ar.push(i))}function Xl(i,e){To(i,e.new_scripts),To(i,e.new_script_start),To(i,e.scripts),To(i,e.scripts_earlyUpdate),To(i,e.scripts_update),To(i,e.scripts_lateUpdate),To(i,e.scripts_onBeforeRender),To(i,e.scripts_onAfterRender),To(i,e.scripts_pausedChanged),To(i,e.new_scripts_xr),To(i,e.scripts_immersive_vr),To(i,e.scripts_immersive_ar),e.stopAllCoroutinesFrom(i)}function To(i,e){const t=e.indexOf(i);t>=0&&e.splice(t,1)}function WC(i,e){var t;if(i){const s=i;if(s.onBeforeXR||s.onEnterXR||s.onUpdateXR||s.onLeaveXR||s.onXRControllerAdded||s.onXRControllerRemoved)return!(e!=null&&((t=s.supportsXR)==null?void 0:t.call(s,e))===!1)}return!1}function nb(i){if(i||(i=Ti.Current.scene),!i){console.trace("Invalid call - no current context.");return}const e=Kp(i);vO(i,e,!0)||(VC||wt()?console.error(`Error updating hierarchy
|