@aibee/crc-bmap 0.0.136 → 0.0.137
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 +1 -5
- package/lib/bmap.cjs.min.js.map +2 -2
- package/lib/bmap.esm.js +2 -6
- package/lib/bmap.esm.js.map +2 -2
- package/lib/bmap.esm.min.js +1 -5
- package/lib/bmap.esm.min.js.map +2 -2
- package/lib/bmap.min.js +1 -5
- package/lib/bmap.min.js.map +2 -2
- package/package.json +1 -1
package/lib/bmap.esm.min.js
CHANGED
|
@@ -33,15 +33,11 @@ var pi=Object.create;var Pe=Object.defineProperty;var fi=Object.getOwnPropertyDe
|
|
|
33
33
|
float secondZ = minZ + step;
|
|
34
34
|
float currentZ = vPosition.z - minZ;
|
|
35
35
|
float t = currentZ / z;
|
|
36
|
-
// if (currentZ > secondZ && currentZ < firstZ) {
|
|
37
|
-
// float randValue = random();
|
|
38
|
-
// t = t + randValue;
|
|
39
|
-
// }
|
|
40
36
|
vec3 vColor = mix(uGradualColor1, uGradualColor2, 1.0 - t);
|
|
41
37
|
gl_FragColor = vec4(vColor, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
42
38
|
}
|
|
43
39
|
}
|
|
44
|
-
`,i=-1/0,r=1/0,s=this.geometry.getAttribute("position");if(s)for(let u=0;u<s.count;u++){let a=s.getZ(u);a>i&&(i=a),a<r&&(r=a)}let l=new zr({uniforms:{maxZ:{value:i},uColor:{value:new xe(this.options[0].fillColor)},uGradualColor1:{value:new xe($(this.options[0].fillColor,.
|
|
40
|
+
`,i=-1/0,r=1/0,s=this.geometry.getAttribute("position");if(s)for(let u=0;u<s.count;u++){let a=s.getZ(u);a>i&&(i=a),a<r&&(r=a)}let l=new zr({uniforms:{maxZ:{value:i},uColor:{value:new xe(this.options[0].fillColor)},uGradualColor1:{value:new xe($(this.options[0].fillColor,.99))},uGradualColor2:{value:new xe($(this.options[0].fillColor,.9))},uOpacity:{value:this.options[0].fillOpacity},minZ:{value:r}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=l}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],i=this.context.materialFactory.createLineMaterial({color:t,opacity:e});return this.lineMaterial=i,i}getBorderPoints(t){let{height:e,deltaHeight:i,geometry:r}=t,s=[],l=e+(i||0),{coords:u}=r;for(let a=0;a<u.length;a++){let c=u[a];for(let p=0;p<c.length;p++){let f=c[p],m=p+1===c.length?c[0]:c[p+1];s.push(new Pn(f[0],f[1],l)),s.push(new Pn(m[0],m[1],l))}}return s}initLineGeometry(){let t=this.options.map(e=>{let i=this.getBorderPoints(e);return new Or().setFromPoints(i)});this.lineGeometry=Ln(t)}createBorder(){let t=new Ur(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new Br(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}dispose(){this.geometry?.dispose(),this.material?.dispose(),this.lineGeometry?.dispose(),this.clear()}};import{DoubleSide as kr,Float32BufferAttribute as Vr,Mesh as Hr,MeshBasicMaterial as Wr,Object3D as Xr,ShapeGeometry as qr}from"three";import{mergeGeometries as jr}from"three/examples/jsm/utils/BufferGeometryUtils";var Yr={uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},vt=class extends Xr{constructor(t,e){super();this.context=t;this.options=e.map(i=>({...Yr,...i})),this.init()}options;mesh;async init(){let t=this.options.map(s=>{let{geometry:l}=s,u=z(l.coords[0],l.coords.slice(1)),a=new qr(u,4),c=s.height+s.deltaHeight+s.airHeight,p=a.getAttribute("position");for(let m=0;m<p.count;m++)p.setZ(m,c);let f=[0,1,1,1,1,0,0,0];return a.setAttribute("uv",new Vr(f,2)),a}),e=jr(t,!0);t.forEach(s=>s.dispose());let i=await Promise.all(this.options.map(async s=>{let{iconUrl:l}=s,u=await this.context.textureFactory.getTexture(l);return new Wr({map:u,alphaTest:.5,side:kr})})),r=new Hr(e,i);this.mesh=r,this.position.z+=.004,this.add(r)}dispose(){this.mesh?.geometry.dispose(),(this.mesh?.material).forEach(t=>t.dispose()),this.clear()}};import{Box3 as $r,Mesh as Zr,Object3D as Kr,Vector3 as Jr}from"three";var Qr={url:"",geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},id:"",width:0,rotate:1,airHeight:1,deltaHeight:0,center_x:0,center_y:0},Xt=class extends Kr{constructor(t,e){super();this.context=t;this.options=Object.assign({},Qr,e),this.loadModel()}model=null;options;async loadModel(){let t=await Rt(this.options.url);t.scene.rotation.set(Math.PI/2,0,0);let i=new $r().setFromObject(t.scene).getSize(new Jr),r=Math.max(i.x,i.y),s=this.options.width/r;this.scale.set(s,s,s),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 Zr&&(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(i=>{this.meshSetMaterial(i)})}dispose(){D(this),this.model=null}};import{BufferGeometry as to,LineSegments as eo,Mesh as no,Object3D as io,ShapeGeometry as ro,Vector3 as An}from"three";import{mergeGeometries as Rn}from"three/examples/jsm/utils/BufferGeometryUtils";import{Line2 as oo}from"three/examples/jsm/lines/Line2";import{LineGeometry as so}from"three/examples/jsm/lines/LineGeometry";var qt=class extends io{constructor(t,e){super();this.context=t;this.options=e;e.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;doubleLines=[];initGeometry(){let t=this.options.map(e=>{let i=z(e.geometry.coords[0].slice(0,-1),e.geometry.coords.slice(1)),r=new ro(i,4),s=r.getAttribute("position");for(let l=0;l<s.count;l++)s.setZ(l,e.airHeight+(e.deltaHeight||0));return r});this.geometry=Rn(t),t.forEach(e=>e.dispose())}initMaterial(){let{fillColor:t,fillOpacity:e}=this.options[0],i=this.context.materialFactory.createMeshBasicMaterial({color:t,opacity:e});return this.material=i,i}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],i=this.context.materialFactory.createLineMaterial({color:t,opacity:e});return this.lineMaterial=i,i}getBorderPoints(t){let{deltaHeight:e,geometry:i}=t,r=[],s=e||0,{coords:l}=i;for(let u=0;u<l.length;u++){let a=l[u];for(let c=0;c<a.length;c++){let p=a[c],f=c+1===a.length?a[0]:a[c+1];r.push(new An(p[0],p[1],s)),r.push(new An(f[0],f[1],s))}}return r}initDoubleLine(){let t=this.options.filter(i=>i.double&&i.geometry.otherCoords?.[1]?.length);if(!t.length)return;let e=t.reduce((i,r)=>{let s=`${r.secondColor}-${r.dashed}`;return i[s]&&i[s].push(r),i[s]||(i[s]=[r]),i},{});this.doubleLines=Object.values(e).map(i=>{let r=this.context.materialFactory.createLine2MaterialMap({color:i[0].secondColor,width:.2,dashed:i[0].dashed});return i.map(s=>{let l=new so,u=s.geometry.otherCoords[1].map(c=>[...c,s.airHeight+(s.deltaHeight||0)]).flat(2);l.setPositions(u);let a=new oo(l,r);return a.computeLineDistances(),a.position.z+=.001,this.add(a),a})}).flat(2)}initLineGeometry(){let t=this.options.map(e=>{let i=this.getBorderPoints(e);return new to().setFromPoints(i)});this.lineGeometry=Rn(t)}createBorder(){let t=new eo(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new no(this.geometry,this.material);this.add(t),this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder()),this.initDoubleLine(),this.position.z+=.002+(this.options[0].deltaHeight||0)}dispose(){this.geometry?.dispose(),this.lineGeometry?.dispose(),this.doubleLines.map(t=>t.geometry.dispose()),this.clear()}};import{Object3D as ao,ExtrudeGeometry as lo,Mesh as uo,Vector3 as In,BufferGeometry as co,LineSegments as ho,ShaderMaterial as po,Color as Nn}from"three";import{mergeGeometries as fo}from"three/examples/jsm/utils/BufferGeometryUtils";var jt=class extends ao{constructor(t,e){super();this.context=t;this.options=e.map(i=>({..._e,...i})),this.init()}geometry;material;mesh;line;lineMaterial;lineGeometry;options;init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight,this.options[0].strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initGeometry(){let t=this.options.map(i=>{let r=z(i.geometry.coords[0],i.geometry.coords.slice(1));return new lo(r,{steps:1,bevelEnabled:!1,depth:i.height,curveSegments:4})}),e=fo(t);return t.forEach(i=>i.dispose()),e}initMaterial(){let t=`
|
|
45
41
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
46
42
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
47
43
|
uniform vec3 uColor;
|