t3d-ez.gl 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/core/Controls/TTControls/TTControls.cjs.js +1 -0
  2. package/dist/core/Controls/TTControls/TTControls.esm.js +1 -0
  3. package/dist/core/Controls/index.cjs.js +1 -1
  4. package/dist/core/Controls/index.esm.js +1 -1
  5. package/dist/core/MarkerHtmlUI/index.cjs.js +1 -1
  6. package/dist/core/MarkerHtmlUI/index.esm.js +1 -1
  7. package/dist/core/Meshes/Builders/CapsuleBuilder.cjs.js +1 -0
  8. package/dist/core/Meshes/Builders/CapsuleBuilder.esm.js +1 -0
  9. package/dist/core/Meshes/index.cjs.js +1 -1
  10. package/dist/core/Meshes/index.esm.js +1 -1
  11. package/dist/core/WebGLEngine/index.cjs.js +1 -1
  12. package/dist/core/WebGLEngine/index.esm.js +1 -1
  13. package/dist/helpers/InfiniteGridHelper.cjs.js +1 -1
  14. package/dist/helpers/InfiniteGridHelper.esm.js +1 -1
  15. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js +1 -1
  16. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js +1 -1
  17. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js +1 -1
  18. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js +1 -1
  19. package/dist/package.json +4 -1
  20. package/dist/t3d-ez.gl.cjs.js +1 -1
  21. package/dist/t3d-ez.gl.esm.js +1 -1
  22. package/dist/types/core/Controls/TTControls/TTControls.d.ts +332 -0
  23. package/dist/types/core/Controls/index.d.ts +3 -2
  24. package/dist/types/core/Meshes/Builders/CapsuleBuilder.d.ts +19 -0
  25. package/dist/types/core/Meshes/Builders/index.d.ts +1 -0
  26. package/dist/types/core/Meshes/index.d.ts +3 -1
  27. package/dist/types/core/WebGLEngine/index.d.ts +2 -2
  28. package/dist/types/utils/index.d.ts +9 -0
  29. package/package.json +4 -1
