gl-draw 0.15.13 → 0.15.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +1 -0
- package/dist/index.js +3 -3
- package/dist/index.module.js +176 -176
- package/dist/index.module2.js +131 -129
- package/dist/index2.js +4 -4
- package/dist/objects/index.module.js +28 -28
- package/package.json +1 -1
package/dist/index2.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var fe=Object.defineProperty,de=Object.defineProperties;var pe=Object.getOwnPropertyDescriptors;var
|
|
1
|
+
"use strict";var fe=Object.defineProperty,de=Object.defineProperties;var pe=Object.getOwnPropertyDescriptors;var X=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var J=Math.pow,Y=(o,e,t)=>e in o?fe(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,O=(o,e)=>{for(var t in e||(e={}))me.call(e,t)&&Y(o,t,e[t]);if(X)for(var t of X(e))ve.call(e,t)&&Y(o,t,e[t]);return o},q=(o,e)=>de(o,pe(e));var ee=(o,e,t)=>new Promise((i,s)=>{var a=l=>{try{n(t.next(l))}catch(u){s(u)}},c=l=>{try{n(t.throw(l))}catch(u){s(u)}},n=l=>l.done?i(l.value):Promise.resolve(l.value).then(a,c);n((t=t.apply(o,e)).next())});const r=require("three"),ge=require("three/examples/jsm/renderers/CSS2DRenderer"),te=require("three/examples/jsm/renderers/CSS3DRenderer"),W=require("d3-geo");require("d3-geo-projection");const $=require("./parseVector.js"),be=require("three/examples/jsm/lines/LineSegmentsGeometry"),T=require("d3-array"),K=require("earcut"),ye=require("@turf/boolean-clockwise"),Me=require("delaunator"),xe=require("@turf/boolean-point-in-polygon"),we=require("d3-geo-voronoi"),ie=require("d3-scale"),je=(o,e=1)=>{const t=new r.BufferGeometry;t.setAttribute("position",new r.Float32BufferAttribute(new Array(e*3).fill(0),3)),t.setAttribute("scaleAtt",new r.Float32BufferAttribute(new Array(e).fill(1),1));const i=o.material,s=new r.PointsMaterial({size:10,map:i.map,alphaMap:i.alphaMap,color:i.color,blending:i.blending,depthTest:i.depthTest,depthWrite:!1,opacity:i.opacity,transparent:!0,alphaTest:i.alphaTest,sizeAttenuation:!1});return s.onBeforeCompile=a=>{a.vertexShader=`
|
|
2
2
|
attribute float scaleAtt;
|
|
3
3
|
${a.vertexShader.replace("gl_PointSize = size;","gl_PointSize = size * scaleAtt;")}
|
|
4
|
-
`},new r.Points(t,s)};class Q{constructor(){this.objectType="BaseObject",this.userData={},this.prefab=!1,this.isInstantiate=!1,this.isBloom=!1,this.materialList={},this.useMaterialType="origin",this.onPointerIndex=[],this.disposeTrack=!0,this.disposeMaterialIfNotUsed=!0}get parent(){const e=this.object3d.parent;return e&&this.lead.objMap.get(e)||null}get children(){return this.object3d.children.map(e=>this.lead.objMap.get(e)).filter(e=>!!e)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}add(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.object3d.add(t):this.lead.createBaseObject(t,{target:this})})}remove(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.lead.objMap.get(t).erase():this.object3d.remove(t)})}get visible(){return this.object3d.visible}get visibleWithAncestors(){if(this.visible){let e=this.parent;for(;e;){if(!e.visible)return!1;e=e.parent}return!0}else return!1}create(){this.createGroup()}render(){}update(e,t){}resize(e,t){}show(){return this.object3d.visible=!0,this}hide(){return this.object3d.visible=!1,this}createMesh(...e){return this.object3d=new r.Mesh(...e),this}createGroup(){return this.object3d=new r.Group,this}createPoints(...e){return this.object3d=new r.Points(...e),this}createCSS2DObject(e){return this.object3d=new ge.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new te.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new te.CSS3DSprite(e),this}createSprite(e){return this.object3d=new r.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d)}),this}getSize(){const e=new r.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new r.Vector3),center:e.getCenter(new r.Vector3)}}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}clone(){return this.instantiate()}instantiate(e,t){return ee(this,null,function*(){var m;const i=e&&e.length>0,s=(m=t==null?void 0:t.recursive)!=null?m:!0,{objectType:a,objectOptions:c}=this,[,n]=a.split("#");let l=t==null?void 0:t.create;l===void 0&&(l=h=>{if(this.object3d){if(i){const v=e.length;if(this.object3d instanceof r.Sprite)h.object3d=je(this.object3d,v);else{const d=this.object3d,p=this.cloneMaterial();h.object3d=new r.InstancedMesh(d.geometry,p,v)}const f=new r.Object3D;e.forEach((d,p)=>{const b=$.parseVector3(d.position),j=$.parseVector3(d.scale||[1,1,1]);f.position.copy(b),f.scale.copy(j),f.updateMatrix(),h.setInstancedMatrix(p,f.matrix.clone())})}else h.object3d=this.object3d.clone(!1),h.object3d.material&&(h.object3d.material=this.cloneMaterial());h.object3d.userData.prefab&&delete h.object3d.userData.prefab}});const u=yield this.lead.draw(n,q(W({},c||{}),{create:l,prefab:!1,key:(t==null?void 0:t.key)||(c==null?void 0:c.key),target:(t==null?void 0:t.target)||(c==null?void 0:c.target)}));return this.isBloom&&u.enableBloom(),s&&(yield Promise.all(this.children.map(h=>h.instantiate(void 0,{target:u})))),u.isInstantiate=!0,u})}setInstancedMatrix(e,t){if(this.object3d instanceof r.InstancedMesh||this.object3d.isInstantiate)this.object3d.setMatrixAt(e,t);else if(this.object3d instanceof r.Points||this.object3d.type==="Points"){const s=this.object3d.geometry,a=s.attributes.position.array,c=s.attributes.scaleAtt.array,n=new r.Vector3,l=new r.Vector3,u=new r.Quaternion,m=e*3,h=e*1;t.decompose(n,u,l),a[m]=n.x,a[m+1]=n.y,a[m+2]=n.z,c[h]=Math.max(l.x,l.y,l.z),s.attributes.position.needsUpdate=!0,s.attributes.scaleAtt.needsUpdate=!0}}erase(){this.lead.erase(this)}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(i=>{const s=i.userData;i.userData={};const a=i.clone();return i.userData=s,a});{const i=t.userData;t.userData={};const s=t.clone();return t.userData=i,s}}setMaterialList(e,t,i=!0){const s=this.object3d;if(!s||!s.material)return;if(this.materialList.origin||(this.materialList.origin=s.material),this.materialList[e]&&!i)return this.materialList[e];const a=t==="clone"?this.cloneMaterial():Array.isArray(t)?t.slice():t;return this.materialList[e]=a,a}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}useMListById(e,t){if(!this.mList)return;const i=this.mList.get(e);if(!i)return;const s=this.object3d;Array.isArray(s.material)&&t!==void 0?s.material[t]=i:s.material=i}useMListByName(e,t){if(!this.mList)return;const i=this.mList.getKeyByName(e);i&&this.useMListById(i,t)}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}onPointerEvent(e,t){const i=this.lead.handlePick([this],e,t);this.onPointerIndex.push(i)}enableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!0),this.isBloom=!0}disableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!1),this.isBloom=!1}dispose(){var e;if(this.onPointerIndex.forEach(t=>{this.lead.removePick(t)}),this.pencil.options.mList&&this.mList.rmBaseObjectMap(this,void 0,this.disposeMaterialIfNotUsed),(e=this.pencil.composerController)==null||e.bloomSelection.delete(this),this.lead&&(this.lead.objects.delete(this.key),this.object3d&&this.lead.objMap.delete(this.object3d)),this.disposeTrack){const t=new ue;t.disposeMaterial=!this.pencil.options.mList,t.track(this),t.dispose()}}}class ue{constructor(){this.resources=new Set,this.disposeMaterial=!0,this.disposeVideo=!0}track(e){if(!e)return e;if(Array.isArray(e))return e.forEach(t=>this.track(t)),e;if(!this.disposeMaterial&&e instanceof r.Material)return e;if(e instanceof Q?(e.disposeTrack&&e.object3d?this.track(e.object3d):this.resources.add(e),Object.values(e.materialList).map(t=>this.track(t))):(e instanceof r.Object3D||Reflect.has(e,"dispose"))&&this.resources.add(e),e instanceof Q)e.children.forEach(t=>{t.disposeTrack=!1}),this.track(e.children);else if(e instanceof r.Object3D){const t=e;this.track(t.geometry),this.track(t.material),this.track(t.children)}else if(e instanceof r.Material){for(const i of Object.values(e))i instanceof r.Texture&&this.track(i);const t=e;if(t.uniforms){for(const i of Object.values(t.uniforms))if(i){const s=i.value;(s instanceof r.Texture||Array.isArray(s))&&this.track(s)}}}else this.disposeVideo&&e instanceof r.VideoTexture&&e.source.data&&this.resources.add(e.source.data);return e}dispose(){const e=[];for(const t of this.resources)t instanceof r.Object3D?e.push(t):t instanceof HTMLVideoElement&&t.pause(),Reflect.has(t,"dispose")&&t.dispose();e.forEach(t=>{t.removeFromParent()}),e.length=0,this.resources.clear()}}const F=new r.Vector4,se=new r.Vector3,re=new r.Vector3,y=new r.Vector4,M=new r.Vector4,D=new r.Vector4,N=new r.Vector3,Z=new r.Matrix4,x=new r.Line3,ne=new r.Vector3,E=new r.Box3,R=new r.Sphere,I=new r.Vector4;let z,T;function ae(o,e,t){return I.set(0,0,-e,1).applyMatrix4(o.projectionMatrix),I.multiplyScalar(1/I.w),I.x=T/t.width,I.y=T/t.height,I.applyMatrix4(o.projectionMatrixInverse),I.multiplyScalar(1/I.w),Math.abs(Math.max(I.x,I.y))}function Pe(o,e){const t=o.matrixWorld,i=o.geometry,s=i.attributes.instanceStart,a=i.attributes.instanceEnd,c=Math.min(i.instanceCount,s.count);for(let n=0,l=c;n<l;n++){x.start.fromBufferAttribute(s,n),x.end.fromBufferAttribute(a,n),x.applyMatrix4(t);const u=new r.Vector3,m=new r.Vector3;z.distanceSqToSegment(x.start,x.end,m,u),m.distanceTo(u)<T*.5&&e.push({point:m,pointOnLine:u,distance:z.origin.distanceTo(m),object:o,face:null,faceIndex:n,uv:null,uv1:null})}}function Ae(o,e,t){const i=e.projectionMatrix,a=o.material.resolution,c=o.matrixWorld,n=o.geometry,l=n.attributes.instanceStart,u=n.attributes.instanceEnd,m=Math.min(n.instanceCount,l.count),h=-e.near;z.at(1,D),D.w=1,D.applyMatrix4(e.matrixWorldInverse),D.applyMatrix4(i),D.multiplyScalar(1/D.w),D.x*=a.x/2,D.y*=a.y/2,D.z=0,N.copy(D),Z.multiplyMatrices(e.matrixWorldInverse,c);for(let v=0,f=m;v<f;v++){if(y.fromBufferAttribute(l,v),M.fromBufferAttribute(u,v),y.w=1,M.w=1,y.applyMatrix4(Z),M.applyMatrix4(Z),y.z>h&&M.z>h)continue;if(y.z>h){const V=y.z-M.z,P=(y.z-h)/V;y.lerp(M,P)}else if(M.z>h){const V=M.z-y.z,P=(M.z-h)/V;M.lerp(y,P)}y.applyMatrix4(i),M.applyMatrix4(i),y.multiplyScalar(1/y.w),M.multiplyScalar(1/M.w),y.x*=a.x/2,y.y*=a.y/2,M.x*=a.x/2,M.y*=a.y/2,x.start.copy(y),x.start.z=0,x.end.copy(M),x.end.z=0;const p=x.closestPointToPointParameter(N,!0);x.at(p,ne);const b=r.MathUtils.lerp(y.z,M.z,p),j=b>=-1&&b<=1,B=N.distanceTo(ne)<T*.5;if(j&&B){x.start.fromBufferAttribute(l,v),x.end.fromBufferAttribute(u,v),x.start.applyMatrix4(c),x.end.applyMatrix4(c);const V=new r.Vector3,P=new r.Vector3;z.distanceSqToSegment(x.start,x.end,P,V),t.push({point:P,pointOnLine:V,distance:z.origin.distanceTo(P),object:o,face:null,faceIndex:v,uv:null,uv1:null})}}}class Se extends r.Mesh{constructor(e=new be.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let c=0,n=0,l=t.count;c<l;c++,n+=2)se.fromBufferAttribute(t,c),re.fromBufferAttribute(i,c),s[n]=n===0?0:s[n-1],s[n+1]=s[n]+se.distanceTo(re);const a=new r.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new r.InterleavedBufferAttribute(a,1,0)),e.setAttribute("instanceDistanceEnd",new r.InterleavedBufferAttribute(a,1,1)),this}raycast(e,t){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const a=e.params.Line2!==void 0&&e.params.Line2.threshold||0;z=e.ray;const c=this.matrixWorld,n=this.geometry,l=this.material;T=l.linewidth+a,n.boundingSphere===null&&n.computeBoundingSphere(),R.copy(n.boundingSphere).applyMatrix4(c);let u;if(i)u=T*.5;else{const h=Math.max(s.near,R.distanceToPoint(z.origin));u=ae(s,h,l.resolution)}if(R.radius+=u,z.intersectsSphere(R)===!1)return;n.boundingBox===null&&n.computeBoundingBox(),E.copy(n.boundingBox).applyMatrix4(c);let m;if(i)m=T*.5;else{const h=Math.max(s.near,E.distanceToPoint(z.origin));m=ae(s,h,l.resolution)}E.expandByScalar(m),z.intersectsBox(E)!==!1&&(i?Pe(this,t):Ae(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(F),this.material.uniforms.resolution.value.set(F.z,F.w))}}const oe=["encodings_fragment","colorspace_fragment"],Ce=`
|
|
4
|
+
`},new r.Points(t,s)},Pe=0,Se=1,Ae=2,Ce=!1;class Q{constructor(){this.objectType="BaseObject",this.userData={},this.prefab=!1,this.isInstantiate=!1,this.isBloom=!1,this.materialList={},this.useMaterialType="origin",this.onPointerIndex=[],this.disposeTrack=!0,this.disposeMaterialIfNotUsed=!0}get parent(){const e=this.object3d.parent;return e&&this.lead.objMap.get(e)||null}get children(){return this.object3d.children.map(e=>this.lead.objMap.get(e)).filter(e=>!!e)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}add(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.object3d.add(t):this.lead.createBaseObject(t,{target:this})})}remove(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.lead.objMap.get(t).erase():this.object3d.remove(t)})}get visible(){return this.object3d.visible}get visibleWithAncestors(){if(this.visible){let e=this.parent;for(;e;){if(!e.visible)return!1;e=e.parent}return!0}else return!1}create(){this.createGroup()}render(){}update(e,t){}resize(e,t){}show(){return this.object3d.visible=!0,this.object3d.layers.set(Pe),this}hide(){return this.object3d.visible=!1,this.object3d.layers.set(Ae),this}createMesh(...e){return this.object3d=new r.Mesh(...e),this}createGroup(){return this.object3d=new r.Group,this}createPoints(...e){return this.object3d=new r.Points(...e),this}createCSS2DObject(e){return this.object3d=new ge.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new te.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new te.CSS3DSprite(e),this}createSprite(e){return this.object3d=new r.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d)}),this}getSize(){const e=new r.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new r.Vector3),center:e.getCenter(new r.Vector3)}}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}clone(){return this.instantiate()}instantiate(e,t){return ee(this,null,function*(){var m;const i=e&&e.length>0,s=(m=t==null?void 0:t.recursive)!=null?m:!0,{objectType:a,objectOptions:c}=this,[,n]=a.split("#");let l=t==null?void 0:t.create;l===void 0&&(l=h=>{if(this.object3d){if(i){const v=e.length;if(this.object3d instanceof r.Sprite)h.object3d=je(this.object3d,v);else{const d=this.object3d,p=this.cloneMaterial();h.object3d=new r.InstancedMesh(d.geometry,p,v)}const f=new r.Object3D;e.forEach((d,p)=>{const b=$.parseVector3(d.position),j=$.parseVector3(d.scale||[1,1,1]);f.position.copy(b),f.scale.copy(j),f.updateMatrix(),h.setInstancedMatrix(p,f.matrix.clone())})}else h.object3d=this.object3d.clone(!1),h.object3d.material&&(h.object3d.material=this.cloneMaterial());h.object3d.userData.prefab&&delete h.object3d.userData.prefab}});const u=yield this.lead.draw(n,q(O({},c||{}),{create:l,prefab:!1,key:(t==null?void 0:t.key)||(c==null?void 0:c.key),target:(t==null?void 0:t.target)||(c==null?void 0:c.target)}));return this.isBloom&&u.enableBloom(),s&&(yield Promise.all(this.children.map(h=>h.instantiate(void 0,{target:u})))),u.isInstantiate=!0,u})}setInstancedMatrix(e,t){if(this.object3d instanceof r.InstancedMesh||this.object3d.isInstantiate)this.object3d.setMatrixAt(e,t);else if(this.object3d instanceof r.Points||this.object3d.type==="Points"){const s=this.object3d.geometry,a=s.attributes.position.array,c=s.attributes.scaleAtt.array,n=new r.Vector3,l=new r.Vector3,u=new r.Quaternion,m=e*3,h=e*1;t.decompose(n,u,l),a[m]=n.x,a[m+1]=n.y,a[m+2]=n.z,c[h]=Math.max(l.x,l.y,l.z),s.attributes.position.needsUpdate=!0,s.attributes.scaleAtt.needsUpdate=!0}}erase(){this.lead.erase(this)}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(i=>{const s=i.userData;i.userData={};const a=i.clone();return i.userData=s,a});{const i=t.userData;t.userData={};const s=t.clone();return t.userData=i,s}}setMaterialList(e,t,i=!0){const s=this.object3d;if(!s||!s.material)return;if(this.materialList.origin||(this.materialList.origin=s.material),this.materialList[e]&&!i)return this.materialList[e];const a=t==="clone"?this.cloneMaterial():Array.isArray(t)?t.slice():t;return this.materialList[e]=a,a}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}useMListById(e,t){if(!this.mList)return;const i=this.mList.get(e);if(!i)return;const s=this.object3d;Array.isArray(s.material)&&t!==void 0?s.material[t]=i:s.material=i}useMListByName(e,t){if(!this.mList)return;const i=this.mList.getKeyByName(e);i&&this.useMListById(i,t)}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}onPointerEvent(e,t){const i=this.lead.handlePick([this],e,t);this.onPointerIndex.push(i)}enableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!0),this.isBloom=!0}disableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!1),this.isBloom=!1}dispose(){var e;if(this.onPointerIndex.forEach(t=>{this.lead.removePick(t)}),this.pencil.options.mList&&this.mList.rmBaseObjectMap(this,void 0,this.disposeMaterialIfNotUsed),(e=this.pencil.composerController)==null||e.bloomSelection.delete(this),this.lead&&(this.lead.objects.delete(this.key),this.object3d&&this.lead.objMap.delete(this.object3d)),this.disposeTrack){const t=new ue;t.disposeMaterial=!this.pencil.options.mList,t.track(this),t.dispose()}}}class ue{constructor(){this.resources=new Set,this.disposeMaterial=!0,this.disposeVideo=!0}track(e){if(!e)return e;if(Array.isArray(e))return e.forEach(t=>this.track(t)),e;if(!this.disposeMaterial&&e instanceof r.Material)return e;if(e instanceof Q?(e.disposeTrack&&e.object3d?this.track(e.object3d):this.resources.add(e),Object.values(e.materialList).map(t=>this.track(t))):(e instanceof r.Object3D||Reflect.has(e,"dispose"))&&this.resources.add(e),e instanceof Q)e.children.forEach(t=>{t.disposeTrack=!1}),this.track(e.children);else if(e instanceof r.Object3D){const t=e;this.track(t.geometry),this.track(t.material),this.track(t.children)}else if(e instanceof r.Material){for(const i of Object.values(e))i instanceof r.Texture&&this.track(i);const t=e;if(t.uniforms){for(const i of Object.values(t.uniforms))if(i){const s=i.value;(s instanceof r.Texture||Array.isArray(s))&&this.track(s)}}}else this.disposeVideo&&e instanceof r.VideoTexture&&e.source.data&&this.resources.add(e.source.data);return e}dispose(){const e=[];for(const t of this.resources)t instanceof r.Object3D?e.push(t):t instanceof HTMLVideoElement&&t.pause(),Reflect.has(t,"dispose")&&t.dispose();e.forEach(t=>{t.removeFromParent()}),e.length=0,this.resources.clear()}}const F=new r.Vector4,se=new r.Vector3,re=new r.Vector3,y=new r.Vector4,M=new r.Vector4,V=new r.Vector4,N=new r.Vector3,Z=new r.Matrix4,x=new r.Line3,ne=new r.Vector3,k=new r.Box3,R=new r.Sphere,D=new r.Vector4;let L,_;function ae(o,e,t){return D.set(0,0,-e,1).applyMatrix4(o.projectionMatrix),D.multiplyScalar(1/D.w),D.x=_/t.width,D.y=_/t.height,D.applyMatrix4(o.projectionMatrixInverse),D.multiplyScalar(1/D.w),Math.abs(Math.max(D.x,D.y))}function Be(o,e){const t=o.matrixWorld,i=o.geometry,s=i.attributes.instanceStart,a=i.attributes.instanceEnd,c=Math.min(i.instanceCount,s.count);for(let n=0,l=c;n<l;n++){x.start.fromBufferAttribute(s,n),x.end.fromBufferAttribute(a,n),x.applyMatrix4(t);const u=new r.Vector3,m=new r.Vector3;L.distanceSqToSegment(x.start,x.end,m,u),m.distanceTo(u)<_*.5&&e.push({point:m,pointOnLine:u,distance:L.origin.distanceTo(m),object:o,face:null,faceIndex:n,uv:null,uv1:null})}}function Ie(o,e,t){const i=e.projectionMatrix,a=o.material.resolution,c=o.matrixWorld,n=o.geometry,l=n.attributes.instanceStart,u=n.attributes.instanceEnd,m=Math.min(n.instanceCount,l.count),h=-e.near;L.at(1,V),V.w=1,V.applyMatrix4(e.matrixWorldInverse),V.applyMatrix4(i),V.multiplyScalar(1/V.w),V.x*=a.x/2,V.y*=a.y/2,V.z=0,N.copy(V),Z.multiplyMatrices(e.matrixWorldInverse,c);for(let v=0,f=m;v<f;v++){if(y.fromBufferAttribute(l,v),M.fromBufferAttribute(u,v),y.w=1,M.w=1,y.applyMatrix4(Z),M.applyMatrix4(Z),y.z>h&&M.z>h)continue;if(y.z>h){const I=y.z-M.z,P=(y.z-h)/I;y.lerp(M,P)}else if(M.z>h){const I=M.z-y.z,P=(M.z-h)/I;M.lerp(y,P)}y.applyMatrix4(i),M.applyMatrix4(i),y.multiplyScalar(1/y.w),M.multiplyScalar(1/M.w),y.x*=a.x/2,y.y*=a.y/2,M.x*=a.x/2,M.y*=a.y/2,x.start.copy(y),x.start.z=0,x.end.copy(M),x.end.z=0;const p=x.closestPointToPointParameter(N,!0);x.at(p,ne);const b=r.MathUtils.lerp(y.z,M.z,p),j=b>=-1&&b<=1,B=N.distanceTo(ne)<_*.5;if(j&&B){x.start.fromBufferAttribute(l,v),x.end.fromBufferAttribute(u,v),x.start.applyMatrix4(c),x.end.applyMatrix4(c);const I=new r.Vector3,P=new r.Vector3;L.distanceSqToSegment(x.start,x.end,P,I),t.push({point:P,pointOnLine:I,distance:L.origin.distanceTo(P),object:o,face:null,faceIndex:v,uv:null,uv1:null})}}}class Ve extends r.Mesh{constructor(e=new be.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let c=0,n=0,l=t.count;c<l;c++,n+=2)se.fromBufferAttribute(t,c),re.fromBufferAttribute(i,c),s[n]=n===0?0:s[n-1],s[n+1]=s[n]+se.distanceTo(re);const a=new r.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new r.InterleavedBufferAttribute(a,1,0)),e.setAttribute("instanceDistanceEnd",new r.InterleavedBufferAttribute(a,1,1)),this}raycast(e,t){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const a=e.params.Line2!==void 0&&e.params.Line2.threshold||0;L=e.ray;const c=this.matrixWorld,n=this.geometry,l=this.material;_=l.linewidth+a,n.boundingSphere===null&&n.computeBoundingSphere(),R.copy(n.boundingSphere).applyMatrix4(c);let u;if(i)u=_*.5;else{const h=Math.max(s.near,R.distanceToPoint(L.origin));u=ae(s,h,l.resolution)}if(R.radius+=u,L.intersectsSphere(R)===!1)return;n.boundingBox===null&&n.computeBoundingBox(),k.copy(n.boundingBox).applyMatrix4(c);let m;if(i)m=_*.5;else{const h=Math.max(s.near,k.distanceToPoint(L.origin));m=ae(s,h,l.resolution)}k.expandByScalar(m),L.intersectsBox(k)!==!1&&(i?Be(this,t):Ie(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(F),this.material.uniforms.resolution.value.set(F.z,F.w))}}const oe=["encodings_fragment","colorspace_fragment"],De=`
|
|
5
5
|
#include <common>
|
|
6
6
|
#include <logdepthbuf_pars_vertex>
|
|
7
7
|
#include <fog_pars_vertex>
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
vHighPrecisionZW = finalPosition.zw;
|
|
95
95
|
#include <fog_vertex>
|
|
96
96
|
}
|
|
97
|
-
`,
|
|
97
|
+
`,Le=`
|
|
98
98
|
#include <packing>
|
|
99
99
|
#include <fog_pars_fragment>
|
|
100
100
|
#include <logdepthbuf_pars_fragment>
|
|
@@ -146,4 +146,4 @@
|
|
|
146
146
|
#include <tonemapping_fragment>
|
|
147
147
|
#include <${+r.REVISION<154?oe[0]:oe[1]}>
|
|
148
148
|
}
|
|
149
|
-
`;class
|
|
149
|
+
`;class ze extends r.ShaderMaterial{constructor(e){super({uniforms:q(O({},r.UniformsLib.fog),{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new r.Color(16777215)},opacity:{value:1},resolution:{value:new r.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},useDepth:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new r.Vector2(1,1)},offset:{value:new r.Vector2(0,0)},offsetLoop:{value:1},lineLightAnimation:{value:0},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new r.Vector2(0,0)},lightColor:{value:new r.Color(16777215)}}),vertexShader:De,fragmentShader:Le}),this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(t){this.uniforms.color.value=t}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(t){this.uniforms.dashArray.value=t,this.useDash=t!==0?1:0}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(t){this.uniforms.useDash.value=t}},useDepth:{enumerable:!0,get(){return this.uniforms.useDepth.value},set(t){this.uniforms.useDepth.value=t}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(t){this.uniforms.repeat.value.copy(t)}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(t){this.uniforms.lineLightAnimation.value=t}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(t){this.uniforms.time.value=t}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(t){this.uniforms.size.value=t}},speed:{enumerable:!0,get:function(){return this.uniforms.speed.value},set:function(t){this.uniforms.speed.value=t}},lightWidth:{enumerable:!0,get:function(){return this.uniforms.lightWidth.value},set:function(t){this.uniforms.lightWidth.value=t}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(t){this.uniforms.uCenter.value=t}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(t){t&&(this.uniforms.lightColor.value=t)}}}),this.setValues(e)}copy(e){return super.copy(e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray=e.dashArray,this.dashOffset=e.dashOffset,this.dashRatio=e.dashRatio,this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this}}function _e(o,e){return o.map(t=>{const i=[];let s;return t.forEach(a=>{if(s){const c=W.geoDistance(a,s)*180/Math.PI;if(c>e){const n=W.geoInterpolate(s,a),l=1/Math.ceil(c/e);let u=l;for(;u<1;)i.push(n(u)),u+=l}}i.push(s=a)}),i})}function Te(o,{minLng:e,maxLng:t,minLat:i,maxLat:s}={}){const a=Math.round(J(360/o,2)/Math.PI),c=(1+Math.sqrt(5))/2,n=f=>f/c*360%360-180,l=f=>Math.acos(2*f/a-1)/Math.PI*180-90,u=f=>a*(Math.cos((f+90)*Math.PI/180)+1)/2,m=[s!==void 0?Math.ceil(u(s)):0,i!==void 0?Math.floor(u(i)):a-1],h=e===void 0&&t===void 0?()=>!0:e===void 0?f=>f<=t:t===void 0?f=>f>=e:t>=e?f=>f>=e&&f<=t:f=>f>=e||f<=t,v=[];for(let f=m[0];f<=m[1];f++){const d=n(f);h(d)&&v.push([d,l(f)])}return v}function H(o,e,t=!1){return t?W.geoContains(e,o):xe(o,e)}function Oe(o,e){const t={type:"Polygon",coordinates:o},[[i,s],[a,c]]=W.geoBounds(t);if(Math.min(Math.abs(a-i),Math.abs(c-s))<e)return[];const n=i>a||c>=89||s<=-89;return Te(e,{minLng:i,maxLng:a,minLat:s,maxLat:c}).filter(l=>H(l,t,n))}function We(o,{resolution:e=1/0,bbox:t,projection:i}={}){const s=_e(o,e),a=T.merge(s),c=Oe(o,e),n=[...a,...c],l={type:"Polygon",coordinates:o},[[u,m],[h,v]]=W.geoBounds(l),f=u>h||v>=89||m<=-89;let d=[];if(f){const g=we.geoVoronoi(n).triangles(),w=new Map(n.map(([S,A],z)=>[`${S}-${A}`,z]));g.features.forEach(S=>{const A=S.geometry.coordinates[0].slice(0,3).reverse(),z=[];if(A.forEach(([C,G])=>{const E=`${C}-${G}`;w.has(E)&&z.push(w.get(E))}),z.length===3){if(z.some(C=>C<a.length)){const C=S.properties.circumcenter;if(!H(C,l,f))return}d.push(...z)}})}else if(c.length){const g=Me.from(n);for(let w=0,S=g.triangles.length;w<S;w+=3){const A=[2,1,0].map(C=>g.triangles[w+C]),z=A.map(C=>n[C]);if(A.some(C=>C<a.length)){const C=[0,1].map(G=>T.mean(z,E=>E[G]));if(!H(C,l,f))continue}d.push(...A)}}else{const{vertices:g,holes:w=[]}=K.flatten(s);d=K(g,w,2)}let p=t?[t[0],t[2]]:T.extent(n,g=>g[0]),b=t?[t[1],t[3]]:T.extent(n,g=>g[1]);if(i){const[g,w]=i([p[0],b[0]]),[S,A]=i([p[1],b[1]]);p=[g,S],b=[-w,-A]}const j=ie.scaleLinear(p,[0,1]),B=ie.scaleLinear(b,[0,1]),I=n.map(([g,w])=>{if(i){const[S,A]=i([g,w]);return[j(S),B(-A)]}else return[j(g),B(w)]});return{contour:s,triangles:{points:n,indices:d,uvs:I}}}const le=new r.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function U(o,e,t,i){const s=o.map(a=>a.map(([c,n])=>{if(i){const[l,u]=i([c,n]);return[l,-u,e]}return t?$.polar2Cartesian(c,n,e):[c,n,e]}));return K.flatten(s)}function Ee(o,e,t,i,s){const{vertices:a,holes:c}=U(o,e,i,s),{vertices:n}=U(o,t,i,s),l=T.merge([n,a]),u=Math.round(n.length/3),m=new Set(c);let h=0;const v=[];for(let d=0;d<u;d++){let p=d+1;if(p===u)p=h;else if(m.has(p)){const b=p;p=h,h=b}v.push(d,d+u,p+u),v.push(p+u,p,d)}const f=[];for(let d=1;d>=0;d--)for(let p=0;p<u;p+=1)f.push(p/(u-1),d);return{indices:v,vertices:l,uvs:f,topVerts:n}}function ce(o,e,t,i,s,a){return{indices:i?o.indices:o.indices.slice().reverse(),vertices:U([o.points],e,s,a).vertices,uvs:t}}const he=({polygonGeoJson:o,startHeight:e,endHeight:t,curvatureResolution:i=1,cartesian:s=!0,hasSide:a=!0,hasBottom:c=!1,hasTop:n=!1,projection:l,bbox:u})=>{o.forEach(j=>{ye(j)||j.reverse()});const{contour:m,triangles:h}=We(o,{resolution:i,bbox:u,projection:l});let v={},f;a&&(v=Ee(m,e!=null?e:t,t!=null?t:e,s,l),f=v.topVerts);let d=[];(c||n)&&(d=T.merge(h.uvs));let p={};c&&(p=ce(h,e,d,!1,s,l));let b={};return n&&(b=ce(h,t,d,!0,s,l)),{contour:m,triangles:h,sideTorso:v,bottomCap:p,topCap:b,topVerts:f}};class ke extends r.BufferGeometry{constructor(e,t={}){super(),this.type="PolygonBufferGeometry",this.parameters=O({polygonGeoJson:e,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},t);const{endHeight:i,hasTop:s,topFirst:a,hasBottom:c,hasSide:n,cartesian:l,userDataRsoOffset:u,projection:m}=this.parameters,{contour:h,sideTorso:v,topVerts:f,bottomCap:d,topCap:p}=he(O({},this.parameters));let b=[],j=[],B=[],I=0;const P=g=>{const w=Math.round(b.length/3),S=B.length;b=b.concat(g.vertices),j=j.concat(g.uvs),B=B.concat(w?g.indices.map(A=>A+w):g.indices),this.addGroup(S,B.length-S,I++)};s&&a&&P(p),n&&(P(v),this.userData.topVerts=u?U(h,i+u,l,m).vertices:f),c&&P(d),s&&!a&&P(p),this.setIndex(B),this[le]("position",new r.Float32BufferAttribute(b,3)),this[le]("uv",new r.Float32BufferAttribute(j,2)),this.computeVertexNormals()}}exports.BLOOM_SCENE=Se;exports.BaseObject=Q;exports.IS_DEV=Ce;exports.LineSegments2=Ve;exports.MeshLineMaterial=ze;exports.PolygonGeometry=ke;exports.ResourceTracker=ue;exports.getMetas=he;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
var Jt = Object.defineProperty, Xt = Object.defineProperties;
|
|
2
2
|
var Qt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var lt = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
4
|
+
var Vt = Object.prototype.hasOwnProperty, Bt = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var It = (a, t, e) => t in a ? Jt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, G = (a, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
7
|
+
Vt.call(t, e) && It(a, e, t[e]);
|
|
8
8
|
if (lt)
|
|
9
9
|
for (var e of lt(t))
|
|
10
|
-
|
|
10
|
+
Bt.call(t, e) && It(a, e, t[e]);
|
|
11
11
|
return a;
|
|
12
12
|
}, ut = (a, t) => Xt(a, Qt(t));
|
|
13
13
|
var gt = (a, t) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var s in a)
|
|
16
|
-
|
|
16
|
+
Vt.call(a, s) && t.indexOf(s) < 0 && (e[s] = a[s]);
|
|
17
17
|
if (a != null && lt)
|
|
18
18
|
for (var s of lt(a))
|
|
19
|
-
t.indexOf(s) < 0 &&
|
|
19
|
+
t.indexOf(s) < 0 && Bt.call(a, s) && (e[s] = a[s]);
|
|
20
20
|
return e;
|
|
21
21
|
};
|
|
22
22
|
var nt = (a, t, e) => new Promise((s, i) => {
|
|
@@ -35,7 +35,7 @@ var nt = (a, t, e) => new Promise((s, i) => {
|
|
|
35
35
|
}, l = (h) => h.done ? s(h.value) : Promise.resolve(h.value).then(n, r);
|
|
36
36
|
l((e = e.apply(a, t)).next());
|
|
37
37
|
});
|
|
38
|
-
import {
|
|
38
|
+
import { a as q, L as Yt, M as Zt, P as Kt } from "../index.module2.js";
|
|
39
39
|
import { g as as } from "../index.module2.js";
|
|
40
40
|
import { BufferGeometry as ot, Float32BufferAttribute as wt, Vector3 as F, ShapeUtils as dt, Shape as xt, Vector2 as P, ArcCurve as te, CatmullRomCurve3 as ee, CubicBezierCurve as se, CubicBezierCurve3 as ie, EllipseCurve as ne, LineCurve as oe, LineCurve3 as re, QuadraticBezierCurve as ae, QuadraticBezierCurve3 as he, SplineCurve as ce, MeshBasicMaterial as le, Mesh as ue, AmbientLight as de, DirectionalLight as pe, PointLight as fe, SpotLight as me, HemisphereLight as ge, RectAreaLight as ye, LineSegments as be, Color as Nt, Matrix4 as we, BufferAttribute as $, Box3 as xe, PlaneGeometry as ve, CanvasTexture as Ae } from "three";
|
|
41
41
|
import * as et from "@tweenjs/tween.js";
|
|
@@ -139,14 +139,14 @@ class Z extends ot {
|
|
|
139
139
|
var Lt, Tt, Et;
|
|
140
140
|
const h = [], b = e.curveSegments !== void 0 ? e.curveSegments : 12, o = e.steps !== void 0 ? e.steps : 1, u = e.depth !== void 0 ? e.depth : 1;
|
|
141
141
|
let y = e.bevelEnabled !== void 0 ? e.bevelEnabled : !0, f = e.bevelThickness !== void 0 ? e.bevelThickness : 0.2, w = e.bevelSize !== void 0 ? e.bevelSize : f - 0.1, M = e.bevelOffset !== void 0 ? e.bevelOffset : 0, _ = e.bevelSegments !== void 0 ? e.bevelSegments : 3;
|
|
142
|
-
const S = e.extrudePath, j = e.UVGenerator !== void 0 ? e.UVGenerator : Ce, v = (Lt = e.hasTop) != null ? Lt : !0,
|
|
142
|
+
const S = e.extrudePath, j = e.UVGenerator !== void 0 ? e.UVGenerator : Ce, v = (Lt = e.hasTop) != null ? Lt : !0, B = (Tt = e.hasBottom) != null ? Tt : !0, pt = (Et = e.hasSide) != null ? Et : !0;
|
|
143
143
|
let J, K = !1, X, st, it, D;
|
|
144
144
|
S && (J = S.getSpacedPoints(o), K = !0, y = !1, X = S.computeFrenetFrames(o, !1), st = new F(), it = new F(), D = new F()), y || (_ = 0, f = 0, w = 0, M = 0);
|
|
145
145
|
const vt = l.extractPoints(b);
|
|
146
|
-
let
|
|
146
|
+
let V = vt.shape;
|
|
147
147
|
const U = vt.holes;
|
|
148
|
-
if (!dt.isClockWise(
|
|
149
|
-
|
|
148
|
+
if (!dt.isClockWise(V)) {
|
|
149
|
+
V = V.reverse();
|
|
150
150
|
for (let c = 0, d = U.length; c < d; c++) {
|
|
151
151
|
const p = U[c];
|
|
152
152
|
dt.isClockWise(p) && (U[c] = p.reverse());
|
|
@@ -169,16 +169,16 @@ class Z extends ot {
|
|
|
169
169
|
g = x;
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
At(
|
|
173
|
-
const ft = U.length, z =
|
|
172
|
+
At(V), U.forEach(At);
|
|
173
|
+
const ft = U.length, z = V;
|
|
174
174
|
for (let c = 0; c < ft; c++) {
|
|
175
175
|
const d = U[c];
|
|
176
|
-
|
|
176
|
+
V = V.concat(d);
|
|
177
177
|
}
|
|
178
178
|
function tt(c, d, p) {
|
|
179
179
|
return d || console.error("THREE.ExtrudeGeometry: vec does not exist"), c.clone().addScaledVector(d, p);
|
|
180
180
|
}
|
|
181
|
-
const O =
|
|
181
|
+
const O = V.length;
|
|
182
182
|
function St(c, d, p) {
|
|
183
183
|
let g, m, A;
|
|
184
184
|
const x = c.x - d.x, L = c.y - d.y, T = p.x - c.x, E = p.y - c.y, C = x * x + L * L, Y = x * E - L * T;
|
|
@@ -238,12 +238,12 @@ class Z extends ot {
|
|
|
238
238
|
}
|
|
239
239
|
const ht = Q.length, _t = w + M;
|
|
240
240
|
for (let c = 0; c < O; c++) {
|
|
241
|
-
const d = y ? tt(
|
|
241
|
+
const d = y ? tt(V[c], at[c], _t) : V[c];
|
|
242
242
|
K ? (it.copy(X.normals[0]).multiplyScalar(d.x), st.copy(X.binormals[0]).multiplyScalar(d.y), D.copy(J[0]).add(it).add(st), H(D.x, D.y, D.z)) : H(d.x, d.y, 0);
|
|
243
243
|
}
|
|
244
244
|
for (let c = 1; c <= o; c++)
|
|
245
245
|
for (let d = 0; d < O; d++) {
|
|
246
|
-
const p = y ? tt(
|
|
246
|
+
const p = y ? tt(V[d], at[d], _t) : V[d];
|
|
247
247
|
K ? (it.copy(X.normals[c]).multiplyScalar(p.x), st.copy(X.binormals[c]).multiplyScalar(p.y), D.copy(J[c]).add(it).add(st), H(D.x, D.y, D.z)) : H(p.x, p.y, u / o * c);
|
|
248
248
|
}
|
|
249
249
|
for (let c = _ - 1; c >= 0; c--) {
|
|
@@ -270,7 +270,7 @@ class Z extends ot {
|
|
|
270
270
|
const c = i.length / 3;
|
|
271
271
|
if (y) {
|
|
272
272
|
let d = 0, p = O * d;
|
|
273
|
-
if (
|
|
273
|
+
if (B)
|
|
274
274
|
for (let g = 0; g < ht; g++) {
|
|
275
275
|
const m = Q[g];
|
|
276
276
|
ct(m[2] + p, m[1] + p, m[0] + p);
|
|
@@ -281,7 +281,7 @@ class Z extends ot {
|
|
|
281
281
|
ct(m[0] + p, m[1] + p, m[2] + p);
|
|
282
282
|
}
|
|
283
283
|
} else {
|
|
284
|
-
if (
|
|
284
|
+
if (B)
|
|
285
285
|
for (let d = 0; d < ht; d++) {
|
|
286
286
|
const p = Q[d];
|
|
287
287
|
ct(p[2], p[1], p[0]);
|
|
@@ -704,13 +704,13 @@ function yt(a, t, e, s, i) {
|
|
|
704
704
|
for (n = 0; n < a.length; n++) e[n + s] = a[n];
|
|
705
705
|
return e;
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function Ve(a) {
|
|
708
708
|
return a instanceof Float32Array ? a : a instanceof ot ? a.getAttribute("position").array : a.map((t) => {
|
|
709
709
|
const e = Array.isArray(t);
|
|
710
710
|
return t instanceof F ? [t.x, t.y, t.z] : t instanceof P ? [t.x, t.y, 0] : e && t.length === 3 ? [t[0], t[1], t[2]] : e && t.length === 2 ? [t[0], t[1], 0] : t;
|
|
711
711
|
}).flat();
|
|
712
712
|
}
|
|
713
|
-
class
|
|
713
|
+
class Be extends ot {
|
|
714
714
|
constructor() {
|
|
715
715
|
super(), this.type = "MeshLine", this.isMeshLine = !0, this.positions = [], this.previous = [], this.next = [], this.side = [], this.width = [], this.indices_array = [], this.uvs = [], this.counters = [], this.widthCallback = null, this._points = [], this.matrixWorld = new we(), Object.defineProperties(this, {
|
|
716
716
|
points: {
|
|
@@ -728,7 +728,7 @@ class Ve extends ot {
|
|
|
728
728
|
this.matrixWorld = t;
|
|
729
729
|
}
|
|
730
730
|
setPoints(t, e) {
|
|
731
|
-
if (t =
|
|
731
|
+
if (t = Ve(t), this._points = t, this.widthCallback = e != null ? e : null, this.positions = [], this.counters = [], t.length && t[0] instanceof F)
|
|
732
732
|
for (let s = 0; s < t.length; s++) {
|
|
733
733
|
const i = t[s], n = s / (t.length - 1);
|
|
734
734
|
this.positions.push(i.x, i.y, i.z), this.positions.push(i.x, i.y, i.z), this.counters.push(n), this.counters.push(n);
|
|
@@ -782,7 +782,7 @@ class Ve extends ot {
|
|
|
782
782
|
}
|
|
783
783
|
}
|
|
784
784
|
const bt = (a) => {
|
|
785
|
-
const { setPointWidth: t, nodes: e } = a, s = new
|
|
785
|
+
const { setPointWidth: t, nodes: e } = a, s = new Be();
|
|
786
786
|
return s.setPoints(e, t), s;
|
|
787
787
|
};
|
|
788
788
|
class es extends q {
|
|
@@ -975,9 +975,9 @@ class ze extends Z {
|
|
|
975
975
|
}
|
|
976
976
|
if (h) {
|
|
977
977
|
const S = h.min, j = h.max, v = new F().subVectors(j, S);
|
|
978
|
-
for (let
|
|
979
|
-
const pt = f.getX(
|
|
980
|
-
w.setXY(
|
|
978
|
+
for (let B = 0; B < f.count; B++) {
|
|
979
|
+
const pt = f.getX(B), J = f.getY(B), K = (pt - S.x) / v.x, X = (J - S.y) / v.y;
|
|
980
|
+
w.setXY(B, K, X);
|
|
981
981
|
}
|
|
982
982
|
y.geometry.setAttribute("uv", w);
|
|
983
983
|
}
|
|
@@ -1049,11 +1049,11 @@ class is extends q {
|
|
|
1049
1049
|
}) : !_ && e ? _ = R(
|
|
1050
1050
|
e.map(
|
|
1051
1051
|
(S, j) => {
|
|
1052
|
-
var v,
|
|
1052
|
+
var v, B;
|
|
1053
1053
|
return Ht({
|
|
1054
1054
|
points: S,
|
|
1055
1055
|
depth: (v = f[j]) != null ? v : f[0],
|
|
1056
|
-
box3: (
|
|
1056
|
+
box3: (B = w[j]) != null ? B : w[0],
|
|
1057
1057
|
split: b,
|
|
1058
1058
|
hasTop: o,
|
|
1059
1059
|
hasBottom: u,
|
|
@@ -1109,7 +1109,7 @@ export {
|
|
|
1109
1109
|
Ke as Line2,
|
|
1110
1110
|
us as Line2Material,
|
|
1111
1111
|
cs as LineSegmentsGeometry,
|
|
1112
|
-
|
|
1112
|
+
Be as MeshLineGeometry,
|
|
1113
1113
|
Zt as MeshLineMaterial,
|
|
1114
1114
|
Xe as Node,
|
|
1115
1115
|
Ye as Pie,
|