@aibee/crc-bmap 0.8.50 → 0.8.51
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/lib/bmap.cjs.min.js +11 -11
- package/lib/bmap.esm.js +3 -3
- package/lib/bmap.esm.min.js +1 -1
- package/lib/bmap.min.js +1 -1
- package/lib/src/elements/ground-texture.js +3 -3
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -11759,9 +11759,9 @@ var GroundTexture = class extends Object3D8 {
|
|
|
11759
11759
|
});
|
|
11760
11760
|
}
|
|
11761
11761
|
dispose() {
|
|
11762
|
-
var _this_mesh, _this_mesh1;
|
|
11763
|
-
(_this_mesh = this.mesh) == null ? void 0 : _this_mesh.geometry.dispose();
|
|
11764
|
-
(
|
|
11762
|
+
var _this_mesh_geometry, _this_mesh, _this_mesh_material, _this_mesh1;
|
|
11763
|
+
(_this_mesh = this.mesh) == null ? void 0 : (_this_mesh_geometry = _this_mesh.geometry) == null ? void 0 : _this_mesh_geometry.dispose();
|
|
11764
|
+
(_this_mesh1 = this.mesh) == null ? void 0 : (_this_mesh_material = _this_mesh1.material) == null ? void 0 : _this_mesh_material.forEach((item) => item.dispose());
|
|
11765
11765
|
this.clear();
|
|
11766
11766
|
}
|
|
11767
11767
|
constructor(context, options) {
|
package/lib/bmap.esm.min.js
CHANGED
|
@@ -77,7 +77,7 @@ var g_=Object.create;var N0=Object.defineProperty;var m_=Object.getOwnPropertyDe
|
|
|
77
77
|
gl_FragColor = vec4(vColor, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
`,n=-1/0,r=1/0,o=this.geometry.getAttribute("position");if(o)for(let a=0;a<o.count;a++){let u=o.getZ(a);u>n&&(n=u),u<r&&(r=u)}let s=new iL({uniforms:{maxZ:{value:n},uColor:{value:new a0(this.options[0].fillColor)},uGradualColor1:{value:new a0(pe(this.options[0].fillColor,.99))},uGradualColor2:{value:new a0(pe(this.options[0].fillColor,.9))},uOpacity:{value:this.options[0].fillOpacity},minZ:{value:r}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=s}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],n=H.createLineMaterial({color:t,opacity:e});return this.lineMaterial=n,n}getBorderPoints(t){let{height:e,deltaHeight:n,geometry:r}=t,o=[],s=e+(n||0),{coords:a}=r;for(let u=0;u<a.length;u++){let l=a[u];for(let c=0;c<l.length;c++){let p=l[c],h=c+1===l.length?l[0]:l[c+1];o.push(new jy(p[0],p[1],s)),o.push(new jy(h[0],h[1],s))}}return o}initLineGeometry(){let t=this.options.map(e=>{let n=this.getBorderPoints(e);return new ZP().setFromPoints(n)});this.lineGeometry=Wy(t)}createBorder(){let t=new eL(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new nL(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry())}dispose(){var t,e,n;(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.lineGeometry)==null||n.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,e.length&&this.init()}};var lG=d(w(),1);import{DoubleSide as oL,Float32BufferAttribute as sL,Mesh as aL,MeshBasicMaterial as uL,Object3D as lL,ShapeGeometry as cL}from"three";import{mergeGeometries as hL}from"three/examples/jsm/utils/BufferGeometryUtils";var pL={uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},Un=class extends lL{init(){return x(this,null,function*(){let t=this.options.map(o=>{let{geometry:s}=o,a=Qt(s.coords[0],s.coords.slice(1)),u=new cL(a,4),l=o.height+o.deltaHeight+o.airHeight,c=u.getAttribute("position");for(let h=0;h<c.count;h++)c.setZ(h,l);let p=[0,1,1,1,1,0,0,0];return u.setAttribute("uv",new sL(p,2)),u}),e=hL(t,!0);t.forEach(o=>o.dispose());let n=yield Promise.all(this.options.map(o=>x(this,null,function*(){let{iconUrl:s}=o,a=yield ne.getTextureByUrl(s);return new uL({map:a,alphaTest:1,side:oL})}))),r=new aL(e,n);this.mesh=r,this.position.z+=.004,this.add(r)})}dispose(){var t,e;(
|
|
80
|
+
`,n=-1/0,r=1/0,o=this.geometry.getAttribute("position");if(o)for(let a=0;a<o.count;a++){let u=o.getZ(a);u>n&&(n=u),u<r&&(r=u)}let s=new iL({uniforms:{maxZ:{value:n},uColor:{value:new a0(this.options[0].fillColor)},uGradualColor1:{value:new a0(pe(this.options[0].fillColor,.99))},uGradualColor2:{value:new a0(pe(this.options[0].fillColor,.9))},uOpacity:{value:this.options[0].fillOpacity},minZ:{value:r}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=s}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],n=H.createLineMaterial({color:t,opacity:e});return this.lineMaterial=n,n}getBorderPoints(t){let{height:e,deltaHeight:n,geometry:r}=t,o=[],s=e+(n||0),{coords:a}=r;for(let u=0;u<a.length;u++){let l=a[u];for(let c=0;c<l.length;c++){let p=l[c],h=c+1===l.length?l[0]:l[c+1];o.push(new jy(p[0],p[1],s)),o.push(new jy(h[0],h[1],s))}}return o}initLineGeometry(){let t=this.options.map(e=>{let n=this.getBorderPoints(e);return new ZP().setFromPoints(n)});this.lineGeometry=Wy(t)}createBorder(){let t=new eL(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new nL(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry())}dispose(){var t,e,n;(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.lineGeometry)==null||n.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,e.length&&this.init()}};var lG=d(w(),1);import{DoubleSide as oL,Float32BufferAttribute as sL,Mesh as aL,MeshBasicMaterial as uL,Object3D as lL,ShapeGeometry as cL}from"three";import{mergeGeometries as hL}from"three/examples/jsm/utils/BufferGeometryUtils";var pL={uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},Un=class extends lL{init(){return x(this,null,function*(){let t=this.options.map(o=>{let{geometry:s}=o,a=Qt(s.coords[0],s.coords.slice(1)),u=new cL(a,4),l=o.height+o.deltaHeight+o.airHeight,c=u.getAttribute("position");for(let h=0;h<c.count;h++)c.setZ(h,l);let p=[0,1,1,1,1,0,0,0];return u.setAttribute("uv",new sL(p,2)),u}),e=hL(t,!0);t.forEach(o=>o.dispose());let n=yield Promise.all(this.options.map(o=>x(this,null,function*(){let{iconUrl:s}=o,a=yield ne.getTextureByUrl(s);return new uL({map:a,alphaTest:1,side:oL})}))),r=new aL(e,n);this.mesh=r,this.position.z+=.004,this.add(r)})}dispose(){var t,e,n,r;(e=this.mesh)==null||(t=e.geometry)==null||t.dispose(),(r=this.mesh)==null||(n=r.material)==null||n.forEach(o=>o.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>E({},pL,n)),this.init()}};import{Box3 as fL,Mesh as dL,Object3D as gL,Vector3 as mL}from"three";var yL={url:"",geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},id:"",width:0,rotate:1,airHeight:1,deltaHeight:0,center_x:0,center_y:0},Mo=class extends gL{loadModel(){return x(this,null,function*(){let t=yield bt.loadModel(this.options.url);t.scene.rotation.set(Math.PI/2,0,0);let n=new fL().setFromObject(t.scene).getSize(new mL),r=Math.max(n.x,n.y),o=this.options.width/r;this.scale.set(o,o,o),this.meshSetMaterial(t.scene),this.add(t.scene),this.position.set(this.options.center_x,this.options.center_y,0),this.position.z+=this.options.airHeight+this.options.deltaHeight,this.model=t,this.rotateZ(this.options.rotate)})}meshSetMaterial(t){t instanceof dL&&(t.frustumCulled=!1,t.castShadow=!0,t.material.emissiveIntensity*=.95,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map),t.children.forEach(n=>{this.meshSetMaterial(n)})}dispose(){Y(this),this.model=null}constructor(t,e){super(),this.context=t,this.model=null,this.options=Object.assign({},yL,e),this.loadModel()}};var CG=d(N(),1),AG=d(w(),1),EG=d(qa(),1),SG=d(ja(),1);import{BufferGeometry as vL,LineSegments as _L,Mesh as xL,Object3D as CL,ShapeGeometry as AL,Vector2 as EL,Vector3 as Qy}from"three";import{mergeGeometries as Yy}from"three/examples/jsm/utils/BufferGeometryUtils";import{Line2 as SL}from"three/examples/jsm/lines/Line2";import{LineGeometry as bL}from"three/examples/jsm/lines/LineGeometry";var To=class extends CL{initGeometry(){let t=this.options.map(e=>{let n=Qt(e.geometry.coords[0].slice(0,-1),e.geometry.coords.slice(1)),r=new AL(n,4),o=r.getAttribute("position");for(let s=0;s<o.count;s++)o.setZ(s,e.airHeight+(e.deltaHeight||0));return r});this.geometry=Yy(t),t.forEach(e=>e.dispose())}initMaterial(){let{fillColor:t,fillOpacity:e}=this.options[0],n=H.createMeshBasicMaterial({color:t,opacity:e});return this.material=n,n}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],n=H.createLineMaterial({color:t,opacity:e});return this.lineMaterial=n,n}getBorderPoints(t){let{deltaHeight:e,geometry:n}=t,r=[],o=e||0,{coords:s}=n;for(let a=0;a<s.length;a++){let u=s[a];for(let l=0;l<u.length;l++){let c=u[l],p=l+1===u.length?u[0]:u[l+1];r.push(new Qy(c[0],c[1],o)),r.push(new Qy(p[0],p[1],o))}}return r}initDoubleLine(){let t=this.options.filter(n=>{var r,o;return n.double&&((o=n.geometry.otherCoords)==null||(r=o[1])==null?void 0:r.length)});if(!t.length)return;let e=t.reduce((n,r)=>{let o=r.secondColor+"-"+r.dashed;return n[o]&&n[o].push(r),n[o]||(n[o]=[r]),n},{});this.doubleLines=Object.values(e).map(n=>{let r=H.createLine2MaterialMap({color:n[0].secondColor,width:.2,dashed:n[0].dashed,resolution:new EL(this.context.clientSize.width,this.context.clientSize.height)});return n.map(o=>{let s=new bL,a=o.geometry.otherCoords[1].map(l=>[...l,o.airHeight+(o.deltaHeight||0)]).flat(2);s.setPositions(a);let u=new SL(s,r);return u.computeLineDistances(),u.position.z+=.01,this.add(u),u})}).flat(2)}initLineGeometry(){let t=this.options.map(e=>{let n=this.getBorderPoints(e);return new vL().setFromPoints(n)});this.lineGeometry=Yy(t)}createBorder(){let t=new _L(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new xL(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry()),this.initDoubleLine(),this.position.z+=.02+(this.options[0].deltaHeight||0)}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.lineGeometry)==null||e.dispose(),this.doubleLines.map(n=>n.geometry.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.doubleLines=[],e.length&&this.init()}};var BG=d(N(),1);import{Object3D as wL,ExtrudeGeometry as ML,Mesh as TL,Vector3 as Ky,BufferGeometry as IL,LineSegments as RL,ShaderMaterial as PL,Color as Jy}from"three";import{mergeGeometries as LL}from"three/examples/jsm/utils/BufferGeometryUtils";var Fn=class extends wL{init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight+this.options[0].airHeight,this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initGeometry(){let t=this.options.map(n=>{let r=n.geometry.coords,o=Qt(r[0],r.slice(1));return new ML(o,{steps:1,bevelEnabled:!1,depth:n.height,curveSegments:4})}),e=LL(t);return t.forEach(n=>n.dispose()),e}initMaterial(){let t=`
|
|
81
81
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
82
82
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
83
83
|
uniform vec3 uColor;
|
package/lib/bmap.min.js
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
gl_FragColor = vec4(vColor, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
`,n=-1/0,i=1/0,o=this.geometry.getAttribute("position");if(o)for(let a=0;a<o.count;a++){let u=o.getZ(a);u>n&&(n=u),u<i&&(i=u)}let s=new rt.ShaderMaterial({uniforms:{maxZ:{value:n},uColor:{value:new rt.Color(this.options[0].fillColor)},uGradualColor1:{value:new rt.Color(xe(this.options[0].fillColor,.99))},uGradualColor2:{value:new rt.Color(xe(this.options[0].fillColor,.9))},uOpacity:{value:this.options[0].fillOpacity},minZ:{value:i}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=s}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],n=Q.createLineMaterial({color:t,opacity:e});return this.lineMaterial=n,n}getBorderPoints(t){let{height:e,deltaHeight:n,geometry:i}=t,o=[],s=e+(n||0),{coords:a}=i;for(let u=0;u<a.length;u++){let l=a[u];for(let c=0;c<l.length;c++){let p=l[c],h=c+1===l.length?l[0]:l[c+1];o.push(new rt.Vector3(p[0],p[1],s)),o.push(new rt.Vector3(h[0],h[1],s))}}return o}initLineGeometry(){let t=this.options.map(e=>{let n=this.getBorderPoints(e);return new rt.BufferGeometry().setFromPoints(n)});this.lineGeometry=(0,V0.mergeGeometries)(t)}createBorder(){let t=new rt.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new rt.Mesh(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry())}dispose(){var t,e,n;(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.lineGeometry)==null||n.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,e.length&&this.init()}};var $9=d(I(),1);var jt=C("three"),Bv=C("three/examples/jsm/utils/BufferGeometryUtils");var Nv={uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},Tn=class extends jt.Object3D{init(){return x(this,null,function*(){let t=this.options.map(o=>{let{geometry:s}=o,a=te(s.coords[0],s.coords.slice(1)),u=new jt.ShapeGeometry(a,4),l=o.height+o.deltaHeight+o.airHeight,c=u.getAttribute("position");for(let h=0;h<c.count;h++)c.setZ(h,l);let p=[0,1,1,1,1,0,0,0];return u.setAttribute("uv",new jt.Float32BufferAttribute(p,2)),u}),e=(0,Bv.mergeGeometries)(t,!0);t.forEach(o=>o.dispose());let n=yield Promise.all(this.options.map(o=>x(this,null,function*(){let{iconUrl:s}=o,a=yield be.getTextureByUrl(s);return new jt.MeshBasicMaterial({map:a,alphaTest:1,side:jt.DoubleSide})}))),i=new jt.Mesh(e,n);this.mesh=i,this.position.z+=.004,this.add(i)})}dispose(){var t,e;(
|
|
80
|
+
`,n=-1/0,i=1/0,o=this.geometry.getAttribute("position");if(o)for(let a=0;a<o.count;a++){let u=o.getZ(a);u>n&&(n=u),u<i&&(i=u)}let s=new rt.ShaderMaterial({uniforms:{maxZ:{value:n},uColor:{value:new rt.Color(this.options[0].fillColor)},uGradualColor1:{value:new rt.Color(xe(this.options[0].fillColor,.99))},uGradualColor2:{value:new rt.Color(xe(this.options[0].fillColor,.9))},uOpacity:{value:this.options[0].fillOpacity},minZ:{value:i}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=s}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],n=Q.createLineMaterial({color:t,opacity:e});return this.lineMaterial=n,n}getBorderPoints(t){let{height:e,deltaHeight:n,geometry:i}=t,o=[],s=e+(n||0),{coords:a}=i;for(let u=0;u<a.length;u++){let l=a[u];for(let c=0;c<l.length;c++){let p=l[c],h=c+1===l.length?l[0]:l[c+1];o.push(new rt.Vector3(p[0],p[1],s)),o.push(new rt.Vector3(h[0],h[1],s))}}return o}initLineGeometry(){let t=this.options.map(e=>{let n=this.getBorderPoints(e);return new rt.BufferGeometry().setFromPoints(n)});this.lineGeometry=(0,V0.mergeGeometries)(t)}createBorder(){let t=new rt.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new rt.Mesh(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry())}dispose(){var t,e,n;(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.lineGeometry)==null||n.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,e.length&&this.init()}};var $9=d(I(),1);var jt=C("three"),Bv=C("three/examples/jsm/utils/BufferGeometryUtils");var Nv={uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},Tn=class extends jt.Object3D{init(){return x(this,null,function*(){let t=this.options.map(o=>{let{geometry:s}=o,a=te(s.coords[0],s.coords.slice(1)),u=new jt.ShapeGeometry(a,4),l=o.height+o.deltaHeight+o.airHeight,c=u.getAttribute("position");for(let h=0;h<c.count;h++)c.setZ(h,l);let p=[0,1,1,1,1,0,0,0];return u.setAttribute("uv",new jt.Float32BufferAttribute(p,2)),u}),e=(0,Bv.mergeGeometries)(t,!0);t.forEach(o=>o.dispose());let n=yield Promise.all(this.options.map(o=>x(this,null,function*(){let{iconUrl:s}=o,a=yield be.getTextureByUrl(s);return new jt.MeshBasicMaterial({map:a,alphaTest:1,side:jt.DoubleSide})}))),i=new jt.Mesh(e,n);this.mesh=i,this.position.z+=.004,this.add(i)})}dispose(){var t,e,n,i;(e=this.mesh)==null||(t=e.geometry)==null||t.dispose(),(i=this.mesh)==null||(n=i.material)==null||n.forEach(o=>o.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>S({},Nv,n)),this.init()}};var an=C("three");var TP={url:"",geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},id:"",width:0,rotate:1,airHeight:1,deltaHeight:0,center_x:0,center_y:0},hi=class extends an.Object3D{loadModel(){return x(this,null,function*(){let t=yield Xt.loadModel(this.options.url);t.scene.rotation.set(Math.PI/2,0,0);let n=new an.Box3().setFromObject(t.scene).getSize(new an.Vector3),i=Math.max(n.x,n.y),o=this.options.width/i;this.scale.set(o,o,o),this.meshSetMaterial(t.scene),this.add(t.scene),this.position.set(this.options.center_x,this.options.center_y,0),this.position.z+=this.options.airHeight+this.options.deltaHeight,this.model=t,this.rotateZ(this.options.rotate)})}meshSetMaterial(t){t instanceof an.Mesh&&(t.frustumCulled=!1,t.castShadow=!0,t.material.emissiveIntensity*=.95,t.material.emissive=t.material.color,t.material.emissiveMap=t.material.map),t.children.forEach(n=>{this.meshSetMaterial(n)})}dispose(){et(this),this.model=null}constructor(t,e){super(),this.context=t,this.model=null,this.options=Object.assign({},TP,e),this.loadModel()}};var W9=d(F(),1),Q9=d(I(),1),Y9=d(Tu(),1),K9=d(Iu(),1),Ct=C("three");var X0=C("three/examples/jsm/utils/BufferGeometryUtils"),Ov=C("three/examples/jsm/lines/Line2"),Dv=C("three/examples/jsm/lines/LineGeometry");var pi=class extends Ct.Object3D{initGeometry(){let t=this.options.map(e=>{let n=te(e.geometry.coords[0].slice(0,-1),e.geometry.coords.slice(1)),i=new Ct.ShapeGeometry(n,4),o=i.getAttribute("position");for(let s=0;s<o.count;s++)o.setZ(s,e.airHeight+(e.deltaHeight||0));return i});this.geometry=(0,X0.mergeGeometries)(t),t.forEach(e=>e.dispose())}initMaterial(){let{fillColor:t,fillOpacity:e}=this.options[0],n=Q.createMeshBasicMaterial({color:t,opacity:e});return this.material=n,n}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],n=Q.createLineMaterial({color:t,opacity:e});return this.lineMaterial=n,n}getBorderPoints(t){let{deltaHeight:e,geometry:n}=t,i=[],o=e||0,{coords:s}=n;for(let a=0;a<s.length;a++){let u=s[a];for(let l=0;l<u.length;l++){let c=u[l],p=l+1===u.length?u[0]:u[l+1];i.push(new Ct.Vector3(c[0],c[1],o)),i.push(new Ct.Vector3(p[0],p[1],o))}}return i}initDoubleLine(){let t=this.options.filter(n=>{var i,o;return n.double&&((o=n.geometry.otherCoords)==null||(i=o[1])==null?void 0:i.length)});if(!t.length)return;let e=t.reduce((n,i)=>{let o=i.secondColor+"-"+i.dashed;return n[o]&&n[o].push(i),n[o]||(n[o]=[i]),n},{});this.doubleLines=Object.values(e).map(n=>{let i=Q.createLine2MaterialMap({color:n[0].secondColor,width:.2,dashed:n[0].dashed,resolution:new Ct.Vector2(this.context.clientSize.width,this.context.clientSize.height)});return n.map(o=>{let s=new Dv.LineGeometry,a=o.geometry.otherCoords[1].map(l=>[...l,o.airHeight+(o.deltaHeight||0)]).flat(2);s.setPositions(a);let u=new Ov.Line2(s,i);return u.computeLineDistances(),u.position.z+=.01,this.add(u),u})}).flat(2)}initLineGeometry(){let t=this.options.map(e=>{let n=this.getBorderPoints(e);return new Ct.BufferGeometry().setFromPoints(n)});this.lineGeometry=(0,X0.mergeGeometries)(t)}createBorder(){let t=new Ct.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new Ct.Mesh(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry()),this.initDoubleLine(),this.position.z+=.02+(this.options[0].deltaHeight||0)}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.lineGeometry)==null||e.dispose(),this.doubleLines.map(n=>n.geometry.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e,this.doubleLines=[],e.length&&this.init()}};var n8=d(F(),1),at=C("three");var Uv=C("three/examples/jsm/utils/BufferGeometryUtils");var In=class extends at.Object3D{init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight+this.options[0].airHeight,this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initGeometry(){let t=this.options.map(n=>{let i=n.geometry.coords,o=te(i[0],i.slice(1));return new at.ExtrudeGeometry(o,{steps:1,bevelEnabled:!1,depth:n.height,curveSegments:4})}),e=(0,Uv.mergeGeometries)(t);return t.forEach(n=>n.dispose()),e}initMaterial(){let t=`
|
|
81
81
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
82
82
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
83
83
|
uniform vec3 uColor;
|
|
@@ -66,9 +66,9 @@ export class GroundTexture extends Object3D {
|
|
|
66
66
|
this.add(mesh);
|
|
67
67
|
}
|
|
68
68
|
dispose() {
|
|
69
|
-
var _this_mesh, _this_mesh1;
|
|
70
|
-
(_this_mesh = this.mesh) == null ? void 0 : _this_mesh.geometry.dispose();
|
|
71
|
-
(
|
|
69
|
+
var _this_mesh_geometry, _this_mesh, _this_mesh_material, _this_mesh1;
|
|
70
|
+
(_this_mesh = this.mesh) == null ? void 0 : (_this_mesh_geometry = _this_mesh.geometry) == null ? void 0 : _this_mesh_geometry.dispose();
|
|
71
|
+
(_this_mesh1 = this.mesh) == null ? void 0 : (_this_mesh_material = _this_mesh1.material) == null ? void 0 : _this_mesh_material.forEach((item)=>item.dispose());
|
|
72
72
|
this.clear();
|
|
73
73
|
}
|
|
74
74
|
constructor(context, options){
|