@@ -0,0 +1 @@
1
+ "use strict";require("../../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js");var t=require("../../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");const e=new t.Raycaster,o=new t.Vector3,i=new t.Vector3,n=new t.Quaternion,s={X:new t.Vector3(1,0,0),Y:new t.Vector3(0,1,0),Z:new t.Vector3(0,0,1)},a={type:"change"},r={type:"mouseDown",mode:null},h={type:"mouseUp",mode:null},c={type:"objectChange"};class l extends t.Controls{camera;axis;mode;translationSnap;rotationSnap;scaleSnap;space;size;dragging;showX;showY;showZ;minx;maxX;minY;maxY;minZ;maxZ;_root;_gizmo;_plane;constructor(e,o=null){super(e,o);const i=new I(this);this._root=i;const n=new Z;this._gizmo=n,i.add(n);const s=new z;this._plane=s,i.add(s);const r=this;function h(t,e){let o=e;Object.defineProperty(r,t,{get:function(){return void 0!==o?o:e},set:function(e){o!==e&&(o=e,s[t]=e,n[t]=e,r.dispatchEvent({type:t+"-changed",value:e}),r.dispatchEvent(a))}}),r[t]=e,s[t]=e,n[t]=e}h("camera",e),h("object",void 0),h("enabled",!0),h("axis",null),h("mode","translate"),h("translationSnap",null),h("rotationSnap",null),h("scaleSnap",null),h("space","world"),h("size",1),h("dragging",!1),h("showX",!0),h("showY",!0),h("showZ",!0),h("minX",-1/0),h("maxX",1/0),h("minY",-1/0),h("maxY",1/0),h("minZ",-1/0),h("maxZ",1/0);const c=new t.Vector3,l=new t.Vector3,w=new t.Quaternion,x=new t.Quaternion,M=new t.Vector3,b=new t.Quaternion,_=new t.Vector3,v=new t.Vector3,g=new t.Vector3,S=new t.Vector3;h("worldPosition",c),h("worldPositionStart",l),h("worldQuaternion",w),h("worldQuaternionStart",x),h("cameraPosition",M),h("cameraQuaternion",b),h("pointStart",_),h("pointEnd",v),h("rotationAxis",g),h("rotationAngle",0),h("eye",S),this._offset=new t.Vector3,this._startNorm=new t.Vector3,this._endNorm=new t.Vector3,this._cameraScale=new t.Vector3,this._parentPosition=new t.Vector3,this._parentQuaternion=new t.Quaternion,this._parentQuaternionInv=new t.Quaternion,this._parentScale=new t.Vector3,this._worldScaleStart=new t.Vector3,this._worldQuaternionInv=new t.Quaternion,this._worldScale=new t.Vector3,this._positionStart=new t.Vector3,this._quaternionStart=new t.Quaternion,this._scaleStart=new t.Vector3,this._getPointer=p.bind(this),this._onPointerDown=m.bind(this),this._onPointerHover=d.bind(this),this._onPointerMove=u.bind(this),this._onPointerUp=y.bind(this),null!==o&&this.connect(o)}connect(t){super.connect(t),this.domElement&&(this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none")}disconnect(){this.domElement&&(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.domElement.style.touchAction="auto")}getHelper(){return this._root}pointerHover(t){if(void 0===this.object||!0===this.dragging)return;null!==t&&e.setFromCamera(t,this.camera);const o=w(this._gizmo.picker[this.mode],e);o?(this.axis=o.object.name,this.showX=-1!==this.axis.search("X"),this.showY=-1!==this.axis.search("Y"),this.showZ=-1!==this.axis.search("Z")):(this.showX=this.showY=this.showZ=!0,this.axis=null)}pointerDown(o){if(void 0!==this.object&&!0!==this.dragging&&(null==o||0===o.button)&&null!==this.axis){null!==o&&e.setFromCamera(new t.Vector2(o.x,o.y),this.camera);const i=w(this._plane,e,!0);i&&(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(i.point).sub(this.worldPositionStart)),this.dragging=!0,r.mode=this.mode,this.dispatchEvent(r)}}pointerMove(r){const h=this.axis,l=this.mode,p=this.object;let d=this.space;if("scale"===l?d="local":"E"!==h&&"XYZE"!==h&&"XYZ"!==h||(d="world"),void 0===p||null===h||!1===this.dragging||null!==r&&-1!==r.button)return;null!==r&&e.setFromCamera(new t.Vector2(r.x,r.y),this.camera);const m=w(this._plane,e,!0);if(m){if(this.pointEnd.copy(m.point).sub(this.worldPositionStart),"translate"===l)this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===d&&"XYZ"!==h&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===h.indexOf("X")&&(this._offset.x=0),-1===h.indexOf("Y")&&(this._offset.y=0),-1===h.indexOf("Z")&&(this._offset.z=0),"local"===d&&"XYZ"!==h?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),p.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===d&&(p.position.applyQuaternion(n.copy(this._quaternionStart).invert()),-1!==h.search("X")&&(p.position.x=Math.round(p.position.x/this.translationSnap)*this.translationSnap),-1!==h.search("Y")&&(p.position.y=Math.round(p.position.y/this.translationSnap)*this.translationSnap),-1!==h.search("Z")&&(p.position.z=Math.round(p.position.z/this.translationSnap)*this.translationSnap),p.position.applyQuaternion(this._quaternionStart)),"world"===d&&(p.parent&&p.position.add(o.setFromMatrixPosition(p.parent.matrixWorld)),-1!==h.search("X")&&(p.position.x=Math.round(p.position.x/this.translationSnap)*this.translationSnap),-1!==h.search("Y")&&(p.position.y=Math.round(p.position.y/this.translationSnap)*this.translationSnap),-1!==h.search("Z")&&(p.position.z=Math.round(p.position.z/this.translationSnap)*this.translationSnap),p.parent&&p.position.sub(o.setFromMatrixPosition(p.parent.matrixWorld)))),p.position.x=Math.max(this.minX,Math.min(this.maxX,p.position.x)),p.position.y=Math.max(this.minY,Math.min(this.maxY,p.position.y)),p.position.z=Math.max(this.minZ,Math.min(this.maxZ,p.position.z));else if("scale"===l){if(-1!==h.search("XYZ")){let t=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(t*=-1),i.set(t,t,t)}else o.copy(this.pointStart),i.copy(this.pointEnd),o.applyQuaternion(this._worldQuaternionInv),i.applyQuaternion(this._worldQuaternionInv),i.divide(o),-1===h.search("X")&&(i.x=1),-1===h.search("Y")&&(i.y=1),-1===h.search("Z")&&(i.z=1);p.scale.copy(this._scaleStart).multiply(i),this.scaleSnap&&(-1!==h.search("X")&&(p.scale.x=Math.round(p.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==h.search("Y")&&(p.scale.y=Math.round(p.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==h.search("Z")&&(p.scale.z=Math.round(p.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===l){this._offset.copy(this.pointEnd).sub(this.pointStart);const t=20/this.worldPosition.distanceTo(o.setFromMatrixPosition(this.camera.matrixWorld));let e=!1;"XYZE"===h?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(o.copy(this.rotationAxis).cross(this.eye))*t):"X"!==h&&"Y"!==h&&"Z"!==h||(this.rotationAxis.copy(s[h]),o.copy(s[h]),"local"===d&&o.applyQuaternion(this.worldQuaternion),o.cross(this.eye),0===o.length()?e=!0:this.rotationAngle=this._offset.dot(o.normalize())*t),("E"===h||e)&&(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),"local"===d&&"E"!==h&&"XYZE"!==h?(p.quaternion.copy(this._quaternionStart),p.quaternion.multiply(n.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),p.quaternion.copy(n.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),p.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(a),this.dispatchEvent(c)}}pointerUp(t){null!==t&&0!==t.button||(this.dragging&&null!==this.axis&&(h.mode=this.mode,this.dispatchEvent(h)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.dispose()}attach(t){return this.object=t,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,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(a),this.dispatchEvent(c),this.pointStart.copy(this.pointEnd))}getRaycaster(){return e}getMode(){return this.mode}setMode(t){this.mode=t}setTranslationSnap(t){this.translationSnap=t}setRotationSnap(t){this.rotationSnap=t}setScaleSnap(t){this.scaleSnap=t}setSize(t){this.size=t}setSpace(t){this.space=t}setColors(t,e,o,i){const n=this._gizmo.materialLib;n.xAxis.color.set(t),n.yAxis.color.set(e),n.zAxis.color.set(o),n.active.color.set(i),n.xAxisTransparent.color.set(t),n.yAxisTransparent.color.set(e),n.zAxisTransparent.color.set(o),n.activeTransparent.color.set(i),n.xAxis._color&&n.xAxis._color.set(t),n.yAxis._color&&n.yAxis._color.set(e),n.zAxis._color&&n.zAxis._color.set(o),n.active._color&&n.active._color.set(i),n.xAxisTransparent._color&&n.xAxisTransparent._color.set(t),n.yAxisTransparent._color&&n.yAxisTransparent._color.set(e),n.zAxisTransparent._color&&n.zAxisTransparent._color.set(o),n.activeTransparent._color&&n.activeTransparent._color.set(i)}}function p(t){if(this?.domElement){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:t.button};{const e=this.domElement.getBoundingClientRect();return{x:(t.clientX-e.left)/e.width*2-1,y:-(t.clientY-e.top)/e.height*2+1,button:t.button}}}}function d(t){if(this.enabled)switch(t.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(t))}}function m(t){this.enabled&&this.domElement&&(document.pointerLockElement||this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(t)),this.pointerDown(this._getPointer(t)))}function u(t){this.enabled&&this.pointerMove(this._getPointer(t))}function y(t){this.enabled&&this.domElement&&(this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(t)))}function w(t,e,o){const i=e.intersectObject(t,!0);for(let t=0;t<i.length;t++)if(i[t].object.visible||o)return i[t];return!1}const x=new t.Euler,M=new t.Vector3(0,1,0),b=new t.Vector3(0,0,0),_=new t.Matrix4,v=new t.Quaternion,g=new t.Quaternion,S=new t.Vector3,P=new t.Matrix4,f=new t.Vector3(1,0,0),E=new t.Vector3(0,1,0),A=new t.Vector3(0,0,1),Q=new t.Vector3,X=new t.Vector3,Y=new t.Vector3;class I extends t.Object3D{isTransformControlsRoot;controls;constructor(t){super(),this.isTransformControlsRoot=!0,this.controls=t,this.visible=!1}updateMatrixWorld(t){const e=this.controls;void 0!==e.object&&(e.object.updateMatrixWorld(),null===e.object.parent||e.object.parent.matrixWorld.decompose(e._parentPosition,e._parentQuaternion,e._parentScale),e.object.matrixWorld.decompose(e.worldPosition,e.worldQuaternion,e._worldScale),e._parentQuaternionInv.copy(e._parentQuaternion).invert(),e._worldQuaternionInv.copy(e.worldQuaternion).invert()),e.camera.updateMatrixWorld(),e.camera.matrixWorld.decompose(e.cameraPosition,e.cameraQuaternion,e._cameraScale),"isOrthographicCamera"in e.camera&&e.camera.isOrthographicCamera?e.camera.getWorldDirection(e.eye).negate():e.eye.copy(e.cameraPosition).sub(e.worldPosition).normalize(),super.updateMatrixWorld(t)}dispose(){this.traverse(function(t){t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()})}}class Z extends t.Object3D{type;constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new t.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=new t.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=15418969,n=8834357,s=4098799,a=e.clone();a.opacity=.15;const r=o.clone();r.opacity=.5;const h=e.clone();h.color.setHex(i);const c=e.clone();c.color.setHex(n);const l=e.clone();l.color.setHex(s);const p=e.clone();p.color.setHex(i),p.opacity=.5;const d=e.clone();d.color.setHex(n),d.opacity=.5;const m=e.clone();m.color.setHex(s),m.opacity=.5;e.clone().opacity=.25;const u=e.clone();u.color.setHex(65501),u.opacity=.25;const y=e.clone();y.color.setHex(65501);e.clone().color.setHex(7895160),this.materialLib={xAxis:h,yAxis:c,zAxis:l,active:y,xAxisTransparent:p,yAxisTransparent:d,zAxisTransparent:m,activeTransparent:u};const w=.006,x=1.2*Math.PI,M=.05,b=new t.CylinderGeometry(0,.018,.065,32);b.translate(0,-.15,0);const _=new t.BoxGeometry(M,M,M);_.translate(0,-.15,0);const v=new t.BufferGeometry;v.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const g=new t.CylinderGeometry(w,w,.28,32);function S(e,o){const i=new t.TorusGeometry(e,w,3,64,x);return i.rotateY(Math.PI/2),i.rotateX(Math.PI/2),i}g.translate(0,.2,0);const P=.05,f={X:[[new t.Mesh(b,h),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(g,h),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(b,c),[0,.5,0]],[new t.Mesh(g,c)]],Z:[[new t.Mesh(b,l),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(g,l),null,[Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(P,P,.01),m),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(P,P,.01),p),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(P,P,.01),d),[.15,0,.15],[-Math.PI/2,0,0]]]},E={X:[[new t.Mesh(b,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(g,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(b,a),[0,.5,0]],[new t.Mesh(g,a)]],Z:[[new t.Mesh(b,a),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(g,a),null,[Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(P,P,.01),a),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(P,P,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(P,P,.01),a),[.15,0,.15],[-Math.PI/2,0,0]]]};new t.Mesh(new t.OctahedronGeometry(.01,2),r),new t.Mesh(new t.OctahedronGeometry(.01,2),r),new t.Line(function(){const e=new t.BufferGeometry;return e.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),e}(),r),new t.Line(v,r),new t.Line(v,r),Math.PI,new t.Line(v,r),Math.PI;const A=.2,Q={X:[[new t.Mesh(S(A),h)]],Y:[[new t.Mesh(S(A),c),null,[0,0,-Math.PI/2]]],Z:[[new t.Mesh(S(A),l),null,[0,Math.PI/2,0]]]};new t.Line(v,r);const X={X:[[new t.Mesh(new t.TorusGeometry(A,w,4,24,x),a),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new t.Mesh(new t.TorusGeometry(A,w,4,24,x),a),[0,0,0],[Math.PI/2,0,0]]],Z:[[new t.Mesh(new t.TorusGeometry(A,w,4,24,x),a),[0,0,0],[0,0,-Math.PI/2]]]},Y={X:[[new t.Mesh(_,h),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(g,h),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(_,c),[0,.5,0]],[new t.Mesh(g,c)]],Z:[[new t.Mesh(_,l),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(g,l),[0,0,0],[Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(M,M,.01),m),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(M,M,.01),p),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(M,M,.01),d),[.15,0,.15],[-Math.PI/2,0,0]]]},I={X:[[new t.Mesh(_,h),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(g,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(_,c),[0,.5,0]],[new t.Mesh(g,a)]],Z:[[new t.Mesh(_,l),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(g,a),[0,0,0],[Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(M,M,.01),a),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(M,M,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(M,M,.01),a),[.15,0,.15],[-Math.PI/2,0,0]]]};function Z(e){const o=new t.Object3D;for(const t in e)for(let i=e[t].length;i--;){const n=e[t][i][0].clone(),s=e[t][i][1],a=e[t][i][2],r=e[t][i][3],h=e[t][i][4];n.name=t,n.tag=h,s&&n.position.set(s[0],s[1],s[2]),a&&n.rotation.set(a[0],a[1],a[2]),r&&n.scale.set(r[0],r[1],r[2]),n.updateMatrix();const c=n.geometry.clone();c.applyMatrix4(n.matrix),n.geometry=c,n.renderOrder=1/0,n.position.set(0,0,0),n.rotation.set(0,0,0),n.scale.set(1,1,1),o.add(n)}return o}new t.Line(v,r),new t.Line(v,r),Math.PI,new t.Line(v,r),Math.PI,this.gizmo={},this.picker={},this.helper={},this.gizmo.rotate=Z(Q),this.add(this.gizmo.rotate),this.add(this.gizmo.translate=Z(f)),this.add(this.gizmo.scale=Z(Y)),this.add(this.picker.translate=Z(E)),this.add(this.picker.rotate=Z(X)),this.add(this.picker.scale=Z(I)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(t){const e="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:g;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode;let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children);for(let t=0;t<i.length;t++){const s=i[t];let a;if(s.visible=!0,s.rotation.set(0,0,0),s.position.copy(this.worldPosition),a=this.camera.isOrthographicCamera?(this.camera.top-this.camera.bottom)/this.camera.zoom:this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),s.scale.set(1,1,1).multiplyScalar(a*this.size/4),"tag"in s&&"helper"===s.tag){s.visible=!1,"AXIS"===s.name?(s.visible=!!this.axis,"X"===this.axis&&(n.setFromEuler(x.set(0,0,0)),s.quaternion.copy(e).multiply(n),Math.abs(M.copy(f).applyQuaternion(e).dot(this.eye))>.9&&(s.visible=!1)),"Y"===this.axis&&(n.setFromEuler(x.set(0,0,Math.PI/2)),s.quaternion.copy(e).multiply(n),Math.abs(M.copy(E).applyQuaternion(e).dot(this.eye))>.9&&(s.visible=!1)),"Z"===this.axis&&(n.setFromEuler(x.set(0,Math.PI/2,0)),s.quaternion.copy(e).multiply(n),Math.abs(M.copy(A).applyQuaternion(e).dot(this.eye))>.9&&(s.visible=!1)),"XYZE"===this.axis&&(n.setFromEuler(x.set(0,Math.PI/2,0)),M.copy(this.rotationAxis),s.quaternion.setFromRotationMatrix(_.lookAt(b,M,E)),s.quaternion.multiply(n),s.visible=this.dragging),"E"===this.axis&&(s.visible=!1)):"START"===s.name?(s.position.copy(this.worldPositionStart),s.visible=this.dragging):"END"===s.name?(s.position.copy(this.worldPosition),s.visible=this.dragging):"DELTA"===s.name?(s.position.copy(this.worldPositionStart),s.quaternion.copy(this.worldQuaternionStart),o.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),o.applyQuaternion(this.worldQuaternionStart.clone().invert()),s.scale.copy(o),s.visible=this.dragging):(s.quaternion.copy(e),this.dragging?s.position.copy(this.worldPositionStart):s.position.copy(this.worldPosition),this.axis&&(s.visible=-1!==this.axis.search(s.name)));continue}if(s.quaternion.copy(e),"translate"===this.mode||"scale"===this.mode){const t=.99,o=.2;"X"===s.name&&Math.abs(M.copy(f).applyQuaternion(e).dot(this.eye))>t&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"Y"===s.name&&Math.abs(M.copy(E).applyQuaternion(e).dot(this.eye))>t&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"Z"===s.name&&Math.abs(M.copy(A).applyQuaternion(e).dot(this.eye))>t&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"XY"===s.name&&Math.abs(M.copy(A).applyQuaternion(e).dot(this.eye))<o&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"YZ"===s.name&&Math.abs(M.copy(f).applyQuaternion(e).dot(this.eye))<o&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"XZ"===s.name&&Math.abs(M.copy(E).applyQuaternion(e).dot(this.eye))<o&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1)}else"rotate"===this.mode&&(v.copy(e),M.copy(this.eye).applyQuaternion(n.copy(e).invert()),-1!==s.name.search("E")&&s.quaternion.setFromRotationMatrix(_.lookAt(this.eye,b,E)),"X"===s.name&&(n.setFromAxisAngle(f,Math.atan2(-M.y,M.z)),n.multiplyQuaternions(v,n),s.quaternion.copy(n)),"Y"===s.name&&(n.setFromAxisAngle(E,Math.atan2(M.x,M.z)),n.multiplyQuaternions(v,n),s.quaternion.copy(n)),"Z"===s.name&&(n.setFromAxisAngle(A,Math.atan2(M.y,M.x)),n.multiplyQuaternions(v,n),s.quaternion.copy(n)));s.visible=s.visible&&(-1===s.name.indexOf("X")||this.showX),s.visible=s.visible&&(-1===s.name.indexOf("Y")||this.showY),s.visible=s.visible&&(-1===s.name.indexOf("Z")||this.showZ),s.visible=s.visible&&(-1===s.name.indexOf("E")||this.showX&&this.showY&&this.showZ);const r=s.material;r._color=r._color||r.color.clone(),r._opacity=r._opacity||r.opacity,r.color.copy(r._color),r.opacity=r._opacity,this.enabled&&this.axis&&(s.name===this.axis||this.axis.split("").some(function(t){return s.name===t}))&&(r.color.copy(this.materialLib.active.color),r.opacity=1)}super.updateMatrixWorld(t)}}class z extends t.Mesh{type="";constructor(){super(new t.PlaneGeometry(1e5,1e5,2,2),new t.MeshBasicMaterial({visible:!1,wireframe:!0,side:t.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(t){let e=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(e="local"),Q.copy(f).applyQuaternion("local"===e?this.worldQuaternion:g),X.copy(E).applyQuaternion("local"===e?this.worldQuaternion:g),Y.copy(A).applyQuaternion("local"===e?this.worldQuaternion:g),M.copy(X),this.mode){case"translate":case"scale":switch(this.axis){case"X":M.copy(this.eye).cross(Q),S.copy(Q).cross(M);break;case"Y":M.copy(this.eye).cross(X),S.copy(X).cross(M);break;case"Z":M.copy(this.eye).cross(Y),S.copy(Y).cross(M);break;case"XY":S.copy(Y);break;case"YZ":S.copy(Q);break;case"XZ":M.copy(Y),S.copy(X);break;case"XYZ":case"E":S.set(0,0,0)}break;default:S.set(0,0,0)}0===S.length()?this.quaternion.copy(this.cameraQuaternion):(P.lookAt(o.set(0,0,0),S,M),this.quaternion.setFromRotationMatrix(P)),super.updateMatrixWorld(t)}}exports.TTControls=l,exports.TransformControlsGizmo=Z,exports.TransformControlsPlane=z;
@@ -0,0 +1 @@
1
+ import"../../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{Raycaster as t,Vector3 as e,Matrix4 as i,Controls as o,Quaternion as n,Vector2 as s,Object3D as a,MeshBasicMaterial as r,LineBasicMaterial as h,CylinderGeometry as l,BoxGeometry as c,BufferGeometry as p,Float32BufferAttribute as d,Mesh as m,Line as u,OctahedronGeometry as w,TorusGeometry as y,Euler as x,PlaneGeometry as _,DoubleSide as b}from"../../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";const v=new t,g=new e,M=new e,S=new n,P={X:new e(1,0,0),Y:new e(0,1,0),Z:new e(0,0,1)},f={type:"change"},E={type:"mouseDown",mode:null},A={type:"mouseUp",mode:null},X={type:"objectChange"};class Y extends o{camera;axis;mode;translationSnap;rotationSnap;scaleSnap;space;size;dragging;showX;showY;showZ;minx;maxX;minY;maxY;minZ;maxZ;_root;_gizmo;_plane;constructor(t,i=null){super(t,i);const o=new J(this);this._root=o;const s=new K;this._gizmo=s,o.add(s);const a=new V;this._plane=a,o.add(a);const r=this;function h(t,e){let i=e;Object.defineProperty(r,t,{get:function(){return void 0!==i?i:e},set:function(e){i!==e&&(i=e,a[t]=e,s[t]=e,r.dispatchEvent({type:t+"-changed",value:e}),r.dispatchEvent(f))}}),r[t]=e,a[t]=e,s[t]=e}h("camera",t),h("object",void 0),h("enabled",!0),h("axis",null),h("mode","translate"),h("translationSnap",null),h("rotationSnap",null),h("scaleSnap",null),h("space","world"),h("size",1),h("dragging",!1),h("showX",!0),h("showY",!0),h("showZ",!0),h("minX",-1/0),h("maxX",1/0),h("minY",-1/0),h("maxY",1/0),h("minZ",-1/0),h("maxZ",1/0);const l=new e,c=new e,p=new n,d=new n,m=new e,u=new n,w=new e,y=new e,x=new e,_=new e;h("worldPosition",l),h("worldPositionStart",c),h("worldQuaternion",p),h("worldQuaternionStart",d),h("cameraPosition",m),h("cameraQuaternion",u),h("pointStart",w),h("pointEnd",y),h("rotationAxis",x),h("rotationAngle",0),h("eye",_),this._offset=new e,this._startNorm=new e,this._endNorm=new e,this._cameraScale=new e,this._parentPosition=new e,this._parentQuaternion=new n,this._parentQuaternionInv=new n,this._parentScale=new e,this._worldScaleStart=new e,this._worldQuaternionInv=new n,this._worldScale=new e,this._positionStart=new e,this._quaternionStart=new n,this._scaleStart=new e,this._getPointer=I.bind(this),this._onPointerDown=Z.bind(this),this._onPointerHover=Q.bind(this),this._onPointerMove=z.bind(this),this._onPointerUp=T.bind(this),null!==i&&this.connect(i)}connect(t){super.connect(t),this.domElement&&(this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none")}disconnect(){this.domElement&&(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.domElement.style.touchAction="auto")}getHelper(){return this._root}pointerHover(t){if(void 0===this.object||!0===this.dragging)return;null!==t&&v.setFromCamera(t,this.camera);const e=q(this._gizmo.picker[this.mode],v);e?(this.axis=e.object.name,this.showX=-1!==this.axis.search("X"),this.showY=-1!==this.axis.search("Y"),this.showZ=-1!==this.axis.search("Z")):(this.showX=this.showY=this.showZ=!0,this.axis=null)}pointerDown(t){if(void 0!==this.object&&!0!==this.dragging&&(null==t||0===t.button)&&null!==this.axis){null!==t&&v.setFromCamera(new s(t.x,t.y),this.camera);const e=q(this._plane,v,!0);e&&(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(e.point).sub(this.worldPositionStart)),this.dragging=!0,E.mode=this.mode,this.dispatchEvent(E)}}pointerMove(t){const e=this.axis,i=this.mode,o=this.object;let n=this.space;if("scale"===i?n="local":"E"!==e&&"XYZE"!==e&&"XYZ"!==e||(n="world"),void 0===o||null===e||!1===this.dragging||null!==t&&-1!==t.button)return;null!==t&&v.setFromCamera(new s(t.x,t.y),this.camera);const a=q(this._plane,v,!0);if(a){if(this.pointEnd.copy(a.point).sub(this.worldPositionStart),"translate"===i)this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===n&&"XYZ"!==e&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===e.indexOf("X")&&(this._offset.x=0),-1===e.indexOf("Y")&&(this._offset.y=0),-1===e.indexOf("Z")&&(this._offset.z=0),"local"===n&&"XYZ"!==e?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),o.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===n&&(o.position.applyQuaternion(S.copy(this._quaternionStart).invert()),-1!==e.search("X")&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.position.applyQuaternion(this._quaternionStart)),"world"===n&&(o.parent&&o.position.add(g.setFromMatrixPosition(o.parent.matrixWorld)),-1!==e.search("X")&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.parent&&o.position.sub(g.setFromMatrixPosition(o.parent.matrixWorld)))),o.position.x=Math.max(this.minX,Math.min(this.maxX,o.position.x)),o.position.y=Math.max(this.minY,Math.min(this.maxY,o.position.y)),o.position.z=Math.max(this.minZ,Math.min(this.maxZ,o.position.z));else if("scale"===i){if(-1!==e.search("XYZ")){let t=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(t*=-1),M.set(t,t,t)}else g.copy(this.pointStart),M.copy(this.pointEnd),g.applyQuaternion(this._worldQuaternionInv),M.applyQuaternion(this._worldQuaternionInv),M.divide(g),-1===e.search("X")&&(M.x=1),-1===e.search("Y")&&(M.y=1),-1===e.search("Z")&&(M.z=1);o.scale.copy(this._scaleStart).multiply(M),this.scaleSnap&&(-1!==e.search("X")&&(o.scale.x=Math.round(o.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Y")&&(o.scale.y=Math.round(o.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Z")&&(o.scale.z=Math.round(o.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===i){this._offset.copy(this.pointEnd).sub(this.pointStart);const t=20/this.worldPosition.distanceTo(g.setFromMatrixPosition(this.camera.matrixWorld));let i=!1;"XYZE"===e?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(g.copy(this.rotationAxis).cross(this.eye))*t):"X"!==e&&"Y"!==e&&"Z"!==e||(this.rotationAxis.copy(P[e]),g.copy(P[e]),"local"===n&&g.applyQuaternion(this.worldQuaternion),g.cross(this.eye),0===g.length()?i=!0:this.rotationAngle=this._offset.dot(g.normalize())*t),("E"===e||i)&&(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),"local"===n&&"E"!==e&&"XYZE"!==e?(o.quaternion.copy(this._quaternionStart),o.quaternion.multiply(S.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),o.quaternion.copy(S.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),o.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(f),this.dispatchEvent(X)}}pointerUp(t){null!==t&&0!==t.button||(this.dragging&&null!==this.axis&&(A.mode=this.mode,this.dispatchEvent(A)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.dispose()}attach(t){return this.object=t,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,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(f),this.dispatchEvent(X),this.pointStart.copy(this.pointEnd))}getRaycaster(){return v}getMode(){return this.mode}setMode(t){this.mode=t}setTranslationSnap(t){this.translationSnap=t}setRotationSnap(t){this.rotationSnap=t}setScaleSnap(t){this.scaleSnap=t}setSize(t){this.size=t}setSpace(t){this.space=t}setColors(t,e,i,o){const n=this._gizmo.materialLib;n.xAxis.color.set(t),n.yAxis.color.set(e),n.zAxis.color.set(i),n.active.color.set(o),n.xAxisTransparent.color.set(t),n.yAxisTransparent.color.set(e),n.zAxisTransparent.color.set(i),n.activeTransparent.color.set(o),n.xAxis._color&&n.xAxis._color.set(t),n.yAxis._color&&n.yAxis._color.set(e),n.zAxis._color&&n.zAxis._color.set(i),n.active._color&&n.active._color.set(o),n.xAxisTransparent._color&&n.xAxisTransparent._color.set(t),n.yAxisTransparent._color&&n.yAxisTransparent._color.set(e),n.zAxisTransparent._color&&n.zAxisTransparent._color.set(i),n.activeTransparent._color&&n.activeTransparent._color.set(o)}}function I(t){if(this?.domElement){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:t.button};{const e=this.domElement.getBoundingClientRect();return{x:(t.clientX-e.left)/e.width*2-1,y:-(t.clientY-e.top)/e.height*2+1,button:t.button}}}}function Q(t){if(this.enabled)switch(t.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(t))}}function Z(t){this.enabled&&this.domElement&&(document.pointerLockElement||this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(t)),this.pointerDown(this._getPointer(t)))}function z(t){this.enabled&&this.pointerMove(this._getPointer(t))}function T(t){this.enabled&&this.domElement&&(this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(t)))}function q(t,e,i){const o=e.intersectObject(t,!0);for(let t=0;t<o.length;t++)if(o[t].object.visible||i)return o[t];return!1}const j=new x,k=new e(0,1,0),W=new e(0,0,0),F=new i,C=new n,H=new n,L=new e,O=new i,D=new e(1,0,0),R=new e(0,1,0),N=new e(0,0,1),U=new e,G=new e,B=new e;class J extends a{isTransformControlsRoot;controls;constructor(t){super(),this.isTransformControlsRoot=!0,this.controls=t,this.visible=!1}updateMatrixWorld(t){const e=this.controls;void 0!==e.object&&(e.object.updateMatrixWorld(),null===e.object.parent||e.object.parent.matrixWorld.decompose(e._parentPosition,e._parentQuaternion,e._parentScale),e.object.matrixWorld.decompose(e.worldPosition,e.worldQuaternion,e._worldScale),e._parentQuaternionInv.copy(e._parentQuaternion).invert(),e._worldQuaternionInv.copy(e.worldQuaternion).invert()),e.camera.updateMatrixWorld(),e.camera.matrixWorld.decompose(e.cameraPosition,e.cameraQuaternion,e._cameraScale),"isOrthographicCamera"in e.camera&&e.camera.isOrthographicCamera?e.camera.getWorldDirection(e.eye).negate():e.eye.copy(e.cameraPosition).sub(e.worldPosition).normalize(),super.updateMatrixWorld(t)}dispose(){this.traverse(function(t){t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()})}}class K extends a{type;constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const t=new r({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new h({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=15418969,o=8834357,n=4098799,s=t.clone();s.opacity=.15;const x=e.clone();x.opacity=.5;const _=t.clone();_.color.setHex(i);const b=t.clone();b.color.setHex(o);const v=t.clone();v.color.setHex(n);const g=t.clone();g.color.setHex(i),g.opacity=.5;const M=t.clone();M.color.setHex(o),M.opacity=.5;const S=t.clone();S.color.setHex(n),S.opacity=.5;t.clone().opacity=.25;const P=t.clone();P.color.setHex(65501),P.opacity=.25;const f=t.clone();f.color.setHex(65501);t.clone().color.setHex(7895160),this.materialLib={xAxis:_,yAxis:b,zAxis:v,active:f,xAxisTransparent:g,yAxisTransparent:M,zAxisTransparent:S,activeTransparent:P};const E=.006,A=1.2*Math.PI,X=.05,Y=new l(0,.018,.065,32);Y.translate(0,-.15,0);const I=new c(X,X,X);I.translate(0,-.15,0);const Q=new p;Q.setAttribute("position",new d([0,0,0,1,0,0],3));const Z=new l(E,E,.28,32);function z(t,e){const i=new y(t,E,3,64,A);return i.rotateY(Math.PI/2),i.rotateX(Math.PI/2),i}Z.translate(0,.2,0);const T=.05,q={X:[[new m(Y,_),[.5,0,0],[0,0,-Math.PI/2]],[new m(Z,_),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new m(Y,b),[0,.5,0]],[new m(Z,b)]],Z:[[new m(Y,v),[0,0,.5],[Math.PI/2,0,0]],[new m(Z,v),null,[Math.PI/2,0,0]]],XY:[[new m(new c(T,T,.01),S),[.15,.15,0]]],YZ:[[new m(new c(T,T,.01),g),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new m(new c(T,T,.01),M),[.15,0,.15],[-Math.PI/2,0,0]]]},j={X:[[new m(Y,s),[.5,0,0],[0,0,-Math.PI/2]],[new m(Z,s),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new m(Y,s),[0,.5,0]],[new m(Z,s)]],Z:[[new m(Y,s),[0,0,.5],[Math.PI/2,0,0]],[new m(Z,s),null,[Math.PI/2,0,0]]],XY:[[new m(new c(T,T,.01),s),[.15,.15,0]]],YZ:[[new m(new c(T,T,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new m(new c(T,T,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]};new m(new w(.01,2),x),new m(new w(.01,2),x),new u(function(){const t=new p;return t.setAttribute("position",new d([0,0,0,1,1,1],3)),t}(),x),new u(Q,x),new u(Q,x),Math.PI,new u(Q,x),Math.PI;const k=.2,W={X:[[new m(z(k),_)]],Y:[[new m(z(k),b),null,[0,0,-Math.PI/2]]],Z:[[new m(z(k),v),null,[0,Math.PI/2,0]]]};new u(Q,x);const F={X:[[new m(new y(k,E,4,24,A),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new m(new y(k,E,4,24,A),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new m(new y(k,E,4,24,A),s),[0,0,0],[0,0,-Math.PI/2]]]},C={X:[[new m(I,_),[.5,0,0],[0,0,-Math.PI/2]],[new m(Z,_),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new m(I,b),[0,.5,0]],[new m(Z,b)]],Z:[[new m(I,v),[0,0,.5],[Math.PI/2,0,0]],[new m(Z,v),[0,0,0],[Math.PI/2,0,0]]],XY:[[new m(new c(X,X,.01),S),[.15,.15,0]]],YZ:[[new m(new c(X,X,.01),g),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new m(new c(X,X,.01),M),[.15,0,.15],[-Math.PI/2,0,0]]]},H={X:[[new m(I,_),[.5,0,0],[0,0,-Math.PI/2]],[new m(Z,s),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new m(I,b),[0,.5,0]],[new m(Z,s)]],Z:[[new m(I,v),[0,0,.5],[Math.PI/2,0,0]],[new m(Z,s),[0,0,0],[Math.PI/2,0,0]]],XY:[[new m(new c(X,X,.01),s),[.15,.15,0]]],YZ:[[new m(new c(X,X,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new m(new c(X,X,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]};function L(t){const e=new a;for(const i in t)for(let o=t[i].length;o--;){const n=t[i][o][0].clone(),s=t[i][o][1],a=t[i][o][2],r=t[i][o][3],h=t[i][o][4];n.name=i,n.tag=h,s&&n.position.set(s[0],s[1],s[2]),a&&n.rotation.set(a[0],a[1],a[2]),r&&n.scale.set(r[0],r[1],r[2]),n.updateMatrix();const l=n.geometry.clone();l.applyMatrix4(n.matrix),n.geometry=l,n.renderOrder=1/0,n.position.set(0,0,0),n.rotation.set(0,0,0),n.scale.set(1,1,1),e.add(n)}return e}new u(Q,x),new u(Q,x),Math.PI,new u(Q,x),Math.PI,this.gizmo={},this.picker={},this.helper={},this.gizmo.rotate=L(W),this.add(this.gizmo.rotate),this.add(this.gizmo.translate=L(q)),this.add(this.gizmo.scale=L(C)),this.add(this.picker.translate=L(j)),this.add(this.picker.rotate=L(F)),this.add(this.picker.scale=L(H)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(t){const e="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:H;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode;let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children);for(let t=0;t<i.length;t++){const o=i[t];let n;if(o.visible=!0,o.rotation.set(0,0,0),o.position.copy(this.worldPosition),n=this.camera.isOrthographicCamera?(this.camera.top-this.camera.bottom)/this.camera.zoom:this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),o.scale.set(1,1,1).multiplyScalar(n*this.size/4),"tag"in o&&"helper"===o.tag){o.visible=!1,"AXIS"===o.name?(o.visible=!!this.axis,"X"===this.axis&&(S.setFromEuler(j.set(0,0,0)),o.quaternion.copy(e).multiply(S),Math.abs(k.copy(D).applyQuaternion(e).dot(this.eye))>.9&&(o.visible=!1)),"Y"===this.axis&&(S.setFromEuler(j.set(0,0,Math.PI/2)),o.quaternion.copy(e).multiply(S),Math.abs(k.copy(R).applyQuaternion(e).dot(this.eye))>.9&&(o.visible=!1)),"Z"===this.axis&&(S.setFromEuler(j.set(0,Math.PI/2,0)),o.quaternion.copy(e).multiply(S),Math.abs(k.copy(N).applyQuaternion(e).dot(this.eye))>.9&&(o.visible=!1)),"XYZE"===this.axis&&(S.setFromEuler(j.set(0,Math.PI/2,0)),k.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(F.lookAt(W,k,R)),o.quaternion.multiply(S),o.visible=this.dragging),"E"===this.axis&&(o.visible=!1)):"START"===o.name?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):"END"===o.name?(o.position.copy(this.worldPosition),o.visible=this.dragging):"DELTA"===o.name?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),g.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),g.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(g),o.visible=this.dragging):(o.quaternion.copy(e),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=-1!==this.axis.search(o.name)));continue}if(o.quaternion.copy(e),"translate"===this.mode||"scale"===this.mode){const t=.99,i=.2;"X"===o.name&&Math.abs(k.copy(D).applyQuaternion(e).dot(this.eye))>t&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"Y"===o.name&&Math.abs(k.copy(R).applyQuaternion(e).dot(this.eye))>t&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"Z"===o.name&&Math.abs(k.copy(N).applyQuaternion(e).dot(this.eye))>t&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"XY"===o.name&&Math.abs(k.copy(N).applyQuaternion(e).dot(this.eye))<i&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"YZ"===o.name&&Math.abs(k.copy(D).applyQuaternion(e).dot(this.eye))<i&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"XZ"===o.name&&Math.abs(k.copy(R).applyQuaternion(e).dot(this.eye))<i&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)}else"rotate"===this.mode&&(C.copy(e),k.copy(this.eye).applyQuaternion(S.copy(e).invert()),-1!==o.name.search("E")&&o.quaternion.setFromRotationMatrix(F.lookAt(this.eye,W,R)),"X"===o.name&&(S.setFromAxisAngle(D,Math.atan2(-k.y,k.z)),S.multiplyQuaternions(C,S),o.quaternion.copy(S)),"Y"===o.name&&(S.setFromAxisAngle(R,Math.atan2(k.x,k.z)),S.multiplyQuaternions(C,S),o.quaternion.copy(S)),"Z"===o.name&&(S.setFromAxisAngle(N,Math.atan2(k.y,k.x)),S.multiplyQuaternions(C,S),o.quaternion.copy(S)));o.visible=o.visible&&(-1===o.name.indexOf("X")||this.showX),o.visible=o.visible&&(-1===o.name.indexOf("Y")||this.showY),o.visible=o.visible&&(-1===o.name.indexOf("Z")||this.showZ),o.visible=o.visible&&(-1===o.name.indexOf("E")||this.showX&&this.showY&&this.showZ);const s=o.material;s._color=s._color||s.color.clone(),s._opacity=s._opacity||s.opacity,s.color.copy(s._color),s.opacity=s._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(t){return o.name===t}))&&(s.color.copy(this.materialLib.active.color),s.opacity=1)}super.updateMatrixWorld(t)}}class V extends m{type="";constructor(){super(new _(1e5,1e5,2,2),new r({visible:!1,wireframe:!0,side:b,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(t){let e=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(e="local"),U.copy(D).applyQuaternion("local"===e?this.worldQuaternion:H),G.copy(R).applyQuaternion("local"===e?this.worldQuaternion:H),B.copy(N).applyQuaternion("local"===e?this.worldQuaternion:H),k.copy(G),this.mode){case"translate":case"scale":switch(this.axis){case"X":k.copy(this.eye).cross(U),L.copy(U).cross(k);break;case"Y":k.copy(this.eye).cross(G),L.copy(G).cross(k);break;case"Z":k.copy(this.eye).cross(B),L.copy(B).cross(k);break;case"XY":L.copy(B);break;case"YZ":L.copy(U);break;case"XZ":k.copy(B),L.copy(G);break;case"XYZ":case"E":L.set(0,0,0)}break;default:L.set(0,0,0)}0===L.length()?this.quaternion.copy(this.cameraQuaternion):(O.lookAt(g.set(0,0,0),L,k),this.quaternion.setFromRotationMatrix(O)),super.updateMatrixWorld(t)}}export{Y as TTControls,K as TransformControlsGizmo,V as TransformControlsPlane};
@@ -1 +1 @@
1
- "use strict";var e,r=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/OrbitControls.cjs.js"),o=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/TrackballControls.cjs.js"),t=require("./controlsLibs/FirstControls.cjs.js"),n=require("../../utils/Logger.cjs.js"),s=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");exports.CONTROL_TYPE=void 0,(e=exports.CONTROL_TYPE||(exports.CONTROL_TYPE={}))[e.ORBIT=0]="ORBIT",e[e.TRACKBALL=1]="TRACKBALL",e[e.FIRSTPERSON=2]="FIRSTPERSON";const i=new Map([[exports.CONTROL_TYPE.ORBIT,r.OrbitControls],[exports.CONTROL_TYPE.TRACKBALL,o.TrackballControls],[exports.CONTROL_TYPE.FIRSTPERSON,t.FirstControls]]);exports.ControlsManager=class{engine;CONTROL_TYPE;constructor(e){this.CONTROL_TYPE=exports.CONTROL_TYPE,this.engine=e}createControls(e=0,r,o){if(o instanceof HTMLElement){if(r instanceof s.Camera)return i.has(e)?(exports.CONTROL_TYPE.ORBIT,this.initOrbitControls(r,o)):(n.Logger.warn("ControlManager","Control type is not defined , default to OrbitControls"),new(i.get(exports.CONTROL_TYPE.ORBIT))(r,o));n.Logger.error("ControlManager","Camera is not defined")}else n.Logger.error("ControlManager","DomElement is not defined")}initOrbitControls(e,o){const t=new r.OrbitControls(e,o);return t.enableDamping=!0,t.dampingFactor=.85,t.screenSpacePanning=!1,t}initFirstpersonControls(e,r){const o=new t.FirstControls(e,r);return o.pointerSpeed=.05,r.addEventListener("click",()=>o.lock()),o}initTrackballControls(e,r){return new o.TrackballControls(e,r)}};
1
+ "use strict";var e,r=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/OrbitControls.cjs.js"),o=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/TrackballControls.cjs.js"),t=require("./controlsLibs/FirstControls.cjs.js"),n=require("../../utils/Logger.cjs.js"),s=require("./TTControls/TTControls.cjs.js"),l=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");exports.CONTROL_TYPE=void 0,(e=exports.CONTROL_TYPE||(exports.CONTROL_TYPE={}))[e.ORBIT=0]="ORBIT",e[e.TRACKBALL=1]="TRACKBALL",e[e.FIRSTPERSON=2]="FIRSTPERSON";const i=new Map([[exports.CONTROL_TYPE.ORBIT,r.OrbitControls],[exports.CONTROL_TYPE.TRACKBALL,o.TrackballControls],[exports.CONTROL_TYPE.FIRSTPERSON,t.FirstControls]]);exports.TTControls=s.TTControls,exports.ControlsManager=class{engine;CONTROL_TYPE;constructor(e){this.CONTROL_TYPE=exports.CONTROL_TYPE,this.engine=e}createControls(e=0,r,o){if(o instanceof HTMLElement){if(r instanceof l.Camera)return i.has(e)?(exports.CONTROL_TYPE.ORBIT,this.initOrbitControls(r,o)):(n.Logger.warn("ControlManager","Control type is not defined , default to OrbitControls"),new(i.get(exports.CONTROL_TYPE.ORBIT))(r,o));n.Logger.error("ControlManager","Camera is not defined")}else n.Logger.error("ControlManager","DomElement is not defined")}initOrbitControls(e,o){const t=new r.OrbitControls(e,o);return t.enableDamping=!0,t.dampingFactor=.85,t.screenSpacePanning=!1,t}initFirstpersonControls(e,r){const o=new t.FirstControls(e,r);return o.pointerSpeed=.05,r.addEventListener("click",()=>o.lock()),o}initTrackballControls(e,r){return new o.TrackballControls(e,r)}};
@@ -1 +1 @@
1
- import{OrbitControls as e}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/OrbitControls.esm.js";import{TrackballControls as o}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/TrackballControls.esm.js";import{FirstControls as n}from"./controlsLibs/FirstControls.esm.js";import{Logger as r}from"../../utils/Logger.esm.js";import{Camera as t}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";var s;!function(e){e[e.ORBIT=0]="ORBIT",e[e.TRACKBALL=1]="TRACKBALL",e[e.FIRSTPERSON=2]="FIRSTPERSON"}(s||(s={}));const i=new Map([[s.ORBIT,e],[s.TRACKBALL,o],[s.FIRSTPERSON,n]]);class l{engine;CONTROL_TYPE;constructor(e){this.CONTROL_TYPE=s,this.engine=e}createControls(e=0,o,n){if(n instanceof HTMLElement){if(o instanceof t)return i.has(e)?(s.ORBIT,this.initOrbitControls(o,n)):(r.warn("ControlManager","Control type is not defined , default to OrbitControls"),new(i.get(s.ORBIT))(o,n));r.error("ControlManager","Camera is not defined")}else r.error("ControlManager","DomElement is not defined")}initOrbitControls(o,n){const r=new e(o,n);return r.enableDamping=!0,r.dampingFactor=.85,r.screenSpacePanning=!1,r}initFirstpersonControls(e,o){const r=new n(e,o);return r.pointerSpeed=.05,o.addEventListener("click",()=>r.lock()),r}initTrackballControls(e,n){return new o(e,n)}}export{s as CONTROL_TYPE,l as ControlsManager};
1
+ import{OrbitControls as e}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/OrbitControls.esm.js";import{TrackballControls as o}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/TrackballControls.esm.js";import{FirstControls as n}from"./controlsLibs/FirstControls.esm.js";import{Logger as r}from"../../utils/Logger.esm.js";export{TTControls}from"./TTControls/TTControls.esm.js";import{Camera as t}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";var s;!function(e){e[e.ORBIT=0]="ORBIT",e[e.TRACKBALL=1]="TRACKBALL",e[e.FIRSTPERSON=2]="FIRSTPERSON"}(s||(s={}));const i=new Map([[s.ORBIT,e],[s.TRACKBALL,o],[s.FIRSTPERSON,n]]);class l{engine;CONTROL_TYPE;constructor(e){this.CONTROL_TYPE=s,this.engine=e}createControls(e=0,o,n){if(n instanceof HTMLElement){if(o instanceof t)return i.has(e)?(s.ORBIT,this.initOrbitControls(o,n)):(r.warn("ControlManager","Control type is not defined , default to OrbitControls"),new(i.get(s.ORBIT))(o,n));r.error("ControlManager","Camera is not defined")}else r.error("ControlManager","DomElement is not defined")}initOrbitControls(o,n){const r=new e(o,n);return r.enableDamping=!0,r.dampingFactor=.85,r.screenSpacePanning=!1,r}initFirstpersonControls(e,o){const r=new n(e,o);return r.pointerSpeed=.05,o.addEventListener("click",()=>r.lock()),r}initTrackballControls(e,n){return new o(e,n)}}export{s as CONTROL_TYPE,l as ControlsManager};
@@ -1 +1 @@
1
- "use strict";var e=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/renderers/CSS3DRenderer.cjs.js");require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js");var n=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");exports.MarkerHtmlUI=class{engine;css3dRenderer;box3=new n.Box3;isRender=!1;constructor(e){this.engine=e,this.initCSS3DRenderer()}initCSS3DRenderer(){this.isRender=!0;const{clientWidth:n,clientHeight:t}=this.engine.container;this.css3dRenderer=new e.CSS3DRenderer,this.css3dRenderer.setSize(n,t),this.css3dRenderer.domElement.style.position="absolute",this.css3dRenderer.domElement.style.top="0px",this.css3dRenderer.domElement.style.left="0px",this.css3dRenderer.domElement.style.pointerEvents="none",this.engine.container.appendChild(this.css3dRenderer.domElement),this.startRender()}render(){this.isRender&&this.css3dRenderer.render(this.engine.sceneGraph,this.engine.camera)}stopRender(){this.isRender=!1}startRender(){this.isRender=!0}createMarker(t,s,r="标题",i=.02,o="marker-body"){const d=document.createElement("div");d.style.fontSize="8px",d.classList.add(o);let l="";for(const e in s)l+=`<div style="disply: flex;flex-direction:column;margin-top: 0px;">\n <span style="font-family: '思源黑体'; color: rgb(177, 195, 212);font-size: 0.8rem;">${e}: </span>\n <span style="font-family: 'DINPRO-Bold';font-weight: 700; color: rgb(255, 255, 255);font-size: 1rem;">${s[e].value}</span>\n <span style="font-family: '微软雅黑';font-weight: 500; color: rgba(255, 255, 255, 0.7);font-size: 0.8rem;">${s[e].unit}</span>\n </div>`;const c=`\n <div style="font-size: 1rem;color: #fff;disply: flex:direction:column;align-items:center;">\n <span class="ui-button" style="font-family: 'DINPRO'; font-weight: 700; color: rgb(255, 255, 255);" >${r}</span>\n ${l}\n </div>\n `;d.innerHTML=c;const m=new e.CSS3DSprite(d);m.element.style.pointerEvents="none",m.scale.setScalar(i);const a=this.box3.setFromObject(t),h=new n.Vector3,p=new n.Vector3;a.getCenter(h),a.getSize(p);const f=t.getWorldPosition(new n.Vector3),{x:u,y:R,z:y}=f;return m.position.set(u,R+.005,y),m.name=s.name,m}};
1
+ "use strict";var e=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/renderers/CSS3DRenderer.cjs.js");require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js");var n=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");exports.MarkerHtmlUI=class{engine;css3dRenderer;box3=new n.Box3;isRender=!1;constructor(e){this.engine=e,this.initCSS3DRenderer()}initCSS3DRenderer(){this.isRender=!0;const{clientWidth:n,clientHeight:t}=this.engine.container;this.css3dRenderer=new e.CSS3DRenderer,this.css3dRenderer.setSize(n,t),this.css3dRenderer.domElement.style.position="absolute",this.css3dRenderer.domElement.style.top="0px",this.css3dRenderer.domElement.style.left="0px",this.css3dRenderer.domElement.style.borderRadius="6px",this.css3dRenderer.domElement.style.pointerEvents="none",this.engine.container.appendChild(this.css3dRenderer.domElement),this.startRender()}render(){this.isRender&&this.css3dRenderer.render(this.engine.sceneGraph,this.engine.camera)}stopRender(){this.isRender=!1}startRender(){this.isRender=!0}createMarker(t,s,r="标题",i=.02,o="marker-body"){const d=document.createElement("div");d.style.fontSize="8px",d.classList.add(o);let l="";for(const e in s)l+=`<div style="disply: flex;flex-direction:column;margin-top: 0px;">\n <span style="font-family: '思源黑体'; color: rgb(177, 195, 212);font-size: 0.8rem;">${e}: </span>\n <span style="font-family: 'DINPRO-Bold';font-weight: 700; color: rgb(255, 255, 255);font-size: 1rem;">${s[e].value}</span>\n <span style="font-family: '微软雅黑';font-weight: 500; color: rgba(255, 255, 255, 0.7);font-size: 0.8rem;">${s[e].unit}</span>\n </div>`;const c=`\n <div style="font-size: 1rem;color: #fff;disply: flex:direction:column;align-items:center;">\n <span class="ui-button" style="font-family: 'DINPRO'; font-weight: 700; color: rgb(255, 255, 255);" >${r}</span>\n ${l}\n </div>\n `;d.innerHTML=c;const m=new e.CSS3DSprite(d);m.element.style.pointerEvents="none",m.scale.setScalar(i);const a=this.box3.setFromObject(t),h=new n.Vector3,p=new n.Vector3;a.getCenter(h),a.getSize(p);const R=t.getWorldPosition(new n.Vector3),{x:f,y:u,z:y}=R;return m.position.set(f,u+.005,y),m.name=s.name,m}};
@@ -1 +1 @@
1
- import{CSS3DRenderer as e,CSS3DSprite as n}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/renderers/CSS3DRenderer.esm.js";import"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{Box3 as t,Vector3 as s}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";class r{engine;css3dRenderer;box3=new t;isRender=!1;constructor(e){this.engine=e,this.initCSS3DRenderer()}initCSS3DRenderer(){this.isRender=!0;const{clientWidth:n,clientHeight:t}=this.engine.container;this.css3dRenderer=new e,this.css3dRenderer.setSize(n,t),this.css3dRenderer.domElement.style.position="absolute",this.css3dRenderer.domElement.style.top="0px",this.css3dRenderer.domElement.style.left="0px",this.css3dRenderer.domElement.style.pointerEvents="none",this.engine.container.appendChild(this.css3dRenderer.domElement),this.startRender()}render(){this.isRender&&this.css3dRenderer.render(this.engine.sceneGraph,this.engine.camera)}stopRender(){this.isRender=!1}startRender(){this.isRender=!0}createMarker(e,t,r="标题",i=.02,o="marker-body"){const d=document.createElement("div");d.style.fontSize="8px",d.classList.add(o);let l="";for(const e in t)l+=`<div style="disply: flex;flex-direction:column;margin-top: 0px;">\n <span style="font-family: '思源黑体'; color: rgb(177, 195, 212);font-size: 0.8rem;">${e}: </span>\n <span style="font-family: 'DINPRO-Bold';font-weight: 700; color: rgb(255, 255, 255);font-size: 1rem;">${t[e].value}</span>\n <span style="font-family: '微软雅黑';font-weight: 500; color: rgba(255, 255, 255, 0.7);font-size: 0.8rem;">${t[e].unit}</span>\n </div>`;const m=`\n <div style="font-size: 1rem;color: #fff;disply: flex:direction:column;align-items:center;">\n <span class="ui-button" style="font-family: 'DINPRO'; font-weight: 700; color: rgb(255, 255, 255);" >${r}</span>\n ${l}\n </div>\n `;d.innerHTML=m;const c=new n(d);c.element.style.pointerEvents="none",c.scale.setScalar(i);const a=this.box3.setFromObject(e),h=new s,p=new s;a.getCenter(h),a.getSize(p);const f=e.getWorldPosition(new s),{x:R,y:y,z:g}=f;return c.position.set(R,y+.005,g),c.name=t.name,c}}export{r as MarkerHtmlUI};
1
+ import{CSS3DRenderer as e,CSS3DSprite as n}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/renderers/CSS3DRenderer.esm.js";import"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{Box3 as t,Vector3 as s}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";class r{engine;css3dRenderer;box3=new t;isRender=!1;constructor(e){this.engine=e,this.initCSS3DRenderer()}initCSS3DRenderer(){this.isRender=!0;const{clientWidth:n,clientHeight:t}=this.engine.container;this.css3dRenderer=new e,this.css3dRenderer.setSize(n,t),this.css3dRenderer.domElement.style.position="absolute",this.css3dRenderer.domElement.style.top="0px",this.css3dRenderer.domElement.style.left="0px",this.css3dRenderer.domElement.style.borderRadius="6px",this.css3dRenderer.domElement.style.pointerEvents="none",this.engine.container.appendChild(this.css3dRenderer.domElement),this.startRender()}render(){this.isRender&&this.css3dRenderer.render(this.engine.sceneGraph,this.engine.camera)}stopRender(){this.isRender=!1}startRender(){this.isRender=!0}createMarker(e,t,r="标题",i=.02,o="marker-body"){const d=document.createElement("div");d.style.fontSize="8px",d.classList.add(o);let l="";for(const e in t)l+=`<div style="disply: flex;flex-direction:column;margin-top: 0px;">\n <span style="font-family: '思源黑体'; color: rgb(177, 195, 212);font-size: 0.8rem;">${e}: </span>\n <span style="font-family: 'DINPRO-Bold';font-weight: 700; color: rgb(255, 255, 255);font-size: 1rem;">${t[e].value}</span>\n <span style="font-family: '微软雅黑';font-weight: 500; color: rgba(255, 255, 255, 0.7);font-size: 0.8rem;">${t[e].unit}</span>\n </div>`;const m=`\n <div style="font-size: 1rem;color: #fff;disply: flex:direction:column;align-items:center;">\n <span class="ui-button" style="font-family: 'DINPRO'; font-weight: 700; color: rgb(255, 255, 255);" >${r}</span>\n ${l}\n </div>\n `;d.innerHTML=m;const c=new n(d);c.element.style.pointerEvents="none",c.scale.setScalar(i);const a=this.box3.setFromObject(e),h=new s,p=new s;a.getCenter(h),a.getSize(p);const f=e.getWorldPosition(new s),{x:R,y:y,z:u}=f;return c.position.set(R,y+.005,u),c.name=t.name,c}}export{r as MarkerHtmlUI};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("../../../utils/Logger.cjs.js"),t=require("./MeshBuilder.cjs.js"),r=require("../../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");const s={radius:1,height:1,capSegments:4,radialSegments:8,heightSegments:1,material:new r.MeshPhongMaterial({color:16777215})};class a extends t.MeshBuilder{options=s;type="CapsuleBuilder";constructor(t="",r={},s){super(a.createGeometry(r),a.createMaterial(r)),this.name=t,this.options=r,s?s.add(this):e.Logger.error("BoxBuilder","Scene is not defined")}static createGeometry(e){const{radius:t,height:a,capSegments:i,radialSegments:n,heightSegments:o}={...s,...e};return new r.CapsuleGeometry(t,a,i,n,o)}static createMaterial(e){const{material:t}={...s,...e};return t instanceof r.Material?t:new r.MeshPhongMaterial({color:16777215})}}exports.CapsuleBuilder=a,exports.createCapsule=function(e="",t=s,r){return new a(e,t,r)};
@@ -0,0 +1 @@
1
+ import{Logger as e}from"../../../utils/Logger.esm.js";import{MeshBuilder as t}from"./MeshBuilder.esm.js";import{MeshPhongMaterial as r,CapsuleGeometry as s,Material as o}from"../../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";const i={radius:1,height:1,capSegments:4,radialSegments:8,heightSegments:1,material:new r({color:16777215})};class n extends t{options=i;type="CapsuleBuilder";constructor(t="",r={},s){super(n.createGeometry(r),n.createMaterial(r)),this.name=t,this.options=r,s?s.add(this):e.error("BoxBuilder","Scene is not defined")}static createGeometry(e){const{radius:t,height:r,capSegments:o,radialSegments:n,heightSegments:a}={...i,...e};return new s(t,r,o,n,a)}static createMaterial(e){const{material:t}={...i,...e};return t instanceof o?t:new r({color:16777215})}}function a(e="",t=i,r){return new n(e,t,r)}export{n as CapsuleBuilder,a as createCapsule};
@@ -1 +1 @@
1
- "use strict";var e=require("./Builders/BoxBuilder.cjs.js"),r=require("./Builders/SphereBuilder.cjs.js"),l=require("./Builders/PlaneBuilder.cjs.js");const B={createBox:e.createBox,createSphere:r.createSphere,createPlane:l.createPlane};exports.BoxBuilder=e.BoxBuilder,exports.SphereBuilder=r.SphereBuilder,exports.PlaneBuilder=l.PlaneBuilder,exports.MeshBuilder=B;
1
+ "use strict";var e=require("./Builders/BoxBuilder.cjs.js"),r=require("./Builders/SphereBuilder.cjs.js"),l=require("./Builders/PlaneBuilder.cjs.js"),u=require("./Builders/CapsuleBuilder.cjs.js");const s={createBox:e.createBox,createSphere:r.createSphere,createPlane:l.createPlane,createCapsule:u.createCapsule};exports.BoxBuilder=e.BoxBuilder,exports.SphereBuilder=r.SphereBuilder,exports.PlaneBuilder=l.PlaneBuilder,exports.CapsuleBuilder=u.CapsuleBuilder,exports.MeshBuilder=s;
@@ -1 +1 @@
1
- import{createBox as e}from"./Builders/BoxBuilder.esm.js";export{BoxBuilder}from"./Builders/BoxBuilder.esm.js";import{createSphere as r}from"./Builders/SphereBuilder.esm.js";export{SphereBuilder}from"./Builders/SphereBuilder.esm.js";import{createPlane as l}from"./Builders/PlaneBuilder.esm.js";export{PlaneBuilder}from"./Builders/PlaneBuilder.esm.js";const s={createBox:e,createSphere:r,createPlane:l};export{s as MeshBuilder};
1
+ import{createBox as e}from"./Builders/BoxBuilder.esm.js";export{BoxBuilder}from"./Builders/BoxBuilder.esm.js";import{createSphere as r}from"./Builders/SphereBuilder.esm.js";export{SphereBuilder}from"./Builders/SphereBuilder.esm.js";import{createPlane as s}from"./Builders/PlaneBuilder.esm.js";export{PlaneBuilder}from"./Builders/PlaneBuilder.esm.js";import{createCapsule as l}from"./Builders/CapsuleBuilder.esm.js";export{CapsuleBuilder}from"./Builders/CapsuleBuilder.esm.js";const i={createBox:e,createSphere:r,createPlane:s,createCapsule:l};export{i as MeshBuilder};
@@ -1 +1 @@
1
- "use strict";var e=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js"),r=require("../../utils/index.cjs.js"),t=require("../Controls/index.cjs.js"),n=require("../Resource/ResourceManager.cjs.js"),s=require("../PostProcessor/index.cjs.js"),a=require("../MarkerHtmlUI/index.cjs.js"),i=require("../../utils/Logger.cjs.js"),o=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");const c={container:"body",antialias:!0,alpha:!1,backgroundColor:1514278,camera:"Perspective",isPostProcessing:!1};class h{container;activeCanvas=null;parameters=c;renderScopes;sceneGraph;camera;controls;renderer;VERSION="1.0.0";CONTROL_TYPE=t.CONTROL_TYPE;resourceManager;controlsManager;plugins=new Map;isPostProcessing=!1;markerHtmlUI;postProcessor;animateTimer;constructor(e){i.Logger.info("Hello PotatoGL.js!"),this.renderScopes=new Set,this.parameters={...this.parameters,...e},this.resourceManager=new n.ResourceManager(this),this.controlsManager=new t.ControlsManager(this),this.parameters.container||i.Logger.error("PotatoEngine","container is not defined")}async create(e){this.parameters=Object.assign(this.parameters,e);const{container:t}=this.parameters;return this.container=r.getContainerElement(t),this.sceneGraph=h.createScene(e),this.sceneGraph.background=new o.Color(this.parameters.backgroundColor),this.camera=h.createCamera(e,this.container),this.renderer=h.createRenderer(this.parameters,this.container),this.activeCanvas=this.renderer.domElement,this.container.appendChild(this.renderer.domElement),this.postProcessor=new s.PostProcessor(this),this.markerHtmlUI=new a.MarkerHtmlUI(this),this.initEngineInfo(this.activeCanvas),this}static createScene(e){const{backgroundColor:r}=e,t=new o.Scene;return t.background=new o.Color(r),t}static createCamera(e,r){const{camera:t}=e,{clientWidth:n,clientHeight:s}=r;let a;return a="Orthographic"===t?new o.OrthographicCamera(-n/2,n/2,s/2,-s/2,.01,1e3):new o.PerspectiveCamera(60,n/s,.01,1e3),a}static createRenderer(r,t=document.body){const{antialias:n,alpha:s}=r,a=new e.WebGLRenderer({antialias:n,alpha:s,powerPreference:"high-performance"}),{clientWidth:i,clientHeight:c}=t,h=1*window.devicePixelRatio;return a.setPixelRatio(h),a.setSize(i||500,c||300),a.outputColorSpace=o.SRGBColorSpace,a.toneMapping=o.ACESFilmicToneMapping,a.toneMappingExposure=1,a}runRenderLoop(e){e&&!this.renderScopes.has(e)&&this.renderScopes.add(e),this.sceneGraph&&this.camera&&this.renderer?(this.isPostProcessing?this.postProcessor?.render():this.renderer.render(this.sceneGraph,this.camera),this.markerHtmlUI.render(),this.renderScopes.forEach(e=>e({sceneGraph:this.sceneGraph,camera:this.camera,renderer:this.renderer})),this.animateTimer=requestAnimationFrame(()=>this.runRenderLoop())):i.Logger.error("PotatoEngine","Scene, Camera, Renderer is not defined")}addRunScope(e){this.renderScopes.has(e)&&i.Logger.warn("PotatoEngine","RunScope is already added"),this.renderScopes.add(e)}attachControl(e){if(this.camera&&this.renderer)return this.controls=this.controlsManager.createControls(e,this.camera,this.renderer.domElement),this.addRunScope(()=>this.controls.update()),this.controls;i.Logger.error("PotatoEngine","Camera, Renderer is not defined")}stopRenderLoop(){this.animateTimer&&(cancelAnimationFrame(this.animateTimer),this.animateTimer=0)}regieterPlugin(e,r){}initEngineInfo(e){e instanceof HTMLCanvasElement&&(e.style.borderRadius="5px"),"setAttribute"in e&&e.setAttribute("data-engine",`Potato.js V${this.VERSION}`)}}exports.PotatoEngine=h;
1
+ "use strict";var e=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js"),r=require("../../utils/index.cjs.js"),t=require("../Controls/index.cjs.js"),n=require("../Resource/ResourceManager.cjs.js"),s=require("../PostProcessor/index.cjs.js"),a=require("../MarkerHtmlUI/index.cjs.js"),i=require("../../utils/Logger.cjs.js"),o=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");const c={container:"body",antialias:!0,alpha:!1,backgroundColor:1514278,camera:"Perspective",isPostProcessing:!1};class h{container;activeCanvas=null;parameters=c;renderScopes;sceneGraph;camera;controls;renderer;VERSION="1.0.0";CONTROL_TYPE=t.CONTROL_TYPE;resourceManager;controlsManager;plugins=new Map;isPostProcessing=!1;markerHtmlUI;postProcessor;animateTimer;constructor(e){i.Logger.info("Hello PotatoGL.js!"),this.renderScopes=new Set,this.parameters={...this.parameters,...e},this.resourceManager=new n.ResourceManager(this),this.controlsManager=new t.ControlsManager(this),this.parameters.container||i.Logger.error("PotatoEngine","container is not defined")}async create(e){this.parameters=Object.assign(this.parameters,e);const{container:t}=this.parameters;return this.container=r.getContainerElement(t),this.sceneGraph=h.createScene(e),this.sceneGraph.background=new o.Color(this.parameters.backgroundColor),this.camera=h.createCamera(e,this.container),this.renderer=h.createRenderer(this.parameters,this.container),this.activeCanvas=this.renderer.domElement,this.container.appendChild(this.renderer.domElement),this.postProcessor=new s.PostProcessor(this),this.markerHtmlUI=new a.MarkerHtmlUI(this),this.initEngineInfo(this.activeCanvas),this}static createScene(e){const{backgroundColor:r}=e,t=new o.Scene;return t.background=new o.Color(r),t}static createCamera(e,r){const{camera:t}=e,{clientWidth:n,clientHeight:s}=r;let a;return a="Orthographic"===t?new o.OrthographicCamera(-n/2,n/2,s/2,-s/2,.01,1e3):new o.PerspectiveCamera(60,n/s,.01,1e3),a}static createRenderer(r,t=document.body){const{antialias:n,alpha:s}=r,a=new e.WebGLRenderer({antialias:n,alpha:s,powerPreference:"high-performance"}),{clientWidth:i,clientHeight:c}=t,h=1*window.devicePixelRatio;return a.setPixelRatio(h),a.setSize(i||500,c||300),a.outputColorSpace=o.SRGBColorSpace,a.toneMapping=o.ACESFilmicToneMapping,a.toneMappingExposure=1,a}runRenderLoop(e){e&&!this.renderScopes.has(e)&&this.renderScopes.add(e),this.sceneGraph&&this.camera&&this.renderer?(this.isPostProcessing?this.postProcessor?.render():this.renderer.render(this.sceneGraph,this.camera),this.markerHtmlUI.render(),this.renderScopes.forEach(e=>e({sceneGraph:this.sceneGraph,camera:this.camera,renderer:this.renderer})),this.animateTimer=requestAnimationFrame(()=>this.runRenderLoop())):i.Logger.error("PotatoEngine","Scene, Camera, Renderer is not defined")}addRunScope(e){this.renderScopes.has(e)&&i.Logger.warn("PotatoEngine","RunScope is already added"),this.renderScopes.add(e)}attachControl(e){if(this.camera&&this.renderer)return this.controls=this.controlsManager.createControls(e,this.camera,this.renderer.domElement),this.addRunScope(()=>this.controls.update()),this.controls;i.Logger.error("PotatoEngine","Camera, Renderer is not defined")}stopRenderLoop(){this.animateTimer&&(cancelAnimationFrame(this.animateTimer),this.animateTimer=0)}regieterPlugin(e,r){}initEngineInfo(e){e instanceof HTMLCanvasElement&&(e.style.borderRadius="6px"),"setAttribute"in e&&e.setAttribute("data-engine",`T3d-ez.gl V${this.VERSION}`)}}exports.PotatoEngine=h;
@@ -1 +1 @@
1
- import{WebGLRenderer as e}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{getContainerElement as r}from"../../utils/index.esm.js";import{CONTROL_TYPE as t,ControlsManager as s}from"../Controls/index.esm.js";import{ResourceManager as n}from"../Resource/ResourceManager.esm.js";import{PostProcessor as a}from"../PostProcessor/index.esm.js";import{MarkerHtmlUI as i}from"../MarkerHtmlUI/index.esm.js";import{Logger as o}from"../../utils/Logger.esm.js";import{Color as c,Scene as h,OrthographicCamera as m,PerspectiveCamera as d,SRGBColorSpace as p,ACESFilmicToneMapping as l}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";const u={container:"body",antialias:!0,alpha:!1,backgroundColor:1514278,camera:"Perspective",isPostProcessing:!1};class g{container;activeCanvas=null;parameters=u;renderScopes;sceneGraph;camera;controls;renderer;VERSION="1.0.0";CONTROL_TYPE=t;resourceManager;controlsManager;plugins=new Map;isPostProcessing=!1;markerHtmlUI;postProcessor;animateTimer;constructor(e){o.info("Hello PotatoGL.js!"),this.renderScopes=new Set,this.parameters={...this.parameters,...e},this.resourceManager=new n(this),this.controlsManager=new s(this),this.parameters.container||o.error("PotatoEngine","container is not defined")}async create(e){this.parameters=Object.assign(this.parameters,e);const{container:t}=this.parameters;return this.container=r(t),this.sceneGraph=g.createScene(e),this.sceneGraph.background=new c(this.parameters.backgroundColor),this.camera=g.createCamera(e,this.container),this.renderer=g.createRenderer(this.parameters,this.container),this.activeCanvas=this.renderer.domElement,this.container.appendChild(this.renderer.domElement),this.postProcessor=new a(this),this.markerHtmlUI=new i(this),this.initEngineInfo(this.activeCanvas),this}static createScene(e){const{backgroundColor:r}=e,t=new h;return t.background=new c(r),t}static createCamera(e,r){const{camera:t}=e,{clientWidth:s,clientHeight:n}=r;let a;return a="Orthographic"===t?new m(-s/2,s/2,n/2,-n/2,.01,1e3):new d(60,s/n,.01,1e3),a}static createRenderer(r,t=document.body){const{antialias:s,alpha:n}=r,a=new e({antialias:s,alpha:n,powerPreference:"high-performance"}),{clientWidth:i,clientHeight:o}=t,c=1*window.devicePixelRatio;return a.setPixelRatio(c),a.setSize(i||500,o||300),a.outputColorSpace=p,a.toneMapping=l,a.toneMappingExposure=1,a}runRenderLoop(e){e&&!this.renderScopes.has(e)&&this.renderScopes.add(e),this.sceneGraph&&this.camera&&this.renderer?(this.isPostProcessing?this.postProcessor?.render():this.renderer.render(this.sceneGraph,this.camera),this.markerHtmlUI.render(),this.renderScopes.forEach(e=>e({sceneGraph:this.sceneGraph,camera:this.camera,renderer:this.renderer})),this.animateTimer=requestAnimationFrame(()=>this.runRenderLoop())):o.error("PotatoEngine","Scene, Camera, Renderer is not defined")}addRunScope(e){this.renderScopes.has(e)&&o.warn("PotatoEngine","RunScope is already added"),this.renderScopes.add(e)}attachControl(e){if(this.camera&&this.renderer)return this.controls=this.controlsManager.createControls(e,this.camera,this.renderer.domElement),this.addRunScope(()=>this.controls.update()),this.controls;o.error("PotatoEngine","Camera, Renderer is not defined")}stopRenderLoop(){this.animateTimer&&(cancelAnimationFrame(this.animateTimer),this.animateTimer=0)}regieterPlugin(e,r){}initEngineInfo(e){e instanceof HTMLCanvasElement&&(e.style.borderRadius="5px"),"setAttribute"in e&&e.setAttribute("data-engine",`Potato.js V${this.VERSION}`)}}export{g as PotatoEngine};
1
+ import{WebGLRenderer as e}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{getContainerElement as r}from"../../utils/index.esm.js";import{CONTROL_TYPE as t,ControlsManager as n}from"../Controls/index.esm.js";import{ResourceManager as s}from"../Resource/ResourceManager.esm.js";import{PostProcessor as a}from"../PostProcessor/index.esm.js";import{MarkerHtmlUI as i}from"../MarkerHtmlUI/index.esm.js";import{Logger as o}from"../../utils/Logger.esm.js";import{Color as c,Scene as h,OrthographicCamera as m,PerspectiveCamera as d,SRGBColorSpace as p,ACESFilmicToneMapping as l}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";const u={container:"body",antialias:!0,alpha:!1,backgroundColor:1514278,camera:"Perspective",isPostProcessing:!1};class g{container;activeCanvas=null;parameters=u;renderScopes;sceneGraph;camera;controls;renderer;VERSION="1.0.0";CONTROL_TYPE=t;resourceManager;controlsManager;plugins=new Map;isPostProcessing=!1;markerHtmlUI;postProcessor;animateTimer;constructor(e){o.info("Hello PotatoGL.js!"),this.renderScopes=new Set,this.parameters={...this.parameters,...e},this.resourceManager=new s(this),this.controlsManager=new n(this),this.parameters.container||o.error("PotatoEngine","container is not defined")}async create(e){this.parameters=Object.assign(this.parameters,e);const{container:t}=this.parameters;return this.container=r(t),this.sceneGraph=g.createScene(e),this.sceneGraph.background=new c(this.parameters.backgroundColor),this.camera=g.createCamera(e,this.container),this.renderer=g.createRenderer(this.parameters,this.container),this.activeCanvas=this.renderer.domElement,this.container.appendChild(this.renderer.domElement),this.postProcessor=new a(this),this.markerHtmlUI=new i(this),this.initEngineInfo(this.activeCanvas),this}static createScene(e){const{backgroundColor:r}=e,t=new h;return t.background=new c(r),t}static createCamera(e,r){const{camera:t}=e,{clientWidth:n,clientHeight:s}=r;let a;return a="Orthographic"===t?new m(-n/2,n/2,s/2,-s/2,.01,1e3):new d(60,n/s,.01,1e3),a}static createRenderer(r,t=document.body){const{antialias:n,alpha:s}=r,a=new e({antialias:n,alpha:s,powerPreference:"high-performance"}),{clientWidth:i,clientHeight:o}=t,c=1*window.devicePixelRatio;return a.setPixelRatio(c),a.setSize(i||500,o||300),a.outputColorSpace=p,a.toneMapping=l,a.toneMappingExposure=1,a}runRenderLoop(e){e&&!this.renderScopes.has(e)&&this.renderScopes.add(e),this.sceneGraph&&this.camera&&this.renderer?(this.isPostProcessing?this.postProcessor?.render():this.renderer.render(this.sceneGraph,this.camera),this.markerHtmlUI.render(),this.renderScopes.forEach(e=>e({sceneGraph:this.sceneGraph,camera:this.camera,renderer:this.renderer})),this.animateTimer=requestAnimationFrame(()=>this.runRenderLoop())):o.error("PotatoEngine","Scene, Camera, Renderer is not defined")}addRunScope(e){this.renderScopes.has(e)&&o.warn("PotatoEngine","RunScope is already added"),this.renderScopes.add(e)}attachControl(e){if(this.camera&&this.renderer)return this.controls=this.controlsManager.createControls(e,this.camera,this.renderer.domElement),this.addRunScope(()=>this.controls.update()),this.controls;o.error("PotatoEngine","Camera, Renderer is not defined")}stopRenderLoop(){this.animateTimer&&(cancelAnimationFrame(this.animateTimer),this.animateTimer=0)}regieterPlugin(e,r){}initEngineInfo(e){e instanceof HTMLCanvasElement&&(e.style.borderRadius="6px"),"setAttribute"in e&&e.setAttribute("data-engine",`T3d-ez.gl V${this.VERSION}`)}}export{g as PotatoEngine};
@@ -1 +1 @@
1
- "use strict";var n=require("../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");class e extends n.Mesh{constructor(e,o,i,r,t="xzy"){i=i||new n.Color("white"),e=e||10,o=o||100,r=r||8e3;const a=t.substr(0,2);super(new n.PlaneGeometry(2,2,1,1),new n.ShaderMaterial({side:n.DoubleSide,uniforms:{uSize1:{value:e},uSize2:{value:o},uColor:{value:i},uDistance:{value:r}},transparent:!0,vertexShader:`\n \n varying vec3 worldPosition;\n \n uniform float uDistance;\n \n void main() {\n \n vec3 pos = position.${t} * uDistance;\n pos.${a} += cameraPosition.${a};\n \n worldPosition = pos;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n \n }\n `,fragmentShader:`\n \n varying vec3 worldPosition;\n \n uniform float uSize1;\n uniform float uSize2;\n uniform vec3 uColor;\n uniform float uDistance;\n \n \n \n float getGrid(float size) {\n \n vec2 r = worldPosition.${a} / size;\n \n \n vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);\n float line = min(grid.x, grid.y);\n \n \n return 1.0 - min(line, 1.0);\n }\n \n void main() {\n \n \n float d = 1.0 - min(distance(cameraPosition.${a}, worldPosition.${a}) / uDistance, 1.0);\n \n float g1 = getGrid(uSize1);\n float g2 = getGrid(uSize2);\n \n gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, 4.0));\n gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2);\n \n \n if ( gl_FragColor.a <= 0.0 ) discard;\n \n \n }\n \n `})),this.frustumCulled=!1}}exports.InfiniteGridHelper=e;
1
+ "use strict";var n=require("../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");class e extends n.Mesh{constructor(e,o,i,r,t="xzy"){i=i||new n.Color("white"),e=e||10,o=o||100,r=r||8e3;const a=t.substr(0,2);super(new n.PlaneGeometry(2,2,1,1),new n.ShaderMaterial({side:n.BackSide,uniforms:{uSize1:{value:e},uSize2:{value:o},uColor:{value:i},uDistance:{value:r}},transparent:!0,vertexShader:`\n \n varying vec3 worldPosition;\n \n uniform float uDistance;\n \n void main() {\n \n vec3 pos = position.${t} * uDistance;\n pos.${a} += cameraPosition.${a};\n \n worldPosition = pos;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n \n }\n `,fragmentShader:`\n \n varying vec3 worldPosition;\n \n uniform float uSize1;\n uniform float uSize2;\n uniform vec3 uColor;\n uniform float uDistance;\n \n \n \n float getGrid(float size) {\n \n vec2 r = worldPosition.${a} / size;\n \n \n vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);\n float line = min(grid.x, grid.y);\n \n \n return 1.0 - min(line, 1.0);\n }\n \n void main() {\n \n \n float d = 1.0 - min(distance(cameraPosition.${a}, worldPosition.${a}) / uDistance, 1.0);\n \n float g1 = getGrid(uSize1);\n float g2 = getGrid(uSize2);\n \n gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, 4.0));\n gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2);\n \n \n if ( gl_FragColor.a <= 0.0 ) discard;\n \n \n }\n \n `})),this.frustumCulled=!1}}exports.InfiniteGridHelper=e;
@@ -1 +1 @@
1
- import{Mesh as n,Color as o,PlaneGeometry as i,ShaderMaterial as e,DoubleSide as r}from"../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";class t extends n{constructor(n,t,a,l,s="xzy"){a=a||new o("white"),n=n||10,t=t||100,l=l||8e3;const u=s.substr(0,2);super(new i(2,2,1,1),new e({side:r,uniforms:{uSize1:{value:n},uSize2:{value:t},uColor:{value:a},uDistance:{value:l}},transparent:!0,vertexShader:`\n \n varying vec3 worldPosition;\n \n uniform float uDistance;\n \n void main() {\n \n vec3 pos = position.${s} * uDistance;\n pos.${u} += cameraPosition.${u};\n \n worldPosition = pos;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n \n }\n `,fragmentShader:`\n \n varying vec3 worldPosition;\n \n uniform float uSize1;\n uniform float uSize2;\n uniform vec3 uColor;\n uniform float uDistance;\n \n \n \n float getGrid(float size) {\n \n vec2 r = worldPosition.${u} / size;\n \n \n vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);\n float line = min(grid.x, grid.y);\n \n \n return 1.0 - min(line, 1.0);\n }\n \n void main() {\n \n \n float d = 1.0 - min(distance(cameraPosition.${u}, worldPosition.${u}) / uDistance, 1.0);\n \n float g1 = getGrid(uSize1);\n float g2 = getGrid(uSize2);\n \n gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, 4.0));\n gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2);\n \n \n if ( gl_FragColor.a <= 0.0 ) discard;\n \n \n }\n \n `})),this.frustumCulled=!1}}export{t as InfiniteGridHelper};
1
+ import{Mesh as n,Color as o,PlaneGeometry as i,ShaderMaterial as e,BackSide as r}from"../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";class t extends n{constructor(n,t,a,l,s="xzy"){a=a||new o("white"),n=n||10,t=t||100,l=l||8e3;const u=s.substr(0,2);super(new i(2,2,1,1),new e({side:r,uniforms:{uSize1:{value:n},uSize2:{value:t},uColor:{value:a},uDistance:{value:l}},transparent:!0,vertexShader:`\n \n varying vec3 worldPosition;\n \n uniform float uDistance;\n \n void main() {\n \n vec3 pos = position.${s} * uDistance;\n pos.${u} += cameraPosition.${u};\n \n worldPosition = pos;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n \n }\n `,fragmentShader:`\n \n varying vec3 worldPosition;\n \n uniform float uSize1;\n uniform float uSize2;\n uniform vec3 uColor;\n uniform float uDistance;\n \n \n \n float getGrid(float size) {\n \n vec2 r = worldPosition.${u} / size;\n \n \n vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);\n float line = min(grid.x, grid.y);\n \n \n return 1.0 - min(line, 1.0);\n }\n \n void main() {\n \n \n float d = 1.0 - min(distance(cameraPosition.${u}, worldPosition.${u}) / uDistance, 1.0);\n \n float g1 = getGrid(uSize1);\n float g2 = getGrid(uSize2);\n \n gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, 4.0));\n gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2);\n \n \n if ( gl_FragColor.a <= 0.0 ) discard;\n \n \n }\n \n `})),this.frustumCulled=!1}}export{t as InfiniteGridHelper};