@selvajs/visualization 1.0.0-beta.0 → 1.0.0-beta.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/README.md +4 -3
- package/dist/chunk-AZ4GBXXL.cjs +2 -0
- package/dist/chunk-AZ4GBXXL.cjs.map +1 -0
- package/dist/chunk-BYLIBOAU.cjs.map +1 -1
- package/dist/chunk-KRA5RVHM.js +2 -0
- package/dist/chunk-KRA5RVHM.js.map +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/parse.cjs +3 -3
- package/dist/parse.cjs.map +1 -1
- package/dist/parse.d.cts +31 -45
- package/dist/parse.d.ts +31 -45
- package/dist/parse.js +3 -3
- package/dist/parse.js.map +1 -1
- package/dist/render.cjs +9 -10
- package/dist/render.cjs.map +1 -1
- package/dist/render.d.cts +36 -44
- package/dist/render.d.ts +36 -44
- package/dist/render.js +9 -10
- package/dist/render.js.map +1 -1
- package/dist/scene.cjs.map +1 -1
- package/dist/scene.d.cts +4 -9
- package/dist/scene.d.ts +4 -9
- package/dist/scene.js.map +1 -1
- package/dist/{types-CdF9R3qA.d.cts → types-DCuos3gI.d.cts} +4 -12
- package/dist/{types-CdF9R3qA.d.ts → types-DCuos3gI.d.ts} +4 -12
- package/package.json +2 -3
- package/dist/chunk-AQJPVUH3.cjs +0 -2
- package/dist/chunk-AQJPVUH3.cjs.map +0 -1
- package/dist/chunk-EXAI6IC5.js +0 -2
- package/dist/chunk-EXAI6IC5.js.map +0 -1
package/dist/render.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var
|
|
2
|
-
`)}var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkAZ4GBXXLcjs = require('./chunk-AZ4GBXXL.cjs');var _chunkBYLIBOAUcjs = require('./chunk-BYLIBOAU.cjs');var _three = require('three'); var Ft = _interopRequireWildcard(_three); var re = _interopRequireWildcard(_three); var fe = _interopRequireWildcard(_three); var Z = _interopRequireWildcard(_three); var nt = _interopRequireWildcard(_three); var $e = _interopRequireWildcard(_three); var xe = _interopRequireWildcard(_three); var ne = _interopRequireWildcard(_three); var z = _interopRequireWildcard(_three); var lt = _interopRequireWildcard(_three); var D = _interopRequireWildcard(_three); var ge = _interopRequireWildcard(_three); var B = _interopRequireWildcard(_three); var ke = _interopRequireWildcard(_three); var gt = _interopRequireWildcard(_three); var ce = _interopRequireWildcard(_three); var Tt = _interopRequireWildcard(_three); var Me = _interopRequireWildcard(_three); var yt = _interopRequireWildcard(_three); var Ct = _interopRequireWildcard(_three); var P = _interopRequireWildcard(_three); var j = _interopRequireWildcard(_three); var L = _interopRequireWildcard(_three); var J = _interopRequireWildcard(_three); var ue = _interopRequireWildcard(_three);function Ee(e){let n=e.clone().normalize(),t=new Z.Vector3(0,0,1),r=new Z.Vector3(0,1,0),i=Math.abs(n.dot(t))>.9?r:t,o=new Z.Vector3().crossVectors(i,n).normalize(),a=new Z.Vector3().crossVectors(n,o).normalize();return{up:n,forward:a,right:o}}function be(e,n){let{forward:t,right:r,up:i}=Ee(e);return t.clone().multiplyScalar(-1).add(r.clone().multiplyScalar(-1)).add(i).normalize().multiplyScalar(n)}function je(e,n,t){let{forward:r,right:i,up:o}=Ee(e);return i.clone().multiplyScalar(n).add(r.clone().multiplyScalar(n)).add(o.clone().multiplyScalar(t))}function Ne(e){let n=e.clone().normalize(),t=new Z.Vector3(0,1,0);if(n.dot(t)>.9999)return new Z.Euler;if(n.dot(t)<-.9999)return new Z.Euler(Math.PI,0,0);let r=new Z.Quaternion().setFromUnitVectors(t,n);return new Z.Euler().setFromQuaternion(r)}function ve(e){let n=Math.abs(e.x),t=Math.abs(e.y),r=Math.abs(e.z);return n>=t&&n>=r?"x":t>=r?"y":"z"}var $={HUGE_THRESHOLD:1e4,LARGE_THRESHOLD:1e3,SCALE_RATIO_THRESHOLD:100,NEAR_PLANE_FACTOR:{TINY:1e-4,SMALL:.001,NORMAL:.01},FAR_PLANE_FACTOR:{HUGE:100,LARGE:50,NORMAL:20},INITIAL_DISTANCE_MULTIPLIER:4};function Ut(e,n,t,r,i){if(Xt(e),n.length===0)return;n.forEach(f=>{e.add(f)});let o=_chunkAZ4GBXXLcjs.m.call(void 0, n),a=o.getCenter(new fe.Vector3),l=o.getSize(new fe.Vector3),s=Math.max(l.x,l.y,l.z);if(s/Math.min(l.x||1,l.y||1,l.z||1)>$.SCALE_RATIO_THRESHOLD||s>$.HUGE_THRESHOLD?(t.near=s*$.NEAR_PLANE_FACTOR.TINY,t.far=s*$.FAR_PLANE_FACTOR.HUGE):s>$.LARGE_THRESHOLD?(t.near=s*$.NEAR_PLANE_FACTOR.SMALL,t.far=s*$.FAR_PLANE_FACTOR.LARGE):(t.near=Math.max(.01,s*$.NEAR_PLANE_FACTOR.NORMAL),t.far=Math.max(2e3,s*$.FAR_PLANE_FACTOR.NORMAL)),t.updateProjectionMatrix(),!i){let f=s*$.INITIAL_DISTANCE_MULTIPLIER;t.position.copy(a).add(be(t.up,f)),r.target.copy(a),r.update()}}var Bt=new Set(["grid","floor","label-layer","measure"]);function Wt(e){let n=e;for(;n;){if(typeof n.userData.id=="string"&&Bt.has(n.userData.id))return!0;n=n.parent}return!1}function Q(e){e.updateMatrixWorld(!0);let n=new fe.Box3;return e.traverse(t=>{let r=t;t.visible&&!Wt(t)&&r.geometry&&n.expandByObject(t)}),n}var qt=new Set(["floor","grid","label-layer"]);function Xt(e){[...e.children].forEach(t=>{qt.has(t.userData.id)||t.userData.source!=="user"&&(_chunkAZ4GBXXLcjs.p.call(void 0, t),t.removeFromParent())})}function Kt(e){let{up:n,forward:t,right:r}=Ee(e),i=t.clone().negate(),o=r.clone();return{top:n.clone(),bottom:n.clone().negate(),front:i.clone(),back:i.clone().negate(),right:o.clone(),left:o.clone().negate(),iso:i.clone().multiplyScalar(1.2).add(o.clone()).add(n.clone()).normalize()}}function Ge(e){let{scene:n,perspective:t,controls:r,onActiveCameraChange:i}=e,o=(_nullishCoalesce(e.up, () => (t.up))).clone().normalize(),a=Kt(o),l=new re.OrthographicCamera(-1,1,1,-1,t.near,t.far);l.up.copy(o);let s="perspective",u=t.aspect,f=()=>s==="perspective"?t:l,E=null,g=()=>{_optionalChain([E, 'optionalAccess', _2 => _2.cancel, 'call', _3 => _3()]),E=null},m=()=>{let R=(s==="orthographic"?l:t).position.distanceTo(r.target)*Math.tan(t.fov*Math.PI/360),T=R*u;l.left=-T,l.right=T,l.top=R,l.bottom=-R,l.near=t.near,l.far=t.far,l.updateProjectionMatrix()},p=d=>{if(d!==s){if(g(),d==="orthographic")l.position.copy(t.position),l.up.copy(t.up),l.lookAt(r.target),l.zoom=1,m();else{let R=(l.top-l.bottom)/(2*l.zoom)/Math.tan(t.fov*Math.PI/360),T=l.position.clone().sub(r.target);T.lengthSq()<1e-12&&T.copy(o),T.normalize(),t.position.copy(r.target).add(T.multiplyScalar(R))}s=d,r.object=f(),r.update(),i(f())}},h=(d,c,R,T)=>{let v=t.fov*(Math.PI/180),C=c/(2*Math.tan(v/2))*1.5,_=Yt(R,o),F=d.clone().add(_.clone().multiplyScalar(C)),q=f();s==="orthographic"&&(l.zoom=1),g(),T?E=$t(q,r,F,d,()=>{s==="orthographic"&&m()}):(q.position.copy(F),r.target.copy(d),s==="orthographic"&&m(),r.update())},H=(d,c=!0)=>{let R=Q(n),T=R.isEmpty()?r.target.clone():R.getCenter(new re.Vector3),v=R.isEmpty()?new re.Vector3(1,1,1):R.getSize(new re.Vector3),C=Math.max(v.x,v.y,v.z)||1;h(T,C,d,c)};return{getActiveCamera:f,getProjection:()=>s,setProjection:p,toggleProjection:()=>(p(s==="perspective"?"orthographic":"perspective"),s),setView:(d,c=!0)=>{H(a[d],c)},setViewDirection:H,frameBounds:(d,c=!0)=>{if(d.isEmpty())return;let R=d.getCenter(new re.Vector3),T=d.getSize(new re.Vector3),v=Math.max(T.x,T.y,T.z)||1,C=f().position.clone().sub(r.target);C.lengthSq()<1e-12&&C.copy(a.iso),h(R,v,C.normalize(),c)},setRotateEnabled:d=>{r.enableRotate=d},isRotateEnabled:()=>r.enableRotate,updateAspect:(d,c)=>{u=c===0?u:d/c,s==="orthographic"&&m()},dispose:g}}function Yt(e,n){let{up:t,forward:r}=Ee(n),i=e.clone().normalize();if(Math.abs(i.dot(t))<.9999)return e;let o=r.clone().negate(),a=.5*Math.PI/180;return i.multiplyScalar(Math.cos(a)).add(o.multiplyScalar(Math.sin(a))).normalize()}var Zt=e=>1-Math.pow(1-e,3);function $t(e,n,t,r,i,o=250){let a=e.position.clone(),l=n.target.clone(),s=performance.now(),u=null,f=()=>{u=null;let E=Zt(Math.min((performance.now()-s)/o,1));e.position.lerpVectors(a,t,E),n.target.lerpVectors(l,r,E),i(),n.update(),E<1&&(u=requestAnimationFrame(f))};return u=requestAnimationFrame(f),{cancel:()=>{u!==null&&(cancelAnimationFrame(u),u=null)}}}var _LineSegments2js = require('three/addons/lines/LineSegments2.js');var _LineSegmentsGeometryjs = require('three/addons/lines/LineSegmentsGeometry.js');var Jt=.15,er=4096;function tr(e){let n=Math.floor(e.length/6);if(n===0)return 1/0;let t=Math.max(1,Math.ceil(n/er)),r=[];for(let i=0;i<n;i+=t){let o=i*6,a=Math.hypot(e[o+3]-e[o],e[o+4]-e[o+1],e[o+5]-e[o+2]);a>0&&r.push(a)}return r.length===0?1/0:(r.sort((i,o)=>i-o),r[Math.min(r.length-1,Math.floor(r.length*Jt))])}function Ue(e){let n=new _LineSegmentsGeometryjs.LineSegmentsGeometry;return n.setPositions(e),{geometry:n,segmentCount:e.length/6,edgeSpacing:tr(e)}}function ye(e,n,t){let o=Math.cos(Math.PI/180*t),a=e.length/3;if(a>=67108864)throw new Error(`extractEdgeSegments: ${a} vertices exceeds 2^26 limit`);let l=new Float64Array(a),s=new Float64Array(a),u=new Float64Array(a);for(let c=0;c<a;c++)l[c]=Math.round(e[3*c]*1e4),s[c]=Math.round(e[3*c+1]*1e4),u[c]=Math.round(e[3*c+2]*1e4);let f=16;for(;f<a*2;)f<<=1;let E=f-1,g=new Int32Array(f).fill(-1),m=new Int32Array(a);for(let c=0;c<a;c++){let R=(Math.imul(l[c]|0,73856093)^Math.imul(s[c]|0,19349663)^Math.imul(u[c]|0,83492791))&E;for(;;){let T=g[R];if(T===-1){g[R]=c,m[c]=c;break}if(l[T]===l[c]&&s[T]===s[c]&&u[T]===u[c]){m[c]=T;break}R=R+1&E}}let p=new Float32Array(4096),h=0,H=(c,R)=>{if(h+6>p.length){let T=new Float32Array(p.length*2);T.set(p),p=T}p[h++]=e[3*c],p[h++]=e[3*c+1],p[h++]=e[3*c+2],p[h++]=e[3*R],p[h++]=e[3*R+1],p[h++]=e[3*R+2]},x=new Map,S=[],A=[],V=[],d=(n?n.length:a)/3;for(let c=0;c<d;c++){let R=n?n[3*c]:3*c,T=n?n[3*c+1]:3*c+1,v=n?n[3*c+2]:3*c+2,C=m[R],_=m[T],F=m[v];if(C===_||_===F||F===C)continue;let q=e[3*v]-e[3*T],M=e[3*v+1]-e[3*T+1],O=e[3*v+2]-e[3*T+2],y=e[3*R]-e[3*T],b=e[3*R+1]-e[3*T+1],I=e[3*R+2]-e[3*T+2],k=M*I-O*b,N=O*y-q*I,G=q*b-M*y,Re=k*k+N*N+G*G;if(Re>0){let X=1/Math.sqrt(Re);k*=X,N*=X,G*=X}else k=0,N=0,G=0;for(let X=0;X<3;X++){let ee,U,K,oe;X===0?(ee=R,U=T,K=C,oe=_):X===1?(ee=T,U=v,K=_,oe=F):(ee=v,U=R,K=F,oe=C);let Te=oe*67108864+K,te=x.get(Te);if(te!==void 0&&te!==-1)k*V[3*te]+N*V[3*te+1]+G*V[3*te+2]<=o&&H(ee,U),x.set(Te,-1);else{let me=K*67108864+oe;if(!x.has(me)){let De=S.length;x.set(me,De),S.push(ee),A.push(U),V.push(k,N,G)}}}}for(let c of x.values())c!==-1&&H(S[c],A[c]);return p.slice(0,h)}function Be(){return[`const extract = ${ye.toString()};`,"self.onmessage = (event) => {"," const { id, positions, index, thresholdAngle } = event.data;"," try {"," const segments = extract(positions, index, thresholdAngle);"," self.postMessage({ id, segments }, [segments.buffer]);"," } catch (error) {"," self.postMessage({ id, error: String((error && error.message) || error) });"," }","};"].join(`
|
|
2
|
+
`)}var se="edge-overlay",He="triangle-cap",We=2236962,rr=1.5,nr=44,or=.75,ir=4e6,ar=2e6,qe=25e3,Xe=4,Le=1,Ke=0,Ye=-1;function Ze(e){return{forcedColor:e.color!=null?new xe.Color(e.color):null,darken:xe.MathUtils.clamp(_nullishCoalesce(e.darken, () => (or)),0,1),width:_nullishCoalesce(e.width, () => (rr)),thresholdAngle:_nullishCoalesce(e.thresholdAngle, () => (nr)),distanceFade:_nullishCoalesce(e.distanceFade, () => (!0)),maxTriangles:_nullishCoalesce(e.maxTriangles, () => (ir)),maxSegments:_nullishCoalesce(e.maxSegments, () => (ar))}}function Ce(e){let n=e.getAttribute("position");return n?(e.index?e.index.count:n.count)/3:0}function Qe(e){let n=e.getAttribute("position");if(!n||n.isInterleavedBufferAttribute||n.itemSize!==3||!(n.array instanceof Float32Array)||n.count>=67108864)return null;let t=e.index;return t&&!(t.array instanceof Uint32Array)&&!(t.array instanceof Uint16Array)?null:{positions:n.array,index:t?t.array:null}}function lr(e,n){let r=2166136261,i=s=>{r^=s,r=Math.imul(r,16777619)},o=new Uint32Array(e.positions.buffer,e.positions.byteOffset,e.positions.length),a=Math.min(4096,o.length);for(let s=0;s<a;s++)i(o[s]);for(let s=Math.max(a,o.length-4096);s<o.length;s++)i(o[s]);let l=0;if(e.index){l=e.index.length;let s=Math.min(4096,l);for(let u=0;u<s;u++)i(e.index[u]);for(let u=Math.max(s,l-4096);u<l;u++)i(e.index[u])}return`${n}:${e.positions.length}:${l}:${r>>>0}`}function cr(e,n){let t=new $e.EdgesGeometry(e,n),r=t.attributes.position?t.attributes.position.array:new Float32Array(0);return t.dispose(),r}function Fe(e,n){let t=Qe(e);return t?ye(t.positions,t.index,n):cr(e,n)}var le,he=new Map,dr=1;function ur(){if(le!==void 0)return le;if(typeof Worker>"u"||typeof Blob>"u"||typeof URL>"u"||typeof URL.createObjectURL!="function")return le=null,null;try{let e=URL.createObjectURL(new Blob([Be()],{type:"text/javascript"})),n=new Worker(e);n.onmessage=t=>{let{id:r,segments:i,error:o}=t.data,a=he.get(r);a&&(he.delete(r),i?a.resolve(i):a.reject(new Error(_nullishCoalesce(o, () => ("edge extraction failed in worker")))))},n.onerror=()=>{for(let t of he.values())t.reject(new Error("edge extraction worker crashed"));he.clear(),n.terminate(),le=null},le=n}catch (e2){le=null}return le}function mr(e,n,t){return new Promise((r,i)=>{let o=dr++;he.set(o,{resolve:r,reject:i});let a=n.positions.slice(),l=n.index?n.index.slice():null,s=[a.buffer];l&&s.push(l.buffer),e.postMessage({id:o,positions:a,index:l,thresholdAngle:t},s)})}var Oe=new Map;function Je(e,n){let t=Qe(e);if(!t||Ce(e)<qe)return Promise.resolve(Fe(e,n));let r=lr(t,n),i=Oe.get(r);if(i)return i;let o=ur();if(!o)return Promise.resolve(Fe(e,n));let a=mr(o,t,n).catch(()=>ye(t.positions,t.index,n)).finally(()=>{Oe.delete(r)});return Oe.set(r,a),a}var _LineMaterialjs = require('three/addons/lines/LineMaterial.js');function Er(e,n){let r=_optionalChain([(Array.isArray(e.material)?e.material[0]:e.material), 'optionalAccess', _4 => _4.color]);return r?r.clone().multiplyScalar(1-n):new ne.Color(We)}var we=class{constructor(n){_chunkBYLIBOAUcjs.a.call(void 0, this,"options",n);_chunkBYLIBOAUcjs.a.call(void 0, this,"byKey",new Map)}for(n,t){let r=_nullishCoalesce(this.options.forcedColor, () => (Er(n,this.options.darken))),i=r.getHex()*2+(t?1:0),o=this.byKey.get(i);return o||(o=fr(r,this.options.width,t),this.byKey.set(i,o)),o}disposeUnused(n){let t=new Set(n.map(r=>r.material));for(let r of this.byKey.values())t.has(r)||r.dispose()}};function fr(e,n,t){let r=new (0, _LineMaterialjs.LineMaterial)({color:e});return r.linewidth=n,r.polygonOffset=!0,r.polygonOffsetFactor=Ke,r.polygonOffsetUnits=Ye,t&&(r.transparent=!0),r}function rt(e,n,t){let r=new (0, _LineSegments2js.LineSegments2)(e.geometry,n);return r.userData.kind=se,r.raycast=()=>{},t&&Rr(r,e.edgeSpacing),r}var et=new ne.Vector3,hr=new ne.Vector3;function gr(e,n,t){e.geometry.boundingSphere||e.geometry.computeBoundingSphere();let r=e.geometry.boundingSphere;if(!r)return 1/0;if(n.isPerspectiveCamera){let i=n;et.copy(r.center).applyMatrix4(e.matrixWorld);let o=hr.setFromMatrixPosition(n.matrixWorld).distanceTo(et),a=r.radius*e.matrixWorld.getMaxScaleOnAxis();if(o<=a)return 1/0;let l=Math.tan(ne.MathUtils.degToRad(i.fov)*.5),s=2*o*l;return s>0?t/s:1/0}if(n.isOrthographicCamera){let i=n,o=(i.top-i.bottom)/i.zoom;return o>0?t/o:1/0}return 1/0}function Rr(e,n){e.onBeforeRender=(t,r,i)=>{_LineSegments2js.LineSegments2.prototype.onBeforeRender.call(e,t);let o=e.material,a=gr(e,i,o.resolution.y),l=n*a;o.opacity=ne.MathUtils.clamp((l-Le)/(Xe-Le),0,1)}}function br(e){return _optionalChain([e, 'access', _5 => _5.userData, 'optionalAccess', _6 => _6.kind])===se}function vr(e,n){let t=[];return e.traverse(r=>{if(r instanceof nt.Mesh&&!(r.userData.id==="floor"||r.userData.id==="grid")&&r.userData.kind!==se&&!r.children.some(i=>_optionalChain([i, 'access', _7 => _7.userData, 'optionalAccess', _8 => _8.kind])===se)&&r.geometry){if(Ce(r.geometry)>n){r.userData.edgesSkipped=He,console.debug(`[edges] skipping mesh over triangle cap (${Ce(r.geometry)} > ${n})`);return}delete r.userData.edgesSkipped,t.push(r)}}),t}function yr(e,n,t,r){let i=r.distanceFade&&n.segmentCount<=r.maxSegments,o=rt(n,t.for(e,i),i);return e.add(o),o}var ot=new WeakMap;function Ie(e){return _nullishCoalesce(ot.get(e), () => (0))}function xr(e,n){for(let t=e;t;t=t.parent)if(t===n)return!0;return!1}async function it(e,n={}){let t=Ze(n),r=new we(t),i=Ie(e),o=[],a=vr(e,t.maxTriangles).map(async l=>{let s=await Je(l.geometry,t.thresholdAngle);Ie(e)===i&&xr(l,e)&&(l.children.some(u=>_optionalChain([u, 'access', _9 => _9.userData, 'optionalAccess', _10 => _10.kind])===se)||o.push(yr(l,Ue(s),r,t)))});return await Promise.all(a),r.disposeUnused(o),o}function at(e){ot.set(e,Ie(e)+1);let n=[];e.traverse(r=>{r instanceof _LineSegments2js.LineSegments2&&br(r)&&n.push(r)});let t=new Set;for(let r of n)r.geometry.dispose(),t.add(r.material),r.removeFromParent();return t.forEach(r=>r.dispose()),n.length}function Hr(e){if(!(e>0)||!Number.isFinite(e))return 1;let n=Math.floor(Math.log10(e)),t=Math.pow(10,n),r=e/t;return(r>=5?5:r>=2?2:1)*t}var Cr=`
|
|
3
3
|
varying vec3 vWorldPos;
|
|
4
4
|
void main() {
|
|
5
5
|
vec4 world = modelMatrix * vec4(position, 1.0);
|
|
6
6
|
vWorldPos = world.xyz;
|
|
7
7
|
gl_Position = projectionMatrix * viewMatrix * world;
|
|
8
8
|
}
|
|
9
|
-
`,
|
|
9
|
+
`,wr=`
|
|
10
10
|
precision highp float;
|
|
11
11
|
varying vec3 vWorldPos;
|
|
12
12
|
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
uniform vec3 uCenter; // fade center (camera position projected onto the plane)
|
|
19
19
|
uniform float uFade;
|
|
20
20
|
|
|
21
|
-
//
|
|
22
|
-
// stay ~1px regardless of zoom (the standard "pristine grid" technique).
|
|
21
|
+
// Screen-space derivatives keep grid lines ~1px regardless of zoom ("pristine grid" technique).
|
|
23
22
|
float gridLine(vec2 coord, float spacing) {
|
|
24
23
|
vec2 c = coord / spacing;
|
|
25
24
|
vec2 d = fwidth(c);
|
|
@@ -51,8 +50,8 @@
|
|
|
51
50
|
if (alpha < 0.001) discard;
|
|
52
51
|
gl_FragColor = vec4(color, alpha);
|
|
53
52
|
}
|
|
54
|
-
`;function
|
|
55
|
-
\u0394x ${m(y.x)} \u0394y ${m(y.y)} \u0394z ${m(y.z)}`,E=_nullishCoalesce(a.format, () => (f)),g=new D.Raycaster,u=new D.Vector2,p=!1,h=[],C=[],b=null,A=null,S=new D.PointsMaterial({color:l,size:8,sizeAttenuation:!1,depthTest:!1}),I=new D.PointsMaterial({color:l,size:11,sizeAttenuation:!1,depthTest:!1,transparent:!0,opacity:.5}),d=null,c=v=>{if(!v){d&&(d.visible=!1);return}if(!d){let y=new D.BufferGeometry;y.setAttribute("position",new D.Float32BufferAttribute([0,0,0],3)),d=new D.Points(y,I),d.renderOrder=1e3,d.userData.id="measure",d.raycast=()=>{},t.add(d)}d.position.copy(v),d.visible=!0},R=v=>{let y=new D.BufferGeometry;y.setAttribute("position",new D.Float32BufferAttribute([v.x,v.y,v.z],3));let z=new D.Points(y,S);return z.renderOrder=999,z.userData.id="measure",z.raycast=()=>{},t.add(z),z},T=()=>{h.length=0,C.forEach(v=>{v.geometry.dispose(),v.removeFromParent()}),C.length=0,b&&(b.geometry.dispose(),b.material.dispose(),b.removeFromParent(),b=null),_optionalChain([A, 'optionalAccess', _11 => _11.remove, 'call', _12 => _12()]),A=null},x=()=>{if(h.length!==2)return;let[v,y]=h,z=new _LineGeometryjs.LineGeometry;z.setPositions([v.x,v.y,v.z,y.x,y.y,y.z]);let j=new (0, _LineMaterialjs.LineMaterial)({color:l});j.linewidth=2,j.depthTest=!1,b=new (0, _Line2js.Line2)(z,j),b.renderOrder=998,b.userData.id="measure",b.raycast=()=>{},t.add(b);let V=v.clone().add(y).multiplyScalar(.5),G=new D.Vector3(Math.abs(y.x-v.x),Math.abs(y.y-v.y),Math.abs(y.z-v.z));A=o.addLabel(E(v.distanceTo(y),G),V,a.labelClassName)},M=v=>{let y=n.getBoundingClientRect();u.x=(v.clientX-y.left)/y.width*2-1,u.y=-((v.clientY-y.top)/y.height)*2+1;let z=r();g.setFromCamera(u,z);let j=Br(z,_optionalChain([i, 'optionalCall', _13 => _13()]));g.params.Line.threshold=j,g.params.Points.threshold=j;let V=g.intersectObjects(t.children,!0).filter(G=>G.object.userData.id!=="measure"&&G.object.userData.id!=="grid");return V.length===0?null:qr(V[0],z,{width:y.width,height:y.height},s)},P=null,L=0,Y=()=>{L&&(cancelAnimationFrame(L),L=0),P=null};return{setEnabled:v=>{p=v,v||(Y(),T(),c(null))},isEnabled:()=>p,handleClick:v=>{if(!p)return!1;h.length===2&&T();let y=M(v);return y===null||(h.push(y),C.push(R(y)),h.length===2&&x()),!0},handleMove:v=>{p&&(P=v,!L&&(L=requestAnimationFrame(()=>{L=0;let y=P;P=null,!(!p||!y)&&c(M(y))})))},clear:T,dispose:()=>{Y(),T(),d&&(d.geometry.dispose(),d.removeFromParent(),d=null),S.dispose(),I.dispose()}}}var Xr=.5,Kr=.01,Yr=.05,Zr=[];function yt({camera:e,scene:n,groundNormals:t=()=>Zr}){let r=e.near,i=e.near,o=new Te.Vector3,a=new Te.Vector3;return{update:()=>{e.near!==i&&(r=e.near);let l=Q(n),m=r;if(!l.isEmpty()){let f=l.getSize(a).length()*.5,E=e.position.distanceTo(l.getCenter(o))-f;for(let g of t())E=Math.min(E,Math.abs(e.position.dot(g)));m=Te.MathUtils.clamp(E*Xr,r,e.far*Kr)}Math.abs(m-i)>i*Yr&&(e.near=m,e.updateProjectionMatrix(),i=m)}}}var _ViewHelperjs = require('three/addons/helpers/ViewHelper.js');function xt(e){let{camera:n,domElement:t,controller:r}=e,i=new (0, _ViewHelperjs.ViewHelper)(n,t);i.setLabels("X","Y","Z");let o=!0,a=128,s=new B.Raycaster,l=new B.OrthographicCamera(-2,2,2,-2,0,4);l.position.set(0,0,2),l.updateMatrixWorld();let m={posX:new B.Vector3(1,0,0),negX:new B.Vector3(-1,0,0),posY:new B.Vector3(0,1,0),negY:new B.Vector3(0,-1,0),posZ:new B.Vector3(0,0,1),negZ:new B.Vector3(0,0,-1)},f=g=>{let u=t.getBoundingClientRect(),p=u.left+t.offsetWidth-a-i.location.right,h=u.top+t.offsetHeight-a-i.location.bottom,C=new B.Vector2((g.clientX-p)/a*2-1,-((g.clientY-h)/a)*2+1);if(Math.abs(C.x)>1||Math.abs(C.y)>1)return null;i.quaternion.copy(n.quaternion).invert(),i.updateMatrixWorld(),s.setFromCamera(C,l);let b=s.intersectObjects(i.children,!1);for(let A of b){let S=_optionalChain([A, 'access', _14 => _14.object, 'access', _15 => _15.userData, 'optionalAccess', _16 => _16.type]);if(typeof S=="string"&&S in m)return S}return null};return{render:g=>{if(!o)return;let u=g.autoClear;g.autoClear=!1,i.render(g),g.autoClear=u},handleClick:g=>{if(!o)return!1;let u=f(g);return u?(r.getProjection()==="orthographic"&&r.setProjection("perspective"),r.setViewDirection(m[u],!1),!0):!1},setVisible:g=>{o=g},isVisible:()=>o,dispose:()=>i.dispose()}}function Ht(e,n,t,r,i,o,a,s,l,m,f,E,g,u,p=!0){let h=null,C=performance.now(),b=!0,A=0,S=500,I=new je.Matrix4,d=new je.Matrix4,c=null,R=()=>{b=!0},T=w=>{w.updateMatrixWorld();let k=c!==w||!I.equals(w.matrixWorld)||!d.equals(w.projectionMatrix);return k&&(c=w,I.copy(w.matrixWorld),d.copy(w.projectionMatrix)),k},x=e.domElement,M=["pointerdown","pointerup","wheel"];if(p)for(let w of M)x.addEventListener(w,R,{passive:!0});let P=()=>{let{width:w,height:k}=a();if(w===0||k===0)return;let v=Math.floor(w*s),y=Math.floor(k*s);(e.domElement.width!==v||e.domElement.height!==y)&&(e.setPixelRatio(s),e.setSize(w,k,!1),t.aspect=w/k,t.updateProjectionMatrix(),i.updateAspect(w,k),_optionalChain([E, 'optionalCall', _17 => _17(), 'optionalAccess', _18 => _18.setSize, 'call', _19 => _19(w,k,s)]),_optionalChain([g, 'optionalAccess', _20 => _20.setSize, 'call', _21 => _21(w,k)]),R())},L=function(){h=requestAnimationFrame(L);let w=performance.now(),k=(w-C)/1e3;C=w,P(),(o.enableDamping||o.autoRotate)&&o.update(),m&&m.update(r().position),u&&u.update(),_optionalChain([l, 'optionalCall', _22 => _22(k)]);let v=r();if(p){if(!(b||T(v)||w-A>=S))return;b=!1,A=w}let y=_optionalChain([E, 'optionalCall', _23 => _23()]);y?(y.setCamera(v),y.render(k)):e.render(n,v),g&&g.render(n,v),f&&f.render(e)};return{animate:L,dispose:()=>{if(h!==null&&(cancelAnimationFrame(h),h=null),p)for(let w of M)x.removeEventListener(w,R)},invalidate:R}}var W=new de.Vector3(0,0,1);function Ct(e){let n=e.sceneScale||"m",r={mm:{cameraDistance:20,near:.1,far:2e3,floorSize:100,lightDistance:10,lightHeight:20,minDistance:.1,shadowSize:100,scaleFactor:1e3},cm:{cameraDistance:20,near:.1,far:2e3,floorSize:100,lightDistance:25,lightHeight:50,minDistance:.1,shadowSize:100,scaleFactor:100},m:{cameraDistance:10,near:.01,far:2e3,floorSize:50,lightDistance:25,lightHeight:50,minDistance:.001,shadowSize:100,scaleFactor:1},inches:{cameraDistance:15,near:.1,far:2e3,floorSize:80,lightDistance:20,lightHeight:40,minDistance:.1,shadowSize:80,scaleFactor:39.37},feet:{cameraDistance:8,near:.1,far:2e3,floorSize:40,lightDistance:15,lightHeight:30,minDistance:.1,shadowSize:60,scaleFactor:3.28084}}[n],i=_nullishCoalesce(e.look, () => (_chunkAQJPVUH3cjs.h)),o=_chunkAQJPVUH3cjs.i[i];return{sceneScale:n,look:i,camera:{position:_optionalChain([e, 'access', _24 => _24.camera, 'optionalAccess', _25 => _25.position])||ye(_nullishCoalesce(_optionalChain([e, 'access', _26 => _26.environment, 'optionalAccess', _27 => _27.sceneUp]), () => (W)),r.cameraDistance*Math.sqrt(3)),fov:_optionalChain([e, 'access', _28 => _28.camera, 'optionalAccess', _29 => _29.fov])||20,near:_optionalChain([e, 'access', _30 => _30.camera, 'optionalAccess', _31 => _31.near])||r.near,far:_optionalChain([e, 'access', _32 => _32.camera, 'optionalAccess', _33 => _33.far])||r.far,target:_optionalChain([e, 'access', _34 => _34.camera, 'optionalAccess', _35 => _35.target])||new de.Vector3(0,0,0),dynamicNear:_nullishCoalesce(_optionalChain([e, 'access', _36 => _36.camera, 'optionalAccess', _37 => _37.dynamicNear]), () => (!0))},lighting:{enableSunlight:_nullishCoalesce(_optionalChain([e, 'access', _38 => _38.lighting, 'optionalAccess', _39 => _39.enableSunlight]), () => (!0)),sunlightIntensity:_nullishCoalesce(_optionalChain([e, 'access', _40 => _40.lighting, 'optionalAccess', _41 => _41.sunlightIntensity]), () => (1)),sunlightPosition:_optionalChain([e, 'access', _42 => _42.lighting, 'optionalAccess', _43 => _43.sunlightPosition])||qe(_nullishCoalesce(_optionalChain([e, 'access', _44 => _44.environment, 'optionalAccess', _45 => _45.sceneUp]), () => (W)),r.lightDistance,r.lightHeight),ambientLightColor:_optionalChain([e, 'access', _46 => _46.lighting, 'optionalAccess', _47 => _47.ambientLightColor])||new de.Color(4210752),ambientLightIntensity:_nullishCoalesce(_optionalChain([e, 'access', _48 => _48.lighting, 'optionalAccess', _49 => _49.ambientLightIntensity]), () => (o.ambientIntensity)),sunlightColor:_optionalChain([e, 'access', _50 => _50.lighting, 'optionalAccess', _51 => _51.sunlightColor])||16777215,enableHemisphereLight:_nullishCoalesce(_optionalChain([e, 'access', _52 => _52.lighting, 'optionalAccess', _53 => _53.enableHemisphereLight]), () => (o.hemisphereIntensity>0)),hemisphereSkyColor:_nullishCoalesce(_optionalChain([e, 'access', _54 => _54.lighting, 'optionalAccess', _55 => _55.hemisphereSkyColor]), () => (14673663)),hemisphereGroundColor:_nullishCoalesce(_optionalChain([e, 'access', _56 => _56.lighting, 'optionalAccess', _57 => _57.hemisphereGroundColor]), () => (7036754)),hemisphereIntensity:_nullishCoalesce(_optionalChain([e, 'access', _58 => _58.lighting, 'optionalAccess', _59 => _59.hemisphereIntensity]), () => (o.hemisphereIntensity))},environment:{hdrPath:_optionalChain([e, 'access', _60 => _60.environment, 'optionalAccess', _61 => _61.hdrPath])||"/baseHDR.hdr",backgroundColor:_optionalChain([e, 'access', _62 => _62.environment, 'optionalAccess', _63 => _63.backgroundColor])||new de.Color(15790320),enableEnvironmentLighting:_nullishCoalesce(_optionalChain([e, 'access', _64 => _64.environment, 'optionalAccess', _65 => _65.enableEnvironmentLighting]), () => (!0)),sceneUp:_optionalChain([e, 'access', _66 => _66.environment, 'optionalAccess', _67 => _67.sceneUp])||W,showEnvironment:_nullishCoalesce(_optionalChain([e, 'access', _68 => _68.environment, 'optionalAccess', _69 => _69.showEnvironment]), () => (!1)),environmentIntensity:_nullishCoalesce(_optionalChain([e, 'access', _70 => _70.environment, 'optionalAccess', _71 => _71.environmentIntensity]), () => (o.environmentIntensity))},floor:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _72 => _72.floor, 'optionalAccess', _73 => _73.enabled]), () => (!1)),size:_optionalChain([e, 'access', _74 => _74.floor, 'optionalAccess', _75 => _75.size])||r.floorSize,color:_optionalChain([e, 'access', _76 => _76.floor, 'optionalAccess', _77 => _77.color])||new de.Color(8421504),roughness:_nullishCoalesce(_optionalChain([e, 'access', _78 => _78.floor, 'optionalAccess', _79 => _79.roughness]), () => (.7)),metalness:_nullishCoalesce(_optionalChain([e, 'access', _80 => _80.floor, 'optionalAccess', _81 => _81.metalness]), () => (0)),receiveShadow:_nullishCoalesce(_optionalChain([e, 'access', _82 => _82.floor, 'optionalAccess', _83 => _83.receiveShadow]), () => (!0))},render:{enableShadows:_nullishCoalesce(_optionalChain([e, 'access', _84 => _84.render, 'optionalAccess', _85 => _85.enableShadows]), () => (!0)),shadowMapSize:_optionalChain([e, 'access', _86 => _86.render, 'optionalAccess', _87 => _87.shadowMapSize])||2048,antialias:_nullishCoalesce(_optionalChain([e, 'access', _88 => _88.render, 'optionalAccess', _89 => _89.antialias]), () => (!0)),pixelRatio:_optionalChain([e, 'access', _90 => _90.render, 'optionalAccess', _91 => _91.pixelRatio])||Math.min(window.devicePixelRatio,2),toneMapping:_nullishCoalesce(_optionalChain([e, 'access', _92 => _92.render, 'optionalAccess', _93 => _93.toneMapping]), () => (o.toneMapping)),toneMappingExposure:_nullishCoalesce(_optionalChain([e, 'access', _94 => _94.render, 'optionalAccess', _95 => _95.toneMappingExposure]), () => (o.toneMappingExposure)),preserveDrawingBuffer:_nullishCoalesce(_optionalChain([e, 'access', _96 => _96.render, 'optionalAccess', _97 => _97.preserveDrawingBuffer]), () => (!1)),ambientOcclusion:_nullishCoalesce(_optionalChain([e, 'access', _98 => _98.render, 'optionalAccess', _99 => _99.ambientOcclusion]), () => (o.ambientOcclusion)),aoIntensity:_nullishCoalesce(_optionalChain([e, 'access', _100 => _100.render, 'optionalAccess', _101 => _101.aoIntensity]), () => (1)),aoPixelRatio:_nullishCoalesce(_optionalChain([e, 'access', _102 => _102.render, 'optionalAccess', _103 => _103.aoPixelRatio]), () => (1)),onDemand:_nullishCoalesce(_optionalChain([e, 'access', _104 => _104.render, 'optionalAccess', _105 => _105.onDemand]), () => (!0))},controls:{enableDamping:_nullishCoalesce(_optionalChain([e, 'access', _106 => _106.controls, 'optionalAccess', _107 => _107.enableDamping]), () => (!1)),dampingFactor:_optionalChain([e, 'access', _108 => _108.controls, 'optionalAccess', _109 => _109.dampingFactor])||.05,autoRotate:_nullishCoalesce(_optionalChain([e, 'access', _110 => _110.controls, 'optionalAccess', _111 => _111.autoRotate]), () => (!1)),autoRotateSpeed:_optionalChain([e, 'access', _112 => _112.controls, 'optionalAccess', _113 => _113.autoRotateSpeed])||.5,enableZoom:_nullishCoalesce(_optionalChain([e, 'access', _114 => _114.controls, 'optionalAccess', _115 => _115.enableZoom]), () => (!0)),enablePan:_nullishCoalesce(_optionalChain([e, 'access', _116 => _116.controls, 'optionalAccess', _117 => _117.enablePan]), () => (!0)),minDistance:_optionalChain([e, 'access', _118 => _118.controls, 'optionalAccess', _119 => _119.minDistance])||r.minDistance,maxDistance:_optionalChain([e, 'access', _120 => _120.controls, 'optionalAccess', _121 => _121.maxDistance])||1/0},grid:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _122 => _122.grid, 'optionalAccess', _123 => _123.enabled]), () => (!1)),cellSize:_nullishCoalesce(_optionalChain([e, 'access', _124 => _124.grid, 'optionalAccess', _125 => _125.cellSize]), () => (1)),majorEvery:_nullishCoalesce(_optionalChain([e, 'access', _126 => _126.grid, 'optionalAccess', _127 => _127.majorEvery]), () => (10)),cellColor:_nullishCoalesce(_optionalChain([e, 'access', _128 => _128.grid, 'optionalAccess', _129 => _129.cellColor]), () => (8947848)),majorColor:_nullishCoalesce(_optionalChain([e, 'access', _130 => _130.grid, 'optionalAccess', _131 => _131.majorColor]), () => (4473924)),fadeDistance:_nullishCoalesce(_optionalChain([e, 'access', _132 => _132.grid, 'optionalAccess', _133 => _133.fadeDistance]), () => (100)),plane:_nullishCoalesce(_optionalChain([e, 'access', _134 => _134.grid, 'optionalAccess', _135 => _135.plane]), () => (xe(_nullishCoalesce(_optionalChain([e, 'access', _136 => _136.environment, 'optionalAccess', _137 => _137.sceneUp]), () => (W)))))},gizmo:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _138 => _138.gizmo, 'optionalAccess', _139 => _139.enabled]), () => (!1))},edges:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _140 => _140.edges, 'optionalAccess', _141 => _141.enabled]), () => (!1)),color:_optionalChain([e, 'access', _142 => _142.edges, 'optionalAccess', _143 => _143.color]),darken:_optionalChain([e, 'access', _144 => _144.edges, 'optionalAccess', _145 => _145.darken]),width:_nullishCoalesce(_optionalChain([e, 'access', _146 => _146.edges, 'optionalAccess', _147 => _147.width]), () => (1.5)),thresholdAngle:_nullishCoalesce(_optionalChain([e, 'access', _148 => _148.edges, 'optionalAccess', _149 => _149.thresholdAngle]), () => (44)),distanceFade:_nullishCoalesce(_optionalChain([e, 'access', _150 => _150.edges, 'optionalAccess', _151 => _151.distanceFade]), () => (!0)),maxTriangles:_optionalChain([e, 'access', _152 => _152.edges, 'optionalAccess', _153 => _153.maxTriangles]),maxSegments:_optionalChain([e, 'access', _154 => _154.edges, 'optionalAccess', _155 => _155.maxSegments]),screenSpaceFallback:_optionalChain([e, 'access', _156 => _156.edges, 'optionalAccess', _157 => _157.screenSpaceFallback])},measure:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _158 => _158.measure, 'optionalAccess', _159 => _159.enabled]), () => (!1)),snapPixels:_optionalChain([e, 'access', _160 => _160.measure, 'optionalAccess', _161 => _161.snapPixels]),color:_optionalChain([e, 'access', _162 => _162.measure, 'optionalAccess', _163 => _163.color]),labelClassName:_optionalChain([e, 'access', _164 => _164.measure, 'optionalAccess', _165 => _165.labelClassName]),displayUnit:_optionalChain([e, 'access', _166 => _166.measure, 'optionalAccess', _167 => _167.displayUnit]),format:_optionalChain([e, 'access', _168 => _168.measure, 'optionalAccess', _169 => _169.format])},events:{onBackgroundClicked:_optionalChain([e, 'access', _170 => _170.events, 'optionalAccess', _171 => _171.onBackgroundClicked]),onObjectSelected:_optionalChain([e, 'access', _172 => _172.events, 'optionalAccess', _173 => _173.onObjectSelected]),onMeshMetadataClicked:_optionalChain([e, 'access', _174 => _174.events, 'optionalAccess', _175 => _175.onMeshMetadataClicked]),onMeshDoubleClicked:_optionalChain([e, 'access', _176 => _176.events, 'optionalAccess', _177 => _177.onMeshDoubleClicked]),selectionColor:_optionalChain([e, 'access', _178 => _178.events, 'optionalAccess', _179 => _179.selectionColor])||"#ff0000",enableEventHandlers:_nullishCoalesce(_optionalChain([e, 'access', _180 => _180.events, 'optionalAccess', _181 => _181.enableEventHandlers]), () => (!0)),enableKeyboardControls:_nullishCoalesce(_optionalChain([e, 'access', _182 => _182.events, 'optionalAccess', _183 => _183.enableKeyboardControls]), () => (!0)),enableClickToFocus:_nullishCoalesce(_optionalChain([e, 'access', _184 => _184.events, 'optionalAccess', _185 => _185.enableClickToFocus]), () => (!0)),enableDoubleClickZoom:_nullishCoalesce(_optionalChain([e, 'access', _186 => _186.events, 'optionalAccess', _187 => _187.enableDoubleClickZoom]), () => (!0)),onReady:_optionalChain([e, 'access', _188 => _188.events, 'optionalAccess', _189 => _189.onReady]),onFrame:_optionalChain([e, 'access', _190 => _190.events, 'optionalAccess', _191 => _191.onFrame])},onMaxAnisotropy:e.onMaxAnisotropy}}function Mt(e){let{scene:n,renderer:t,lights:r,config:i,pipeline:o,requestRender:a}=e,s=i.look,l=u=>{u.ambientIntensity!==void 0&&(r.ambient.intensity=u.ambientIntensity),u.hemisphereIntensity!==void 0&&!r.hemisphere&&u.hemisphereIntensity>0&&(r.hemisphere=new wt.HemisphereLight(_nullishCoalesce(u.hemisphereSkyColor, () => (i.lighting.hemisphereSkyColor)),_nullishCoalesce(u.hemisphereGroundColor, () => (i.lighting.hemisphereGroundColor)),u.hemisphereIntensity),r.hemisphere.position.copy(_nullishCoalesce(i.environment.sceneUp, () => (W))),n.add(r.hemisphere)),r.hemisphere&&(u.hemisphereIntensity!==void 0&&(r.hemisphere.intensity=u.hemisphereIntensity),u.hemisphereSkyColor!==void 0&&r.hemisphere.color.set(u.hemisphereSkyColor),u.hemisphereGroundColor!==void 0&&r.hemisphere.groundColor.set(u.hemisphereGroundColor)),a()},m=u=>{i.environment.environmentIntensity=u,n.environmentIntensity=u,a()};return{setFillLights:l,setEnvironmentIntensity:m,setToneMappingExposure:u=>{i.render.toneMappingExposure=u,t.toneMappingExposure=u,o.get()&&o.rebuild()},setAoIntensity:u=>{i.render.aoIntensity=u,o.get()&&o.rebuild()},setLook:u=>{let p=_chunkAQJPVUH3cjs.i[u];s=u,t.toneMapping=p.toneMapping,t.toneMappingExposure=p.toneMappingExposure,i.render.toneMapping=p.toneMapping,i.render.toneMappingExposure=p.toneMappingExposure,l({hemisphereIntensity:p.hemisphereIntensity,ambientIntensity:p.ambientIntensity}),m(p.environmentIntensity);let h=o.get()!==null;o.setAmbientOcclusion(p.ambientOcclusion),h&&o.rebuild(),n.traverse(C=>{if(C.userData.source!=="compute")return;let b=C,A=Array.isArray(b.material)?b.material:b.material?[b.material]:[];for(let S of A)"envMapIntensity"in S&&(S.envMapIntensity=p.envMapIntensity)}),a()},getMaterialAppearance:()=>_chunkAQJPVUH3cjs.j.call(void 0, s)}}function Dt(e,n){let t=n.parentElement,r=t?t.clientWidth:window.innerWidth,i=t?t.clientHeight:window.innerHeight,o=new St.PerspectiveCamera(e.camera.fov,r/i,e.camera.near,e.camera.far),a=e.camera.position;return a&&o.position.set(a.x,a.y,a.z),o}function At(e){let n=new De.Scene,t=typeof e.environment.backgroundColor=="string"?new De.Color(e.environment.backgroundColor):e.environment.backgroundColor;return n.background=t||null,n}function Lt(e,n){_chunkAQJPVUH3cjs.v.call(void 0, e,n),_chunkAQJPVUH3cjs.p.call(void 0, _nullishCoalesce(e.environment, () => (void 0)))&&_optionalChain([e, 'access', _192 => _192.environment, 'optionalAccess', _193 => _193.dispose, 'call', _194 => _194()]),e.background instanceof Pt.Texture&&_chunkAQJPVUH3cjs.p.call(void 0, e.background)&&e.background.dispose()}var _EffectComposerjs = require('three/addons/postprocessing/EffectComposer.js');var _RenderPassjs = require('three/addons/postprocessing/RenderPass.js');var _GTAOPassjs = require('three/addons/postprocessing/GTAOPass.js');var _SMAAPassjs = require('three/addons/postprocessing/SMAAPass.js');var _OutputPassjs = require('three/addons/postprocessing/OutputPass.js');var _Passjs = require('three/addons/postprocessing/Pass.js');var Ne={uniforms:{tDiffuse:{value:null},tNormal:{value:null},tDepth:{value:null},uResolution:{value:new O.Vector2(1,1)},uColor:{value:new O.Color(2236962)},uOpacity:{value:1},uNormalThreshold:{value:.4},uDepthThreshold:{value:.02},uThickness:{value:1},uNear:{value:.1},uFar:{value:1e3},uPerspective:{value:1}},vertexShader:`
|
|
53
|
+
`;function st(e={}){let{cellSize:n=1,majorEvery:t=10,cellColor:r=8947848,majorColor:i=4473924,fadeDistance:o=100,plane:a="y"}=e,l=a==="y"?new z.Vector2(0,2):a==="z"?new z.Vector2(0,1):new z.Vector2(1,2),s=2.5,u=new z.PlaneGeometry(1,1);a==="y"?u.rotateX(-Math.PI/2):a==="x"&&u.rotateY(Math.PI/2);let f=new z.ShaderMaterial({vertexShader:Cr,fragmentShader:wr,transparent:!0,depthWrite:!1,side:z.DoubleSide,uniforms:{uAxes:{value:l},uCell:{value:n},uMajor:{value:t},uCellColor:{value:new z.Color(r)},uMajorColor:{value:new z.Color(i)},uCenter:{value:new z.Vector3},uFade:{value:o}}}),E=new z.Mesh(u,f);E.name="grid",E.userData.id="grid",E.renderOrder=-1;let g=o,m=o*s,p=new z.Vector3;return{object:E,update:h=>{a==="y"?(E.position.set(h.x,0,h.z),p.set(h.x,0,h.z)):a==="z"?(E.position.set(h.x,h.y,0),p.set(h.x,h.y,0)):(E.position.set(0,h.y,h.z),p.set(0,h.y,h.z)),f.uniforms.uCenter.value.copy(p),E.scale.setScalar(m)},fitToContent:h=>{if(h.isEmpty())return;let H=h.getSize(new z.Vector3),x=(V,d)=>d===0?V.x:d===1?V.y:V.z,S=Math.max(x(H,l.x),x(H,l.y));if(!(S>0)||!Number.isFinite(S))return;let A=20;f.uniforms.uCell.value=Hr(S/A),g=S*2,f.uniforms.uFade.value=g,m=g*s},setVisible:h=>{E.visible=h},dispose:()=>{E.removeFromParent(),u.dispose(),f.dispose()}}}var _CSS2DRendererjs = require('three/addons/renderers/CSS2DRenderer.js');function ct(e,n){let t=new _CSS2DRendererjs.CSS2DRenderer,r=t.domElement;r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="30",getComputedStyle(e).position==="static"&&(e.style.position="relative"),e.appendChild(r);let i={width:e.clientWidth||1,height:e.clientHeight||1};t.setSize(i.width,i.height);let o=new lt.Group;o.name="label-layer",o.userData.id="label-layer",n.add(o);let a=new Set;return{addLabel:(s,u,f)=>{let E=document.createElement("div");E.textContent=s,f?E.className=f:Object.assign(E.style,{padding:"2px 6px",borderRadius:"4px",background:"rgba(20, 20, 20, 0.78)",color:"#fff",font:"12px/1.3 system-ui, sans-serif",whiteSpace:"pre",textAlign:"center",userSelect:"none"}),E.style.pointerEvents="none";let g=new (0, _CSS2DRendererjs.CSS2DObject)(E);return g.position.copy(u),o.add(g),a.add(g),{object:g,setPosition:m=>g.position.copy(m),setText:m=>{E.textContent=m},remove:()=>{g.removeFromParent(),E.remove(),a.delete(g)}}},render:(s,u)=>t.render(s,u),setSize:(s,u)=>t.setSize(s,u),dispose:()=>{a.forEach(s=>{s.removeFromParent(),s.element.remove()}),a.clear(),o.removeFromParent(),r.remove()}}}var _Line2js = require('three/addons/lines/Line2.js');var _LineGeometryjs = require('three/addons/lines/LineGeometry.js');var Lr=12,Or=16763904,dt=.015,ut={Millimeters:{metersPerUnit:1/1e3,suffix:"mm"},Centimeters:{metersPerUnit:1/100,suffix:"cm"},Meters:{metersPerUnit:1,suffix:"m"},Inches:{metersPerUnit:1/39.37,suffix:"in"},Feet:{metersPerUnit:1/3.28084,suffix:"ft"}};function Fr(e){let n=e&&ut[e]||ut.Meters;return t=>`${(t/n.metersPerUnit).toPrecision(3)} ${n.suffix}`}function Ir(e,n){if(e.isOrthographicCamera){let r=e;return Math.abs(r.top-r.bottom)/(r.zoom||1)*dt}return((n?e.position.distanceTo(n):e.position.length())||1)*dt}function kr(e){let n=e.object;if(n instanceof D.Mesh)return e.face?[e.face.a,e.face.b,e.face.c]:null;if(n instanceof D.Points)return e.index!=null?[e.index]:null;if(n instanceof D.Line){if(e.index==null)return null;let t=n.geometry.index;return t?e.index+1>=t.count?null:[t.getX(e.index),t.getX(e.index+1)]:[e.index,e.index+1]}return null}function zr(e,n,t,r){let i=e.point.clone(),o=e.object,a=kr(e);if(!a||!o.geometry)return i;let l=o.geometry.attributes.position;if(!l)return i;let s=g=>{let m=g.clone().project(n);return new D.Vector2((m.x+1)/2*t.width,(1-m.y)/2*t.height)},u=s(i),f=i,E=r;for(let g of a){if(g>=l.count)continue;let p=new D.Vector3().fromBufferAttribute(l,g).applyMatrix4(o.matrixWorld),h=s(p).distanceTo(u);h<E&&(E=h,f=p)}return f}function mt(e){let{canvas:n,scene:t,getActiveCamera:r,getViewTarget:i,labelLayer:o,options:a={}}=e,l=_nullishCoalesce(a.snapPixels, () => (Lr)),s=new D.Color(_nullishCoalesce(a.color, () => (Or))),u=Fr(a.displayUnit),f=(y,b)=>`${u(y)}
|
|
54
|
+
\u0394x ${u(b.x)} \u0394y ${u(b.y)} \u0394z ${u(b.z)}`,E=_nullishCoalesce(a.format, () => (f)),g=new D.Raycaster,m=new D.Vector2,p=!1,h=[],H=[],x=null,S=null,A=new D.PointsMaterial({color:s,size:8,sizeAttenuation:!1,depthTest:!1}),V=new D.PointsMaterial({color:s,size:11,sizeAttenuation:!1,depthTest:!1,transparent:!0,opacity:.5}),d=null,c=y=>{if(!y){d&&(d.visible=!1);return}if(!d){let b=new D.BufferGeometry;b.setAttribute("position",new D.Float32BufferAttribute([0,0,0],3)),d=new D.Points(b,V),d.renderOrder=1e3,d.userData.id="measure",d.raycast=()=>{},t.add(d)}d.position.copy(y),d.visible=!0},R=y=>{let b=new D.BufferGeometry;b.setAttribute("position",new D.Float32BufferAttribute([y.x,y.y,y.z],3));let I=new D.Points(b,A);return I.renderOrder=999,I.userData.id="measure",I.raycast=()=>{},t.add(I),I},T=()=>{h.length=0,H.forEach(y=>{y.geometry.dispose(),y.removeFromParent()}),H.length=0,x&&(x.geometry.dispose(),x.material.dispose(),x.removeFromParent(),x=null),_optionalChain([S, 'optionalAccess', _11 => _11.remove, 'call', _12 => _12()]),S=null},v=()=>{if(h.length!==2)return;let[y,b]=h,I=new _LineGeometryjs.LineGeometry;I.setPositions([y.x,y.y,y.z,b.x,b.y,b.z]);let k=new (0, _LineMaterialjs.LineMaterial)({color:s});k.linewidth=2,k.depthTest=!1,x=new (0, _Line2js.Line2)(I,k),x.renderOrder=998,x.userData.id="measure",x.raycast=()=>{},t.add(x);let N=y.clone().add(b).multiplyScalar(.5),G=new D.Vector3(Math.abs(b.x-y.x),Math.abs(b.y-y.y),Math.abs(b.z-y.z));S=o.addLabel(E(y.distanceTo(b),G),N,a.labelClassName)},C=y=>{let b=n.getBoundingClientRect();m.x=(y.clientX-b.left)/b.width*2-1,m.y=-((y.clientY-b.top)/b.height)*2+1;let I=r();g.setFromCamera(m,I);let k=Ir(I,_optionalChain([i, 'optionalCall', _13 => _13()]));g.params.Line.threshold=k,g.params.Points.threshold=k;let N=g.intersectObjects(t.children,!0).filter(G=>G.object.userData.id!=="measure"&&G.object.userData.id!=="grid");return N.length===0?null:zr(N[0],I,{width:b.width,height:b.height},l)},_=null,F=0,q=()=>{F&&(cancelAnimationFrame(F),F=0),_=null};return{setEnabled:y=>{p=y,y||(q(),T(),c(null))},isEnabled:()=>p,handleClick:y=>{if(!p)return!1;h.length===2&&T();let b=C(y);return b===null||(h.push(b),H.push(R(b)),h.length===2&&v()),!0},handleMove:y=>{p&&(_=y,!F&&(F=requestAnimationFrame(()=>{F=0;let b=_;_=null,!(!p||!b)&&c(C(b))})))},clear:T,dispose:()=>{q(),T(),d&&(d.geometry.dispose(),d.removeFromParent(),d=null),A.dispose(),V.dispose()}}}var Vr=.5,_r=.01,jr=.05,Nr=[];function pt({camera:e,scene:n,groundNormals:t=()=>Nr}){let r=e.near,i=e.near,o=new ge.Vector3,a=new ge.Vector3;return{update:()=>{e.near!==i&&(r=e.near);let s=Q(n),u=r;if(!s.isEmpty()){let f=s.getSize(a).length()*.5,E=e.position.distanceTo(s.getCenter(o))-f;for(let g of t())E=Math.min(E,Math.abs(e.position.dot(g)));u=ge.MathUtils.clamp(E*Vr,r,e.far*_r)}Math.abs(u-i)>i*jr&&(e.near=u,e.updateProjectionMatrix(),i=u)}}}var _ViewHelperjs = require('three/addons/helpers/ViewHelper.js');function Et(e){let{camera:n,domElement:t,controller:r}=e,i=new (0, _ViewHelperjs.ViewHelper)(n,t);i.setLabels("X","Y","Z");let o=!0,a=128,l=new B.Raycaster,s=new B.OrthographicCamera(-2,2,2,-2,0,4);s.position.set(0,0,2),s.updateMatrixWorld();let u={posX:new B.Vector3(1,0,0),negX:new B.Vector3(-1,0,0),posY:new B.Vector3(0,1,0),negY:new B.Vector3(0,-1,0),posZ:new B.Vector3(0,0,1),negZ:new B.Vector3(0,0,-1)},f=g=>{let m=t.getBoundingClientRect(),p=m.left+t.offsetWidth-a-i.location.right,h=m.top+t.offsetHeight-a-i.location.bottom,H=new B.Vector2((g.clientX-p)/a*2-1,-((g.clientY-h)/a)*2+1);if(Math.abs(H.x)>1||Math.abs(H.y)>1)return null;i.quaternion.copy(n.quaternion).invert(),i.updateMatrixWorld(),l.setFromCamera(H,s);let x=l.intersectObjects(i.children,!1);for(let S of x){let A=_optionalChain([S, 'access', _14 => _14.object, 'access', _15 => _15.userData, 'optionalAccess', _16 => _16.type]);if(typeof A=="string"&&A in u)return A}return null};return{render:g=>{if(!o)return;let m=g.autoClear;g.autoClear=!1,i.render(g),g.autoClear=m},handleClick:g=>{if(!o)return!1;let m=f(g);return m?(r.getProjection()==="orthographic"&&r.setProjection("perspective"),r.setViewDirection(u[m],!1),!0):!1},setVisible:g=>{o=g},isVisible:()=>o,dispose:()=>i.dispose()}}function ft(e,n,t,r,i,o,a,l,s,u,f,E,g,m,p=!0){let h=null,H=performance.now(),x=!0,S=0,A=500,V=new ke.Matrix4,d=new ke.Matrix4,c=null,R=()=>{x=!0},T=M=>{M.updateMatrixWorld();let O=c!==M||!V.equals(M.matrixWorld)||!d.equals(M.projectionMatrix);return O&&(c=M,V.copy(M.matrixWorld),d.copy(M.projectionMatrix)),O},v=e.domElement,C=["pointerdown","pointerup","wheel"];if(p)for(let M of C)v.addEventListener(M,R,{passive:!0});let _=()=>{let{width:M,height:O}=a();if(M===0||O===0)return;let y=Math.floor(M*l),b=Math.floor(O*l);(e.domElement.width!==y||e.domElement.height!==b)&&(e.setPixelRatio(l),e.setSize(M,O,!1),t.aspect=M/O,t.updateProjectionMatrix(),i.updateAspect(M,O),_optionalChain([E, 'optionalCall', _17 => _17(), 'optionalAccess', _18 => _18.setSize, 'call', _19 => _19(M,O,l)]),_optionalChain([g, 'optionalAccess', _20 => _20.setSize, 'call', _21 => _21(M,O)]),R())},F=function(){h=requestAnimationFrame(F);let M=performance.now(),O=(M-H)/1e3;H=M,_(),(o.enableDamping||o.autoRotate)&&o.update(),u&&u.update(r().position),m&&m.update(),_optionalChain([s, 'optionalCall', _22 => _22(O)]);let y=r();if(p){if(!(x||T(y)||M-S>=A))return;x=!1,S=M}let b=_optionalChain([E, 'optionalCall', _23 => _23()]);b?(b.setCamera(y),b.render(O)):e.render(n,y),g&&g.render(n,y),f&&f.render(e)};return{animate:F,dispose:()=>{if(h!==null&&(cancelAnimationFrame(h),h=null),p)for(let M of C)v.removeEventListener(M,R)},invalidate:R}}var W=new ce.Vector3(0,0,1);function ht(e){let n=e.sceneScale||"m",r={mm:{cameraDistance:20,near:.1,far:2e3,floorSize:100,lightDistance:10,lightHeight:20,minDistance:.1,shadowSize:100,scaleFactor:1e3},cm:{cameraDistance:20,near:.1,far:2e3,floorSize:100,lightDistance:25,lightHeight:50,minDistance:.1,shadowSize:100,scaleFactor:100},m:{cameraDistance:10,near:.01,far:2e3,floorSize:50,lightDistance:25,lightHeight:50,minDistance:.001,shadowSize:100,scaleFactor:1},inches:{cameraDistance:15,near:.1,far:2e3,floorSize:80,lightDistance:20,lightHeight:40,minDistance:.1,shadowSize:80,scaleFactor:39.37},feet:{cameraDistance:8,near:.1,far:2e3,floorSize:40,lightDistance:15,lightHeight:30,minDistance:.1,shadowSize:60,scaleFactor:3.28084}}[n],i=_nullishCoalesce(e.look, () => (_chunkAZ4GBXXLcjs.h)),o=_chunkAZ4GBXXLcjs.i[i];return{sceneScale:n,look:i,camera:{position:_optionalChain([e, 'access', _24 => _24.camera, 'optionalAccess', _25 => _25.position])||be(_nullishCoalesce(_optionalChain([e, 'access', _26 => _26.environment, 'optionalAccess', _27 => _27.sceneUp]), () => (W)),r.cameraDistance*Math.sqrt(3)),fov:_optionalChain([e, 'access', _28 => _28.camera, 'optionalAccess', _29 => _29.fov])||20,near:_optionalChain([e, 'access', _30 => _30.camera, 'optionalAccess', _31 => _31.near])||r.near,far:_optionalChain([e, 'access', _32 => _32.camera, 'optionalAccess', _33 => _33.far])||r.far,target:_optionalChain([e, 'access', _34 => _34.camera, 'optionalAccess', _35 => _35.target])||new ce.Vector3(0,0,0),dynamicNear:_nullishCoalesce(_optionalChain([e, 'access', _36 => _36.camera, 'optionalAccess', _37 => _37.dynamicNear]), () => (!0))},lighting:{enableSunlight:_nullishCoalesce(_optionalChain([e, 'access', _38 => _38.lighting, 'optionalAccess', _39 => _39.enableSunlight]), () => (!0)),sunlightIntensity:_nullishCoalesce(_optionalChain([e, 'access', _40 => _40.lighting, 'optionalAccess', _41 => _41.sunlightIntensity]), () => (1)),sunlightPosition:_optionalChain([e, 'access', _42 => _42.lighting, 'optionalAccess', _43 => _43.sunlightPosition])||je(_nullishCoalesce(_optionalChain([e, 'access', _44 => _44.environment, 'optionalAccess', _45 => _45.sceneUp]), () => (W)),r.lightDistance,r.lightHeight),ambientLightColor:_optionalChain([e, 'access', _46 => _46.lighting, 'optionalAccess', _47 => _47.ambientLightColor])||new ce.Color(4210752),ambientLightIntensity:_nullishCoalesce(_optionalChain([e, 'access', _48 => _48.lighting, 'optionalAccess', _49 => _49.ambientLightIntensity]), () => (o.ambientIntensity)),sunlightColor:_optionalChain([e, 'access', _50 => _50.lighting, 'optionalAccess', _51 => _51.sunlightColor])||16777215,enableHemisphereLight:_nullishCoalesce(_optionalChain([e, 'access', _52 => _52.lighting, 'optionalAccess', _53 => _53.enableHemisphereLight]), () => (o.hemisphereIntensity>0)),hemisphereSkyColor:_nullishCoalesce(_optionalChain([e, 'access', _54 => _54.lighting, 'optionalAccess', _55 => _55.hemisphereSkyColor]), () => (14673663)),hemisphereGroundColor:_nullishCoalesce(_optionalChain([e, 'access', _56 => _56.lighting, 'optionalAccess', _57 => _57.hemisphereGroundColor]), () => (7036754)),hemisphereIntensity:_nullishCoalesce(_optionalChain([e, 'access', _58 => _58.lighting, 'optionalAccess', _59 => _59.hemisphereIntensity]), () => (o.hemisphereIntensity))},environment:{hdrPath:_optionalChain([e, 'access', _60 => _60.environment, 'optionalAccess', _61 => _61.hdrPath])||"/baseHDR.hdr",backgroundColor:_optionalChain([e, 'access', _62 => _62.environment, 'optionalAccess', _63 => _63.backgroundColor])||new ce.Color(15790320),enableEnvironmentLighting:_nullishCoalesce(_optionalChain([e, 'access', _64 => _64.environment, 'optionalAccess', _65 => _65.enableEnvironmentLighting]), () => (!0)),sceneUp:_optionalChain([e, 'access', _66 => _66.environment, 'optionalAccess', _67 => _67.sceneUp])||W,showEnvironment:_nullishCoalesce(_optionalChain([e, 'access', _68 => _68.environment, 'optionalAccess', _69 => _69.showEnvironment]), () => (!1)),environmentIntensity:_nullishCoalesce(_optionalChain([e, 'access', _70 => _70.environment, 'optionalAccess', _71 => _71.environmentIntensity]), () => (o.environmentIntensity))},floor:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _72 => _72.floor, 'optionalAccess', _73 => _73.enabled]), () => (!1)),size:_optionalChain([e, 'access', _74 => _74.floor, 'optionalAccess', _75 => _75.size])||r.floorSize,color:_optionalChain([e, 'access', _76 => _76.floor, 'optionalAccess', _77 => _77.color])||new ce.Color(8421504),roughness:_nullishCoalesce(_optionalChain([e, 'access', _78 => _78.floor, 'optionalAccess', _79 => _79.roughness]), () => (.7)),metalness:_nullishCoalesce(_optionalChain([e, 'access', _80 => _80.floor, 'optionalAccess', _81 => _81.metalness]), () => (0)),receiveShadow:_nullishCoalesce(_optionalChain([e, 'access', _82 => _82.floor, 'optionalAccess', _83 => _83.receiveShadow]), () => (!0))},render:{enableShadows:_nullishCoalesce(_optionalChain([e, 'access', _84 => _84.render, 'optionalAccess', _85 => _85.enableShadows]), () => (!0)),shadowMapSize:_optionalChain([e, 'access', _86 => _86.render, 'optionalAccess', _87 => _87.shadowMapSize])||2048,antialias:_nullishCoalesce(_optionalChain([e, 'access', _88 => _88.render, 'optionalAccess', _89 => _89.antialias]), () => (!0)),pixelRatio:_optionalChain([e, 'access', _90 => _90.render, 'optionalAccess', _91 => _91.pixelRatio])||Math.min(window.devicePixelRatio,2),toneMapping:_nullishCoalesce(_optionalChain([e, 'access', _92 => _92.render, 'optionalAccess', _93 => _93.toneMapping]), () => (o.toneMapping)),toneMappingExposure:_nullishCoalesce(_optionalChain([e, 'access', _94 => _94.render, 'optionalAccess', _95 => _95.toneMappingExposure]), () => (o.toneMappingExposure)),preserveDrawingBuffer:_nullishCoalesce(_optionalChain([e, 'access', _96 => _96.render, 'optionalAccess', _97 => _97.preserveDrawingBuffer]), () => (!1)),ambientOcclusion:_nullishCoalesce(_optionalChain([e, 'access', _98 => _98.render, 'optionalAccess', _99 => _99.ambientOcclusion]), () => (o.ambientOcclusion)),aoIntensity:_nullishCoalesce(_optionalChain([e, 'access', _100 => _100.render, 'optionalAccess', _101 => _101.aoIntensity]), () => (1)),aoPixelRatio:_nullishCoalesce(_optionalChain([e, 'access', _102 => _102.render, 'optionalAccess', _103 => _103.aoPixelRatio]), () => (1)),onDemand:_nullishCoalesce(_optionalChain([e, 'access', _104 => _104.render, 'optionalAccess', _105 => _105.onDemand]), () => (!0))},controls:{enableDamping:_nullishCoalesce(_optionalChain([e, 'access', _106 => _106.controls, 'optionalAccess', _107 => _107.enableDamping]), () => (!1)),dampingFactor:_optionalChain([e, 'access', _108 => _108.controls, 'optionalAccess', _109 => _109.dampingFactor])||.05,autoRotate:_nullishCoalesce(_optionalChain([e, 'access', _110 => _110.controls, 'optionalAccess', _111 => _111.autoRotate]), () => (!1)),autoRotateSpeed:_optionalChain([e, 'access', _112 => _112.controls, 'optionalAccess', _113 => _113.autoRotateSpeed])||.5,enableZoom:_nullishCoalesce(_optionalChain([e, 'access', _114 => _114.controls, 'optionalAccess', _115 => _115.enableZoom]), () => (!0)),enablePan:_nullishCoalesce(_optionalChain([e, 'access', _116 => _116.controls, 'optionalAccess', _117 => _117.enablePan]), () => (!0)),minDistance:_optionalChain([e, 'access', _118 => _118.controls, 'optionalAccess', _119 => _119.minDistance])||r.minDistance,maxDistance:_optionalChain([e, 'access', _120 => _120.controls, 'optionalAccess', _121 => _121.maxDistance])||1/0},grid:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _122 => _122.grid, 'optionalAccess', _123 => _123.enabled]), () => (!1)),cellSize:_nullishCoalesce(_optionalChain([e, 'access', _124 => _124.grid, 'optionalAccess', _125 => _125.cellSize]), () => (1)),majorEvery:_nullishCoalesce(_optionalChain([e, 'access', _126 => _126.grid, 'optionalAccess', _127 => _127.majorEvery]), () => (10)),cellColor:_nullishCoalesce(_optionalChain([e, 'access', _128 => _128.grid, 'optionalAccess', _129 => _129.cellColor]), () => (8947848)),majorColor:_nullishCoalesce(_optionalChain([e, 'access', _130 => _130.grid, 'optionalAccess', _131 => _131.majorColor]), () => (4473924)),fadeDistance:_nullishCoalesce(_optionalChain([e, 'access', _132 => _132.grid, 'optionalAccess', _133 => _133.fadeDistance]), () => (100)),plane:_nullishCoalesce(_optionalChain([e, 'access', _134 => _134.grid, 'optionalAccess', _135 => _135.plane]), () => (ve(_nullishCoalesce(_optionalChain([e, 'access', _136 => _136.environment, 'optionalAccess', _137 => _137.sceneUp]), () => (W)))))},gizmo:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _138 => _138.gizmo, 'optionalAccess', _139 => _139.enabled]), () => (!1))},edges:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _140 => _140.edges, 'optionalAccess', _141 => _141.enabled]), () => (!1)),color:_optionalChain([e, 'access', _142 => _142.edges, 'optionalAccess', _143 => _143.color]),darken:_optionalChain([e, 'access', _144 => _144.edges, 'optionalAccess', _145 => _145.darken]),width:_nullishCoalesce(_optionalChain([e, 'access', _146 => _146.edges, 'optionalAccess', _147 => _147.width]), () => (1.5)),thresholdAngle:_nullishCoalesce(_optionalChain([e, 'access', _148 => _148.edges, 'optionalAccess', _149 => _149.thresholdAngle]), () => (44)),distanceFade:_nullishCoalesce(_optionalChain([e, 'access', _150 => _150.edges, 'optionalAccess', _151 => _151.distanceFade]), () => (!0)),maxTriangles:_optionalChain([e, 'access', _152 => _152.edges, 'optionalAccess', _153 => _153.maxTriangles]),maxSegments:_optionalChain([e, 'access', _154 => _154.edges, 'optionalAccess', _155 => _155.maxSegments]),screenSpaceFallback:_optionalChain([e, 'access', _156 => _156.edges, 'optionalAccess', _157 => _157.screenSpaceFallback])},measure:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _158 => _158.measure, 'optionalAccess', _159 => _159.enabled]), () => (!1)),snapPixels:_optionalChain([e, 'access', _160 => _160.measure, 'optionalAccess', _161 => _161.snapPixels]),color:_optionalChain([e, 'access', _162 => _162.measure, 'optionalAccess', _163 => _163.color]),labelClassName:_optionalChain([e, 'access', _164 => _164.measure, 'optionalAccess', _165 => _165.labelClassName]),displayUnit:_optionalChain([e, 'access', _166 => _166.measure, 'optionalAccess', _167 => _167.displayUnit]),format:_optionalChain([e, 'access', _168 => _168.measure, 'optionalAccess', _169 => _169.format])},events:{onBackgroundClicked:_optionalChain([e, 'access', _170 => _170.events, 'optionalAccess', _171 => _171.onBackgroundClicked]),onObjectSelected:_optionalChain([e, 'access', _172 => _172.events, 'optionalAccess', _173 => _173.onObjectSelected]),onMeshMetadataClicked:_optionalChain([e, 'access', _174 => _174.events, 'optionalAccess', _175 => _175.onMeshMetadataClicked]),onMeshDoubleClicked:_optionalChain([e, 'access', _176 => _176.events, 'optionalAccess', _177 => _177.onMeshDoubleClicked]),selectionColor:_optionalChain([e, 'access', _178 => _178.events, 'optionalAccess', _179 => _179.selectionColor])||"#ff0000",enableEventHandlers:_nullishCoalesce(_optionalChain([e, 'access', _180 => _180.events, 'optionalAccess', _181 => _181.enableEventHandlers]), () => (!0)),enableKeyboardControls:_nullishCoalesce(_optionalChain([e, 'access', _182 => _182.events, 'optionalAccess', _183 => _183.enableKeyboardControls]), () => (!0)),enableClickToFocus:_nullishCoalesce(_optionalChain([e, 'access', _184 => _184.events, 'optionalAccess', _185 => _185.enableClickToFocus]), () => (!0)),enableDoubleClickZoom:_nullishCoalesce(_optionalChain([e, 'access', _186 => _186.events, 'optionalAccess', _187 => _187.enableDoubleClickZoom]), () => (!0)),onReady:_optionalChain([e, 'access', _188 => _188.events, 'optionalAccess', _189 => _189.onReady]),onFrame:_optionalChain([e, 'access', _190 => _190.events, 'optionalAccess', _191 => _191.onFrame])},onMaxAnisotropy:e.onMaxAnisotropy}}function Rt(e){let{scene:n,renderer:t,lights:r,config:i,pipeline:o,requestRender:a}=e,l=i.look,s=m=>{m.ambientIntensity!==void 0&&(r.ambient.intensity=m.ambientIntensity),m.hemisphereIntensity!==void 0&&!r.hemisphere&&m.hemisphereIntensity>0&&(r.hemisphere=new gt.HemisphereLight(_nullishCoalesce(m.hemisphereSkyColor, () => (i.lighting.hemisphereSkyColor)),_nullishCoalesce(m.hemisphereGroundColor, () => (i.lighting.hemisphereGroundColor)),m.hemisphereIntensity),r.hemisphere.position.copy(_nullishCoalesce(i.environment.sceneUp, () => (W))),n.add(r.hemisphere)),r.hemisphere&&(m.hemisphereIntensity!==void 0&&(r.hemisphere.intensity=m.hemisphereIntensity),m.hemisphereSkyColor!==void 0&&r.hemisphere.color.set(m.hemisphereSkyColor),m.hemisphereGroundColor!==void 0&&r.hemisphere.groundColor.set(m.hemisphereGroundColor)),a()},u=m=>{i.environment.environmentIntensity=m,n.environmentIntensity=m,a()};return{setFillLights:s,setEnvironmentIntensity:u,setToneMappingExposure:m=>{i.render.toneMappingExposure=m,t.toneMappingExposure=m,o.get()&&o.rebuild()},setAoIntensity:m=>{i.render.aoIntensity=m,o.get()&&o.rebuild()},setLook:m=>{let p=_chunkAZ4GBXXLcjs.i[m];l=m,t.toneMapping=p.toneMapping,t.toneMappingExposure=p.toneMappingExposure,i.render.toneMapping=p.toneMapping,i.render.toneMappingExposure=p.toneMappingExposure,s({hemisphereIntensity:p.hemisphereIntensity,ambientIntensity:p.ambientIntensity}),u(p.environmentIntensity);let h=o.get()!==null;o.setAmbientOcclusion(p.ambientOcclusion),h&&o.rebuild(),n.traverse(H=>{if(H.userData.source!=="compute")return;let x=H,S=Array.isArray(x.material)?x.material:x.material?[x.material]:[];for(let A of S)"envMapIntensity"in A&&(A.envMapIntensity=p.envMapIntensity)}),a()},getMaterialAppearance:()=>_chunkAZ4GBXXLcjs.j.call(void 0, l)}}function bt(e,n){let t=n.parentElement,r=t?t.clientWidth:window.innerWidth,i=t?t.clientHeight:window.innerHeight,o=new Tt.PerspectiveCamera(e.camera.fov,r/i,e.camera.near,e.camera.far),a=e.camera.position;return a&&o.position.set(a.x,a.y,a.z),o}function vt(e){let n=new Me.Scene,t=typeof e.environment.backgroundColor=="string"?new Me.Color(e.environment.backgroundColor):e.environment.backgroundColor;return n.background=t||null,n}function xt(e,n){_chunkAZ4GBXXLcjs.p.call(void 0, e,n),_optionalChain([e, 'access', _192 => _192.environment, 'optionalAccess', _193 => _193.dispose, 'call', _194 => _194()]),e.background instanceof yt.Texture&&e.background.dispose()}var _EffectComposerjs = require('three/addons/postprocessing/EffectComposer.js');var _RenderPassjs = require('three/addons/postprocessing/RenderPass.js');var _GTAOPassjs = require('three/addons/postprocessing/GTAOPass.js');var _SMAAPassjs = require('three/addons/postprocessing/SMAAPass.js');var _OutputPassjs = require('three/addons/postprocessing/OutputPass.js');var _Passjs = require('three/addons/postprocessing/Pass.js');var ze={uniforms:{tDiffuse:{value:null},tNormal:{value:null},tDepth:{value:null},uResolution:{value:new P.Vector2(1,1)},uColor:{value:new P.Color(2236962)},uOpacity:{value:1},uNormalThreshold:{value:.4},uDepthThreshold:{value:.02},uThickness:{value:1},uNear:{value:.1},uFar:{value:1e3},uPerspective:{value:1}},vertexShader:`
|
|
56
55
|
varying vec2 vUv;
|
|
57
56
|
void main() {
|
|
58
57
|
vUv = uv;
|
|
@@ -91,8 +90,8 @@
|
|
|
91
90
|
float z2 = viewZOf(texture2D(tDepth, vUv + offsetB).x);
|
|
92
91
|
float z3 = viewZOf(texture2D(tDepth, vUv - offsetB).x);
|
|
93
92
|
float zCenter = viewZOf(texture2D(tDepth, vUv).x);
|
|
94
|
-
// Normalized by center depth, not absolute Z: keeps the response scale-invariant
|
|
95
|
-
//
|
|
93
|
+
// Normalized by center depth, not absolute Z: keeps the response scale-invariant (an
|
|
94
|
+
// absolute threshold would be noise far away, blind up close).
|
|
96
95
|
float depthDelta = (abs(z0 - z1) + abs(z2 - z3)) / max(abs(zCenter), 1e-6);
|
|
97
96
|
float depthEdge = step(uDepthThreshold, depthDelta);
|
|
98
97
|
|
|
@@ -106,5 +105,5 @@
|
|
|
106
105
|
float edge = max(depthEdge, normalEdge) * uOpacity;
|
|
107
106
|
gl_FragColor = vec4(mix(color.rgb, uColor, edge), color.a);
|
|
108
107
|
}
|
|
109
|
-
`},Ae=class extends _Passjs.Pass{constructor(t,r,i,o,a={}){super();_chunkBYLIBOAUcjs.a.call(void 0, this,"camera");_chunkBYLIBOAUcjs.a.call(void 0, this,"scene");_chunkBYLIBOAUcjs.a.call(void 0, this,"normalMaterial");_chunkBYLIBOAUcjs.a.call(void 0, this,"edgeMaterial");_chunkBYLIBOAUcjs.a.call(void 0, this,"fsQuad");_chunkBYLIBOAUcjs.a.call(void 0, this,"normalTarget",null);_chunkBYLIBOAUcjs.a.call(void 0, this,"width");_chunkBYLIBOAUcjs.a.call(void 0, this,"height");this.scene=t,this.camera=r,this.width=Math.max(1,i),this.height=Math.max(1,o),this.normalMaterial=new O.MeshNormalMaterial,this.normalMaterial.blending=O.NoBlending,this.edgeMaterial=new O.ShaderMaterial({uniforms:O.UniformsUtils.clone(Ne.uniforms),vertexShader:Ne.vertexShader,fragmentShader:Ne.fragmentShader});let s=this.edgeMaterial.uniforms;s.uColor.value=new O.Color(_nullishCoalesce(a.color, () => (2236962))),s.uOpacity.value=_nullishCoalesce(a.opacity, () => (1)),s.uNormalThreshold.value=_nullishCoalesce(a.normalThreshold, () => (.4)),s.uDepthThreshold.value=_nullishCoalesce(a.depthThreshold, () => (.02)),s.uThickness.value=_nullishCoalesce(a.thickness, () => (1)),this.fsQuad=new (0, _Passjs.FullScreenQuad)(this.edgeMaterial),this.needsSwap=!0}acquireNormalTarget(){if(!this.normalTarget){let t=new O.DepthTexture(this.width,this.height);this.normalTarget=new O.WebGLRenderTarget(this.width,this.height,{minFilter:O.NearestFilter,magFilter:O.NearestFilter,depthTexture:t})}return this.normalTarget}setSize(t,r){this.width=Math.max(1,t),this.height=Math.max(1,r),_optionalChain([this, 'access', _195 => _195.normalTarget, 'optionalAccess', _196 => _196.setSize, 'call', _197 => _197(this.width,this.height)])}render(t,r,i){let o=this.acquireNormalTarget(),a=t.getRenderTarget(),s=t.autoClear,l=t.getClearColor(new O.Color),m=t.getClearAlpha(),f=this.scene.overrideMaterial;t.setRenderTarget(o),t.setClearColor(7829503,1),t.autoClear=!0,this.scene.overrideMaterial=this.normalMaterial,t.render(this.scene,this.camera),this.scene.overrideMaterial=f,t.setClearColor(l,m),t.autoClear=s;let E=this.edgeMaterial.uniforms;E.tDiffuse.value=i.texture,E.tNormal.value=o.texture,E.tDepth.value=o.depthTexture,E.uResolution.value.set(this.width,this.height);let g=this.camera;E.uPerspective.value=g.isPerspectiveCamera?1:0,E.uNear.value=_nullishCoalesce(this.camera.near, () => (.1)),E.uFar.value=_nullishCoalesce(this.camera.far, () => (1e3)),t.setRenderTarget(this.renderToScreen?null:r),this.fsQuad.render(t),t.setRenderTarget(a)}dispose(){_optionalChain([this, 'access', _198 => _198.normalTarget, 'optionalAccess', _199 => _199.dispose, 'call', _200 => _200()]),this.normalMaterial.dispose(),this.edgeMaterial.dispose(),this.fsQuad.dispose()}};function Ot(e,n,t,r,i,o){let a=new (0, _EffectComposerjs.EffectComposer)(e),s=new (0, _RenderPassjs.RenderPass)(n,t);a.addPass(s);let l=null;(_nullishCoalesce(o.ambientOcclusion, () => (!0)))&&(l=new (0, _GTAOPassjs.GTAOPass)(n,t,r,i),l.blendIntensity=_nullishCoalesce(o.aoIntensity, () => (1)),l.updateGtaoMaterial({screenSpaceRadius:!0}),a.addPass(l));let m=typeof o.edgeDetection=="object"?o.edgeDetection:{},f=new Ae(n,t,r,i,m);f.enabled=!!o.edgeDetection,a.addPass(f);let E=new _SMAAPassjs.SMAAPass;a.addPass(E);let g=new _OutputPassjs.OutputPass;a.addPass(g),e.toneMapping=o.toneMapping,e.toneMappingExposure=o.toneMappingExposure;let u=_nullishCoalesce(o.aoPixelRatio, () => (1));return a.setSize(r,i),{render:p=>a.render(p),setSize:(p,h,C)=>{a.setPixelRatio(Math.min(C,u)),a.setSize(p,h)},setCamera:p=>{if(s.camera=p,f.camera=p,!l)return;l.camera=p;let h=p.isPerspectiveCamera?1:0;l.gtaoMaterial.defines.PERSPECTIVE_CAMERA!==h&&(l.gtaoMaterial.defines.PERSPECTIVE_CAMERA=h,l.gtaoMaterial.needsUpdate=!0)},setEdgeDetection:p=>{f.enabled=p},edgeDetectionEnabled:()=>f.enabled,dispose:()=>{a.dispose(),_optionalChain([l, 'optionalAccess', _201 => _201.dispose, 'call', _202 => _202()]),f.dispose(),E.dispose(),g.dispose()}}}function It(e){let{renderer:n,scene:t,getActiveCamera:r,getCanvasSize:i,pixelRatio:o,config:a,requestRender:s}=e,l=null,m=!!a.render.ambientOcclusion,f=!1,E=!1,g=p=>{let{width:h,height:C}=i(),b=Ot(n,t,r(),Math.max(1,h),Math.max(1,C),{toneMapping:_nullishCoalesce(a.render.toneMapping, () => (Ft.NeutralToneMapping)),toneMappingExposure:_nullishCoalesce(a.render.toneMappingExposure, () => (1)),ambientOcclusion:p,aoIntensity:a.render.aoIntensity,aoPixelRatio:a.render.aoPixelRatio,edgeDetection:!1});return b.setSize(Math.max(1,h),Math.max(1,C),o),b},u=()=>{if(!(m||f)){_optionalChain([l, 'optionalAccess', _203 => _203.dispose, 'call', _204 => _204()]),l=null,s();return}(!l||E!==m)&&(_optionalChain([l, 'optionalAccess', _205 => _205.dispose, 'call', _206 => _206()]),l=g(m),E=m),l.setEdgeDetection(f),s()};return{get:()=>l,sync:u,rebuild:()=>{_optionalChain([l, 'optionalAccess', _207 => _207.dispose, 'call', _208 => _208()]),l=null,u()},setAmbientOcclusion:p=>{m=p,u()},setEdgeFallback:p=>{p!==f&&(f=p,u())},isEdgeFallbackActive:()=>f,dispose:()=>{_optionalChain([l, 'optionalAccess', _209 => _209.dispose, 'call', _210 => _210()]),l=null}}}var _OrbitControlsjs = require('three/addons/controls/OrbitControls.js');function kt(e,n,t){let r=new (0, _OrbitControlsjs.OrbitControls)(e,n),i=t.camera.target;return i&&r.target.set(i.x,i.y,i.z),r.enableDamping=t.controls.enableDamping||!1,r.dampingFactor=t.controls.dampingFactor||.05,r.autoRotate=t.controls.autoRotate||!1,r.autoRotateSpeed=t.controls.autoRotateSpeed||.5,r.enableZoom=_nullishCoalesce(t.controls.enableZoom, () => (!0)),r.enablePan=_nullishCoalesce(t.controls.enablePan, () => (!0)),r.minDistance=t.controls.minDistance||.001,r.maxDistance=t.controls.maxDistance||1/0,r.screenSpacePanning=!1,r.maxPolarAngle=Math.PI,r.update(),r}var _HDRLoaderjs = require('three/addons/loaders/HDRLoader.js');function zt(e,n,t,r){t.environment.enableEnvironmentLighting?new (0, _HDRLoaderjs.HDRLoader)().load(t.environment.hdrPath||"/baseHDR.hdr",function(i){if(r()){i.dispose();return}if(!_optionalChain([i, 'optionalAccess', _211 => _211.image])){_chunkAQJPVUH3cjs.c.call(void 0, ).warn("HDR loaded without image data; skipping environment map."),_optionalChain([i, 'optionalAccess', _212 => _212.dispose, 'call', _213 => _213()]),_optionalChain([t, 'access', _214 => _214.events, 'access', _215 => _215.onReady, 'optionalCall', _216 => _216()]);return}i.mapping=N.EquirectangularReflectionMapping;let o=new N.PMREMGenerator(n);o.compileEquirectangularShader();let a=o.fromEquirectangular(i).texture;o.dispose(),e.environment=a,e.environmentIntensity=_nullishCoalesce(t.environment.environmentIntensity, () => (1));let s=Xe(_nullishCoalesce(t.environment.sceneUp, () => (W)));e.environmentRotation.copy(s),t.environment.showEnvironment?(e.background=i,e.backgroundRotation.copy(s)):i.dispose(),_optionalChain([t, 'access', _217 => _217.events, 'access', _218 => _218.onReady, 'optionalCall', _219 => _219()])},void 0,function(i){r()||(_chunkAQJPVUH3cjs.c.call(void 0, ).warn("HDR texture could not be loaded, falling back to basic lighting:",i),_optionalChain([t, 'access', _220 => _220.events, 'access', _221 => _221.onReady, 'optionalCall', _222 => _222()]))}):_optionalChain([t, 'access', _223 => _223.events, 'access', _224 => _224.onReady, 'optionalCall', _225 => _225()])}function _t(e,n){let t=n.floor.size,r=new N.PlaneGeometry(t,t),i=typeof n.floor.color=="string"?new N.Color(n.floor.color):n.floor.color,o=new N.MeshStandardMaterial({color:i,roughness:n.floor.roughness,metalness:n.floor.metalness,side:N.DoubleSide}),a=new N.Mesh(r,o);a.userData.id="floor",a.name="floor";let s=(_optionalChain([n, 'access', _226 => _226.environment, 'optionalAccess', _227 => _227.sceneUp])||W).clone().normalize();a.quaternion.setFromUnitVectors(new N.Vector3(0,0,1),s),a.position.set(0,0,0),n.floor.receiveShadow&&n.render.enableShadows&&(a.receiveShadow=!0),e.add(a)}function Vt(e,n,t,r){let i=new Set,o=new Map,a=new F.Raycaster,s=new F.Vector2,l=new F.Vector2,m=()=>t.getActiveCamera(),f=d=>{let c=d;for(;c;){if(!c.visible)return!1;c=c.parent}return!0},E=()=>{let d=Q(n);if(d.isEmpty()){_chunkAQJPVUH3cjs.c.call(void 0, ).warn("No objects to fit to view");return}t.frameBounds(d,!1)},g=typeof r.events.selectionColor=="string"?new F.Color(r.events.selectionColor):r.events.selectionColor instanceof F.Color?r.events.selectionColor:new F.Color("#ff0000"),u=()=>{i.forEach(d=>{let c=d;if(o.has(d)){let R=o.get(d),T=c.material;T instanceof F.Material?T.dispose():Array.isArray(T)&&T.forEach(M=>M.dispose()),c.material=R,o.delete(d);let x=d;for(;x.parent;)x=x.parent;x!==n&&(R instanceof F.Material?R.dispose():R.forEach(M=>M.dispose()))}}),i.clear()},p=d=>{let c=d;if(!(c.material instanceof F.Material))return!1;o.set(d,c.material);let R=c.material.clone();return d instanceof F.Mesh&&"emissive"in R?R.emissive=g.clone():"color"in R&&(R.color=g.clone()),c.material=R,!0},h=()=>{let d=Q(n),c=d.isEmpty()?1:d.getSize(new F.Vector3).length();a.params.Points.threshold=c*.01},C=d=>{l.set(d.clientX,d.clientY)},b=d=>{let c=new F.Vector2(d.clientX,d.clientY);if(l.distanceTo(c)>5)return;let R=e.getBoundingClientRect();s.x=(d.clientX-R.left)/R.width*2-1,s.y=-((d.clientY-R.top)/R.height)*2+1,h(),a.setFromCamera(s,m());let T=a.intersectObjects(n.children,!0).filter(x=>f(x.object));if(T.length>0){let x=T[0].object;i.has(x)||(u(),i.add(x),p(x),_optionalChain([r, 'access', _228 => _228.events, 'optionalAccess', _229 => _229.onObjectSelected, 'optionalCall', _230 => _230(x)]),x instanceof F.Mesh&&Object.keys(x.userData).length>0&&_optionalChain([r, 'access', _231 => _231.events, 'optionalAccess', _232 => _232.onMeshMetadataClicked, 'optionalCall', _233 => _233(x.userData)]))}else u(),_optionalChain([r, 'access', _234 => _234.events, 'optionalAccess', _235 => _235.onBackgroundClicked, 'optionalCall', _236 => _236({x:s.x,y:s.y})])},A=d=>{let c=e.getBoundingClientRect();s.x=(d.clientX-c.left)/c.width*2-1,s.y=-((d.clientY-c.top)/c.height)*2+1,h(),a.setFromCamera(s,m());let R=a.intersectObjects(n.children,!0).filter(M=>f(M.object));if(R.length===0)return;let T=R[0].object;if(_optionalChain([r, 'access', _237 => _237.events, 'optionalAccess', _238 => _238.onMeshDoubleClicked, 'optionalCall', _239 => _239(T)]),!_optionalChain([r, 'access', _240 => _240.events, 'optionalAccess', _241 => _241.enableDoubleClickZoom]))return;let x=new F.Box3().setFromObject(T);x.isEmpty()||t.frameBounds(x,!0)},S=d=>{if(_optionalChain([r, 'access', _242 => _242.events, 'optionalAccess', _243 => _243.enableKeyboardControls]))switch(d.key.toLowerCase()){case"f":d.preventDefault(),E();break;case"escape":d.preventDefault(),u();break;case" ":d.preventDefault(),E();break}};return _optionalChain([r, 'access', _244 => _244.events, 'optionalAccess', _245 => _245.enableClickToFocus])&&(e.addEventListener("mousedown",C),e.addEventListener("click",b),e.addEventListener("dblclick",A)),_optionalChain([r, 'access', _246 => _246.events, 'optionalAccess', _247 => _247.enableKeyboardControls])&&(e.setAttribute("tabindex","0"),e.addEventListener("keydown",S)),{dispose:()=>{e.removeEventListener("mousedown",C),e.removeEventListener("click",b),e.removeEventListener("dblclick",A),e.removeEventListener("keydown",S),u()},fitToView:E,clearSelection:u}}function jt(e,n){let t=new te.AmbientLight(n.lighting.ambientLightColor,n.lighting.ambientLightIntensity);e.add(t);let r=null;if(n.lighting.enableHemisphereLight){r=new te.HemisphereLight(n.lighting.hemisphereSkyColor,n.lighting.hemisphereGroundColor,n.lighting.hemisphereIntensity);let a=_nullishCoalesce(n.environment.sceneUp, () => (W));r.position.copy(a),e.add(r)}if(!n.lighting.enableSunlight)return{ambient:t,hemisphere:r,sun:null};let i=new te.DirectionalLight(_nullishCoalesce(n.lighting.sunlightColor, () => (16777215)),n.lighting.sunlightIntensity),o=n.lighting.sunlightPosition;return o&&i.position.set(o.x,o.y,o.z),n.render.enableShadows?(i.castShadow=!0,i.shadow.mapSize.width=n.render.shadowMapSize||2048,i.shadow.mapSize.height=n.render.shadowMapSize||2048,i.shadow.bias=-1e-4,i.shadow.normalBias=.02,i.shadow.radius=4,e.add(i),e.add(i.target),{ambient:t,hemisphere:r,sun:i}):(e.add(i),{ambient:t,hemisphere:r,sun:null})}function Nt(e,n){if(n.isEmpty())return;let t=n.getCenter(new te.Vector3),r=n.getSize(new te.Vector3).length()*.5*1.2,i=e.shadow.camera;i.left=-r,i.right=r,i.top=r,i.bottom=-r,e.target.position.copy(t),e.target.updateMatrixWorld();let o=e.position.distanceTo(t);i.near=Math.max(r*.01,o-r),i.far=o+r,i.updateProjectionMatrix()}function Gt(e,n,t){let r=new pe.WebGLRenderer({antialias:n.render.antialias,canvas:e,alpha:!0,powerPreference:"high-performance",preserveDrawingBuffer:n.render.preserveDrawingBuffer,logarithmicDepthBuffer:!1}),i=e.parentElement,o=i?i.clientWidth:window.innerWidth,a=i?i.clientHeight:window.innerHeight;return i&&(e.style.width="100%",e.style.height="100%",e.style.display="block"),r.setSize(o,a,!1),r.setPixelRatio(t),n.render.enableShadows&&(r.shadowMap.enabled=!0,r.shadowMap.type=pe.VSMShadowMap),r.toneMapping=n.render.toneMapping,r.toneMappingExposure=_nullishCoalesce(n.render.toneMappingExposure, () => (1)),r.outputColorSpace=pe.SRGBColorSpace,r.sortObjects=!0,r}var ln=function(e,n){let t=Ct(n||{}),r=_optionalChain([t, 'access', _248 => _248.environment, 'optionalAccess', _249 => _249.sceneUp])||W,i=_nullishCoalesce(t.render.pixelRatio, () => (Math.min(window.devicePixelRatio,2))),o=At(t),a=Dt(t,e);a.up.copy(r);let s=Gt(e,t,i);_chunkAQJPVUH3cjs.t.call(void 0, s.capabilities.getMaxAnisotropy()),_optionalChain([n, 'optionalAccess', _250 => _250.onMaxAnisotropy, 'optionalCall', _251 => _251(s.capabilities.getMaxAnisotropy())]);let l=_chunkAQJPVUH3cjs.s.call(void 0, ),m=kt(a,e,t),f=Ke({scene:o,perspective:a,controls:m,onActiveCameraChange:()=>{},up:r}),E=()=>f.getActiveCamera(),g=!1;zt(o,s,t,()=>g);let u=jt(o,t),p=u.sun,h=()=>{p&&Nt(p,Q(o))};_optionalChain([t, 'access', _252 => _252.floor, 'optionalAccess', _253 => _253.enabled])&&_t(o,t);let C=_optionalChain([t, 'access', _254 => _254.floor, 'optionalAccess', _255 => _255.enabled])?_nullishCoalesce(o.children.find(H=>H.userData.id==="floor"), () => (null)):null,b=t.grid.enabled?ht({cellSize:t.grid.cellSize,majorEvery:t.grid.majorEvery,cellColor:t.grid.cellColor,majorColor:t.grid.majorColor,fadeDistance:t.grid.fadeDistance,plane:t.grid.plane}):null;b&&o.add(b.object);let A=()=>{b&&b.fitToContent(Q(o))},S=t.gizmo.enabled?xt({camera:a,domElement:e,controller:f}):null,I=_nullishCoalesce(t.grid.plane, () => (xe(r))),d=new Ut.Vector3(I==="x"?1:0,I==="y"?1:0,I==="z"?1:0),c=r.clone().normalize(),R=()=>{let H=[];return _optionalChain([b, 'optionalAccess', _256 => _256.object, 'access', _257 => _257.visible])&&H.push(d),t.floor.enabled&&_optionalChain([C, 'optionalAccess', _258 => _258.visible])&&H.push(c),H},T=t.camera.dynamicNear?yt({camera:a,scene:o,groundNormals:R}):null,x=_nullishCoalesce(e.parentElement, () => (e)),M=t.measure.enabled?Rt(x,o):null,P=t.measure.enabled&&M?vt({canvas:e,scene:o,getActiveCamera:E,labelLayer:M,options:{snapPixels:t.measure.snapPixels,color:t.measure.color,labelClassName:t.measure.labelClassName,displayUnit:t.measure.displayUnit,format:t.measure.format}}):null,L=t.events.enableEventHandlers!==!1?Vt(e,o,f,t):{dispose:()=>{},fitToView:()=>{},clearSelection:()=>{}},Y=5,w=0,k=0,v=H=>{w=H.clientX,k=H.clientY},y=H=>Math.hypot(H.clientX-w,H.clientY-k)>Y,z=H=>{if(!y(H)){if(_optionalChain([P, 'optionalAccess', _259 => _259.handleClick, 'call', _260 => _260(H)])){H.stopImmediatePropagation();return}_optionalChain([S, 'optionalAccess', _261 => _261.handleClick, 'call', _262 => _262(H)])&&H.stopImmediatePropagation()}};(S||P)&&(e.addEventListener("mousedown",v,{capture:!0}),e.addEventListener("click",z,{capture:!0}));let j=H=>_optionalChain([P, 'optionalAccess', _263 => _263.handleMove, 'call', _264 => _264(H)]);P&&e.addEventListener("mousemove",j,{passive:!0});let V=()=>{},G=H=>{Et(H,{color:t.edges.color,darken:t.edges.darken,width:t.edges.width,thresholdAngle:t.edges.thresholdAngle,distanceFade:t.edges.distanceFade,maxTriangles:t.edges.maxTriangles,maxSegments:t.edges.maxSegments}).then(()=>{be(H),V()})},be=H=>{if(t.edges.screenSpaceFallback===!1)return;let ae=!1;H.traverse(Xt=>{_optionalChain([Xt, 'access', _265 => _265.userData, 'optionalAccess', _266 => _266.edgesSkipped])===we&&(ae=!0)}),U.setEdgeFallback(ae)},Z=H=>{ft(H),U.setEdgeFallback(!1),V()},ee=e.parentElement,re=()=>ee?{width:ee.clientWidth,height:ee.clientHeight}:{width:window.innerWidth,height:window.innerHeight},U=It({renderer:s,scene:o,getActiveCamera:E,getCanvasSize:re,pixelRatio:i,config:t,requestRender:()=>V()});U.sync();let q=Mt({scene:o,renderer:s,lights:u,config:t,pipeline:U,requestRender:()=>V()}),{animate:ve,dispose:ie,invalidate:ue}=Ht(s,o,a,E,f,m,re,i,t.events.onFrame,b,S,()=>U.get(),M,T,_nullishCoalesce(t.render.onDemand, () => (!0)));V=ue,ve(),o.up.set(r.x,r.y,r.z),h(),A();let Pe=H=>{H.userData.source="user",o.add(H)},Bt=H=>{H.removeFromParent(),_chunkAQJPVUH3cjs.v.call(void 0, H)},Wt=()=>{o.children.filter(ae=>ae.userData.source==="user").forEach(ae=>{ae.removeFromParent(),_chunkAQJPVUH3cjs.v.call(void 0, ae)})},qt=()=>{g||(g=!0,ie(),L.dispose(),(S||P)&&(e.removeEventListener("mousedown",v,{capture:!0}),e.removeEventListener("click",z,{capture:!0})),P&&e.removeEventListener("mousemove",j),_optionalChain([P, 'optionalAccess', _267 => _267.dispose, 'call', _268 => _268()]),_optionalChain([M, 'optionalAccess', _269 => _269.dispose, 'call', _270 => _270()]),_optionalChain([S, 'optionalAccess', _271 => _271.dispose, 'call', _272 => _272()]),_optionalChain([b, 'optionalAccess', _273 => _273.dispose, 'call', _274 => _274()]),U.dispose(),f.dispose(),m.dispose(),s.dispose(),s.forceContextLoss(),Lt(o),l())};return{scene:o,camera:a,controls:m,renderer:s,cameraController:f,grid:b,gizmo:S,measureTool:P,applyEdges:G,clearEdges:Z,invalidate:ue,setAmbientOcclusion:U.setAmbientOcclusion,setLook:q.setLook,setFillLights:q.setFillLights,setEnvironmentIntensity:q.setEnvironmentIntensity,setToneMappingExposure:q.setToneMappingExposure,setAoIntensity:q.setAoIntensity,getMaterialAppearance:q.getMaterialAppearance,updateShadowBounds:h,updateGridScale:A,dispose:qt,fitToView:L.fitToView,clearSelection:L.clearSelection,addUserGeometry:Pe,removeUserGeometry:Bt,clearUserGeometry:Wt}};exports.DEFAULT_LOOK = _chunkAQJPVUH3cjs.h; exports.ErrorCodes = _chunkAQJPVUH3cjs.a; exports.LOOKS = _chunkAQJPVUH3cjs.g; exports.LOOK_PRESETS = _chunkAQJPVUH3cjs.i; exports.VisualizationError = _chunkAQJPVUH3cjs.b; exports.enableDebugLogging = _chunkAQJPVUH3cjs.e; exports.getLogger = _chunkAQJPVUH3cjs.c; exports.initThree = ln; exports.materialAppearanceForLook = _chunkAQJPVUH3cjs.j; exports.setLogger = _chunkAQJPVUH3cjs.d; exports.updateScene = Jt;
|
|
108
|
+
`},Se=class extends _Passjs.Pass{constructor(t,r,i,o,a={}){super();_chunkBYLIBOAUcjs.a.call(void 0, this,"camera");_chunkBYLIBOAUcjs.a.call(void 0, this,"scene");_chunkBYLIBOAUcjs.a.call(void 0, this,"normalMaterial");_chunkBYLIBOAUcjs.a.call(void 0, this,"edgeMaterial");_chunkBYLIBOAUcjs.a.call(void 0, this,"fsQuad");_chunkBYLIBOAUcjs.a.call(void 0, this,"normalTarget",null);_chunkBYLIBOAUcjs.a.call(void 0, this,"width");_chunkBYLIBOAUcjs.a.call(void 0, this,"height");this.scene=t,this.camera=r,this.width=Math.max(1,i),this.height=Math.max(1,o),this.normalMaterial=new P.MeshNormalMaterial,this.normalMaterial.blending=P.NoBlending,this.edgeMaterial=new P.ShaderMaterial({uniforms:P.UniformsUtils.clone(ze.uniforms),vertexShader:ze.vertexShader,fragmentShader:ze.fragmentShader});let l=this.edgeMaterial.uniforms;l.uColor.value=new P.Color(_nullishCoalesce(a.color, () => (2236962))),l.uOpacity.value=_nullishCoalesce(a.opacity, () => (1)),l.uNormalThreshold.value=_nullishCoalesce(a.normalThreshold, () => (.4)),l.uDepthThreshold.value=_nullishCoalesce(a.depthThreshold, () => (.02)),l.uThickness.value=_nullishCoalesce(a.thickness, () => (1)),this.fsQuad=new (0, _Passjs.FullScreenQuad)(this.edgeMaterial),this.needsSwap=!0}acquireNormalTarget(){if(!this.normalTarget){let t=new P.DepthTexture(this.width,this.height);this.normalTarget=new P.WebGLRenderTarget(this.width,this.height,{minFilter:P.NearestFilter,magFilter:P.NearestFilter,depthTexture:t})}return this.normalTarget}setSize(t,r){this.width=Math.max(1,t),this.height=Math.max(1,r),_optionalChain([this, 'access', _195 => _195.normalTarget, 'optionalAccess', _196 => _196.setSize, 'call', _197 => _197(this.width,this.height)])}render(t,r,i){let o=this.acquireNormalTarget(),a=t.getRenderTarget(),l=t.autoClear,s=t.getClearColor(new P.Color),u=t.getClearAlpha(),f=this.scene.overrideMaterial;t.setRenderTarget(o),t.setClearColor(7829503,1),t.autoClear=!0,this.scene.overrideMaterial=this.normalMaterial,t.render(this.scene,this.camera),this.scene.overrideMaterial=f,t.setClearColor(s,u),t.autoClear=l;let E=this.edgeMaterial.uniforms;E.tDiffuse.value=i.texture,E.tNormal.value=o.texture,E.tDepth.value=o.depthTexture,E.uResolution.value.set(this.width,this.height);let g=this.camera;E.uPerspective.value=g.isPerspectiveCamera?1:0,E.uNear.value=_nullishCoalesce(this.camera.near, () => (.1)),E.uFar.value=_nullishCoalesce(this.camera.far, () => (1e3)),t.setRenderTarget(this.renderToScreen?null:r),this.fsQuad.render(t),t.setRenderTarget(a)}dispose(){_optionalChain([this, 'access', _198 => _198.normalTarget, 'optionalAccess', _199 => _199.dispose, 'call', _200 => _200()]),this.normalMaterial.dispose(),this.edgeMaterial.dispose(),this.fsQuad.dispose()}};function Ht(e,n,t,r,i,o){let a=new (0, _EffectComposerjs.EffectComposer)(e),l=new (0, _RenderPassjs.RenderPass)(n,t);a.addPass(l);let s=null;(_nullishCoalesce(o.ambientOcclusion, () => (!0)))&&(s=new (0, _GTAOPassjs.GTAOPass)(n,t,r,i),s.blendIntensity=_nullishCoalesce(o.aoIntensity, () => (1)),s.updateGtaoMaterial({screenSpaceRadius:!0}),a.addPass(s));let u=typeof o.edgeDetection=="object"?o.edgeDetection:{},f=new Se(n,t,r,i,u);f.enabled=!!o.edgeDetection,a.addPass(f);let E=new _SMAAPassjs.SMAAPass;a.addPass(E);let g=new _OutputPassjs.OutputPass;a.addPass(g),e.toneMapping=o.toneMapping,e.toneMappingExposure=o.toneMappingExposure;let m=_nullishCoalesce(o.aoPixelRatio, () => (1));return a.setSize(r,i),{render:p=>a.render(p),setSize:(p,h,H)=>{a.setPixelRatio(Math.min(H,m)),a.setSize(p,h)},setCamera:p=>{if(l.camera=p,f.camera=p,!s)return;s.camera=p;let h=p.isPerspectiveCamera?1:0;s.gtaoMaterial.defines.PERSPECTIVE_CAMERA!==h&&(s.gtaoMaterial.defines.PERSPECTIVE_CAMERA=h,s.gtaoMaterial.needsUpdate=!0)},setEdgeDetection:p=>{f.enabled=p},edgeDetectionEnabled:()=>f.enabled,dispose:()=>{a.dispose(),_optionalChain([s, 'optionalAccess', _201 => _201.dispose, 'call', _202 => _202()]),f.dispose(),E.dispose(),g.dispose()}}}function wt(e){let{renderer:n,scene:t,getActiveCamera:r,getCanvasSize:i,pixelRatio:o,config:a,requestRender:l}=e,s=null,u=!!a.render.ambientOcclusion,f=!1,E=!1,g=p=>{let{width:h,height:H}=i(),x=Ht(n,t,r(),Math.max(1,h),Math.max(1,H),{toneMapping:_nullishCoalesce(a.render.toneMapping, () => (Ct.NeutralToneMapping)),toneMappingExposure:_nullishCoalesce(a.render.toneMappingExposure, () => (1)),ambientOcclusion:p,aoIntensity:a.render.aoIntensity,aoPixelRatio:a.render.aoPixelRatio,edgeDetection:!1});return x.setSize(Math.max(1,h),Math.max(1,H),o),x},m=()=>{if(!(u||f)){_optionalChain([s, 'optionalAccess', _203 => _203.dispose, 'call', _204 => _204()]),s=null,l();return}(!s||E!==u)&&(_optionalChain([s, 'optionalAccess', _205 => _205.dispose, 'call', _206 => _206()]),s=g(u),E=u),s.setEdgeDetection(f),l()};return{get:()=>s,sync:m,rebuild:()=>{_optionalChain([s, 'optionalAccess', _207 => _207.dispose, 'call', _208 => _208()]),s=null,m()},setAmbientOcclusion:p=>{u=p,m()},setEdgeFallback:p=>{p!==f&&(f=p,m())},isEdgeFallbackActive:()=>f,dispose:()=>{_optionalChain([s, 'optionalAccess', _209 => _209.dispose, 'call', _210 => _210()]),s=null}}}var _OrbitControlsjs = require('three/addons/controls/OrbitControls.js');function Mt(e,n,t){let r=new (0, _OrbitControlsjs.OrbitControls)(e,n),i=t.camera.target;return i&&r.target.set(i.x,i.y,i.z),r.enableDamping=t.controls.enableDamping||!1,r.dampingFactor=t.controls.dampingFactor||.05,r.autoRotate=t.controls.autoRotate||!1,r.autoRotateSpeed=t.controls.autoRotateSpeed||.5,r.enableZoom=_nullishCoalesce(t.controls.enableZoom, () => (!0)),r.enablePan=_nullishCoalesce(t.controls.enablePan, () => (!0)),r.minDistance=t.controls.minDistance||.001,r.maxDistance=t.controls.maxDistance||1/0,r.screenSpacePanning=!1,r.maxPolarAngle=Math.PI,r.update(),r}var _HDRLoaderjs = require('three/addons/loaders/HDRLoader.js');function St(e,n,t,r){t.environment.enableEnvironmentLighting?new (0, _HDRLoaderjs.HDRLoader)().load(t.environment.hdrPath||"/baseHDR.hdr",function(i){if(r()){i.dispose();return}if(!_optionalChain([i, 'optionalAccess', _211 => _211.image])){_chunkAZ4GBXXLcjs.c.call(void 0, ).warn("HDR loaded without image data; skipping environment map."),_optionalChain([i, 'optionalAccess', _212 => _212.dispose, 'call', _213 => _213()]),_optionalChain([t, 'access', _214 => _214.events, 'access', _215 => _215.onReady, 'optionalCall', _216 => _216()]);return}i.mapping=j.EquirectangularReflectionMapping;let o=new j.PMREMGenerator(n);o.compileEquirectangularShader();let a=o.fromEquirectangular(i).texture;o.dispose(),e.environment=a,e.environmentIntensity=_nullishCoalesce(t.environment.environmentIntensity, () => (1));let l=Ne(_nullishCoalesce(t.environment.sceneUp, () => (W)));e.environmentRotation.copy(l),t.environment.showEnvironment?(e.background=i,e.backgroundRotation.copy(l)):i.dispose(),_optionalChain([t, 'access', _217 => _217.events, 'access', _218 => _218.onReady, 'optionalCall', _219 => _219()])},void 0,function(i){r()||(_chunkAZ4GBXXLcjs.c.call(void 0, ).warn("HDR texture could not be loaded, falling back to basic lighting:",i),_optionalChain([t, 'access', _220 => _220.events, 'access', _221 => _221.onReady, 'optionalCall', _222 => _222()]))}):_optionalChain([t, 'access', _223 => _223.events, 'access', _224 => _224.onReady, 'optionalCall', _225 => _225()])}function Dt(e,n){let t=n.floor.size,r=new j.PlaneGeometry(t,t),i=typeof n.floor.color=="string"?new j.Color(n.floor.color):n.floor.color,o=new j.MeshStandardMaterial({color:i,roughness:n.floor.roughness,metalness:n.floor.metalness,side:j.DoubleSide}),a=new j.Mesh(r,o);a.userData.id="floor",a.name="floor";let l=(_optionalChain([n, 'access', _226 => _226.environment, 'optionalAccess', _227 => _227.sceneUp])||W).clone().normalize();a.quaternion.setFromUnitVectors(new j.Vector3(0,0,1),l),a.position.set(0,0,0),n.floor.receiveShadow&&n.render.enableShadows&&(a.receiveShadow=!0),e.add(a)}function At(e,n,t,r){let i=new Set,o=new Map,a=new L.Raycaster,l=new L.Vector2,s=new L.Vector2,u=()=>t.getActiveCamera(),f=d=>{let c=d;for(;c;){if(!c.visible)return!1;c=c.parent}return!0},E=()=>{let d=Q(n);if(d.isEmpty()){_chunkAZ4GBXXLcjs.c.call(void 0, ).warn("No objects to fit to view");return}t.frameBounds(d,!1)},g=typeof r.events.selectionColor=="string"?new L.Color(r.events.selectionColor):r.events.selectionColor instanceof L.Color?r.events.selectionColor:new L.Color("#ff0000"),m=()=>{i.forEach(d=>{let c=d;if(o.has(d)){let R=o.get(d),T=c.material;T instanceof L.Material?T.dispose():Array.isArray(T)&&T.forEach(C=>C.dispose()),c.material=R,o.delete(d);let v=d;for(;v.parent;)v=v.parent;v!==n&&(R instanceof L.Material?R.dispose():R.forEach(C=>C.dispose()))}}),i.clear()},p=d=>{let c=d;if(!(c.material instanceof L.Material))return!1;o.set(d,c.material);let R=c.material.clone();return d instanceof L.Mesh&&"emissive"in R?R.emissive=g.clone():"color"in R&&(R.color=g.clone()),c.material=R,!0},h=()=>{let d=Q(n),c=d.isEmpty()?1:d.getSize(new L.Vector3).length();a.params.Points.threshold=c*.01},H=d=>{s.set(d.clientX,d.clientY)},x=d=>{let c=new L.Vector2(d.clientX,d.clientY);if(s.distanceTo(c)>5)return;let R=e.getBoundingClientRect();l.x=(d.clientX-R.left)/R.width*2-1,l.y=-((d.clientY-R.top)/R.height)*2+1,h(),a.setFromCamera(l,u());let T=a.intersectObjects(n.children,!0).filter(v=>f(v.object));if(T.length>0){let v=T[0].object;i.has(v)||(m(),i.add(v),p(v),_optionalChain([r, 'access', _228 => _228.events, 'optionalAccess', _229 => _229.onObjectSelected, 'optionalCall', _230 => _230(v)]),v instanceof L.Mesh&&Object.keys(v.userData).length>0&&_optionalChain([r, 'access', _231 => _231.events, 'optionalAccess', _232 => _232.onMeshMetadataClicked, 'optionalCall', _233 => _233(v.userData)]))}else m(),_optionalChain([r, 'access', _234 => _234.events, 'optionalAccess', _235 => _235.onBackgroundClicked, 'optionalCall', _236 => _236({x:l.x,y:l.y})])},S=d=>{let c=e.getBoundingClientRect();l.x=(d.clientX-c.left)/c.width*2-1,l.y=-((d.clientY-c.top)/c.height)*2+1,h(),a.setFromCamera(l,u());let R=a.intersectObjects(n.children,!0).filter(C=>f(C.object));if(R.length===0)return;let T=R[0].object;if(_optionalChain([r, 'access', _237 => _237.events, 'optionalAccess', _238 => _238.onMeshDoubleClicked, 'optionalCall', _239 => _239(T)]),!_optionalChain([r, 'access', _240 => _240.events, 'optionalAccess', _241 => _241.enableDoubleClickZoom]))return;let v=new L.Box3().setFromObject(T);v.isEmpty()||t.frameBounds(v,!0)},A=d=>{if(_optionalChain([r, 'access', _242 => _242.events, 'optionalAccess', _243 => _243.enableKeyboardControls]))switch(d.key.toLowerCase()){case"f":d.preventDefault(),E();break;case"escape":d.preventDefault(),m();break;case" ":d.preventDefault(),E();break}};return _optionalChain([r, 'access', _244 => _244.events, 'optionalAccess', _245 => _245.enableClickToFocus])&&(e.addEventListener("mousedown",H),e.addEventListener("click",x),e.addEventListener("dblclick",S)),_optionalChain([r, 'access', _246 => _246.events, 'optionalAccess', _247 => _247.enableKeyboardControls])&&(e.setAttribute("tabindex","0"),e.addEventListener("keydown",A)),{dispose:()=>{e.removeEventListener("mousedown",H),e.removeEventListener("click",x),e.removeEventListener("dblclick",S),e.removeEventListener("keydown",A),m()},fitToView:E,clearSelection:m}}function Pt(e,n){let t=new J.AmbientLight(n.lighting.ambientLightColor,n.lighting.ambientLightIntensity);e.add(t);let r=null;if(n.lighting.enableHemisphereLight){r=new J.HemisphereLight(n.lighting.hemisphereSkyColor,n.lighting.hemisphereGroundColor,n.lighting.hemisphereIntensity);let a=_nullishCoalesce(n.environment.sceneUp, () => (W));r.position.copy(a),e.add(r)}if(!n.lighting.enableSunlight)return{ambient:t,hemisphere:r,sun:null};let i=new J.DirectionalLight(_nullishCoalesce(n.lighting.sunlightColor, () => (16777215)),n.lighting.sunlightIntensity),o=n.lighting.sunlightPosition;return o&&i.position.set(o.x,o.y,o.z),n.render.enableShadows?(i.castShadow=!0,i.shadow.mapSize.width=n.render.shadowMapSize||2048,i.shadow.mapSize.height=n.render.shadowMapSize||2048,i.shadow.bias=-1e-4,i.shadow.normalBias=.02,i.shadow.radius=4,e.add(i),e.add(i.target),{ambient:t,hemisphere:r,sun:i}):(e.add(i),{ambient:t,hemisphere:r,sun:null})}function Lt(e,n){if(n.isEmpty())return;let t=n.getCenter(new J.Vector3),r=n.getSize(new J.Vector3).length()*.5*1.2,i=e.shadow.camera;i.left=-r,i.right=r,i.top=r,i.bottom=-r,e.target.position.copy(t),e.target.updateMatrixWorld();let o=e.position.distanceTo(t);i.near=Math.max(r*.01,o-r),i.far=o+r,i.updateProjectionMatrix()}function Ot(e,n,t){let r=new ue.WebGLRenderer({antialias:n.render.antialias,canvas:e,alpha:!0,powerPreference:"high-performance",preserveDrawingBuffer:n.render.preserveDrawingBuffer,logarithmicDepthBuffer:!1}),i=e.parentElement,o=i?i.clientWidth:window.innerWidth,a=i?i.clientHeight:window.innerHeight;return i&&(e.style.width="100%",e.style.height="100%",e.style.display="block"),r.setSize(o,a,!1),r.setPixelRatio(t),n.render.enableShadows&&(r.shadowMap.enabled=!0,r.shadowMap.type=ue.VSMShadowMap),r.toneMapping=n.render.toneMapping,r.toneMappingExposure=_nullishCoalesce(n.render.toneMappingExposure, () => (1)),r.outputColorSpace=ue.SRGBColorSpace,r.sortObjects=!0,r}var Qr=function(e,n){let t=ht(n||{}),r=_optionalChain([t, 'access', _248 => _248.environment, 'optionalAccess', _249 => _249.sceneUp])||W,i=_nullishCoalesce(t.render.pixelRatio, () => (Math.min(window.devicePixelRatio,2))),o=vt(t),a=bt(t,e);a.up.copy(r);let l=Ot(e,t,i);_chunkAZ4GBXXLcjs.n.call(void 0, l.capabilities.getMaxAnisotropy()),_optionalChain([n, 'optionalAccess', _250 => _250.onMaxAnisotropy, 'optionalCall', _251 => _251(l.capabilities.getMaxAnisotropy())]);let s=Mt(a,e,t),u=Ge({scene:o,perspective:a,controls:s,onActiveCameraChange:()=>{},up:r}),f=()=>u.getActiveCamera(),E=!1;St(o,l,t,()=>E);let g=Pt(o,t),m=g.sun,p=()=>{m&&Lt(m,Q(o))};_optionalChain([t, 'access', _252 => _252.floor, 'optionalAccess', _253 => _253.enabled])&&Dt(o,t);let h=_optionalChain([t, 'access', _254 => _254.floor, 'optionalAccess', _255 => _255.enabled])?_nullishCoalesce(o.children.find(w=>w.userData.id==="floor"), () => (null)):null,H=t.grid.enabled?st({cellSize:t.grid.cellSize,majorEvery:t.grid.majorEvery,cellColor:t.grid.cellColor,majorColor:t.grid.majorColor,fadeDistance:t.grid.fadeDistance,plane:t.grid.plane}):null;H&&o.add(H.object);let x=()=>{H&&H.fitToContent(Q(o))},S=t.gizmo.enabled?Et({camera:a,domElement:e,controller:u}):null,A=_nullishCoalesce(t.grid.plane, () => (ve(r))),V=new Ft.Vector3(A==="x"?1:0,A==="y"?1:0,A==="z"?1:0),d=r.clone().normalize(),c=()=>{let w=[];return _optionalChain([H, 'optionalAccess', _256 => _256.object, 'access', _257 => _257.visible])&&w.push(V),t.floor.enabled&&_optionalChain([h, 'optionalAccess', _258 => _258.visible])&&w.push(d),w},R=t.camera.dynamicNear?pt({camera:a,scene:o,groundNormals:c}):null,T=_nullishCoalesce(e.parentElement, () => (e)),v=t.measure.enabled?ct(T,o):null,C=t.measure.enabled&&v?mt({canvas:e,scene:o,getActiveCamera:f,labelLayer:v,options:{snapPixels:t.measure.snapPixels,color:t.measure.color,labelClassName:t.measure.labelClassName,displayUnit:t.measure.displayUnit,format:t.measure.format}}):null,_=t.events.enableEventHandlers!==!1?At(e,o,u,t):{dispose:()=>{},fitToView:()=>{},clearSelection:()=>{}},F=5,q=0,M=0,O=w=>{q=w.clientX,M=w.clientY},y=w=>Math.hypot(w.clientX-q,w.clientY-M)>F,b=w=>{if(!y(w)){if(_optionalChain([C, 'optionalAccess', _259 => _259.handleClick, 'call', _260 => _260(w)])){w.stopImmediatePropagation();return}_optionalChain([S, 'optionalAccess', _261 => _261.handleClick, 'call', _262 => _262(w)])&&w.stopImmediatePropagation()}};(S||C)&&(e.addEventListener("mousedown",O,{capture:!0}),e.addEventListener("click",b,{capture:!0}));let I=w=>_optionalChain([C, 'optionalAccess', _263 => _263.handleMove, 'call', _264 => _264(w)]);C&&e.addEventListener("mousemove",I,{passive:!0});let k=()=>{},N=w=>{it(w,{color:t.edges.color,darken:t.edges.darken,width:t.edges.width,thresholdAngle:t.edges.thresholdAngle,distanceFade:t.edges.distanceFade,maxTriangles:t.edges.maxTriangles,maxSegments:t.edges.maxSegments}).then(()=>{G(w),k()})},G=w=>{if(t.edges.screenSpaceFallback===!1)return;let ie=!1;w.traverse(zt=>{_optionalChain([zt, 'access', _265 => _265.userData, 'optionalAccess', _266 => _266.edgesSkipped])===He&&(ie=!0)}),U.setEdgeFallback(ie)},Re=w=>{at(w),U.setEdgeFallback(!1),k()},X=e.parentElement,ee=()=>X?{width:X.clientWidth,height:X.clientHeight}:{width:window.innerWidth,height:window.innerHeight},U=wt({renderer:l,scene:o,getActiveCamera:f,getCanvasSize:ee,pixelRatio:i,config:t,requestRender:()=>k()});U.sync();let K=Rt({scene:o,renderer:l,lights:g,config:t,pipeline:U,requestRender:()=>k()}),{animate:oe,dispose:Te,invalidate:te}=ft(l,o,a,f,u,s,ee,i,t.events.onFrame,H,S,()=>U.get(),v,R,_nullishCoalesce(t.render.onDemand, () => (!0)));k=te,oe(),o.up.set(r.x,r.y,r.z),p(),x();let me=w=>{w.userData.source="user",o.add(w)},De=w=>{w.removeFromParent(),_chunkAZ4GBXXLcjs.p.call(void 0, w)},It=()=>{o.children.filter(ie=>ie.userData.source==="user").forEach(ie=>{ie.removeFromParent(),_chunkAZ4GBXXLcjs.p.call(void 0, ie)})},kt=()=>{E||(E=!0,Te(),_.dispose(),(S||C)&&(e.removeEventListener("mousedown",O,{capture:!0}),e.removeEventListener("click",b,{capture:!0})),C&&e.removeEventListener("mousemove",I),_optionalChain([C, 'optionalAccess', _267 => _267.dispose, 'call', _268 => _268()]),_optionalChain([v, 'optionalAccess', _269 => _269.dispose, 'call', _270 => _270()]),_optionalChain([S, 'optionalAccess', _271 => _271.dispose, 'call', _272 => _272()]),_optionalChain([H, 'optionalAccess', _273 => _273.dispose, 'call', _274 => _274()]),U.dispose(),u.dispose(),s.dispose(),l.dispose(),l.forceContextLoss(),xt(o))};return{scene:o,camera:a,controls:s,renderer:l,cameraController:u,grid:H,gizmo:S,measureTool:C,applyEdges:N,clearEdges:Re,invalidate:te,setAmbientOcclusion:U.setAmbientOcclusion,setLook:K.setLook,setFillLights:K.setFillLights,setEnvironmentIntensity:K.setEnvironmentIntensity,setToneMappingExposure:K.setToneMappingExposure,setAoIntensity:K.setAoIntensity,getMaterialAppearance:K.getMaterialAppearance,updateShadowBounds:p,updateGridScale:x,dispose:kt,fitToView:_.fitToView,clearSelection:_.clearSelection,addUserGeometry:me,removeUserGeometry:De,clearUserGeometry:It}};exports.DEFAULT_LOOK = _chunkAZ4GBXXLcjs.h; exports.ErrorCodes = _chunkAZ4GBXXLcjs.a; exports.LOOKS = _chunkAZ4GBXXLcjs.g; exports.LOOK_PRESETS = _chunkAZ4GBXXLcjs.i; exports.VisualizationError = _chunkAZ4GBXXLcjs.b; exports.enableDebugLogging = _chunkAZ4GBXXLcjs.e; exports.getLogger = _chunkAZ4GBXXLcjs.c; exports.initThree = Qr; exports.materialAppearanceForLook = _chunkAZ4GBXXLcjs.j; exports.setLogger = _chunkAZ4GBXXLcjs.d; exports.updateScene = Ut;
|
|
110
109
|
//# sourceMappingURL=render.cjs.map
|