@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.min.js
CHANGED
|
@@ -33,15 +33,11 @@
|
|
|
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 A.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new A.Color(this.options[0].fillColor)},uGradualColor1:{value:new A.Color(ut(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 A.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new A.Color(this.options[0].fillColor)},uGradualColor1:{value:new A.Color(ut(this.options[0].fillColor,.99))},uGradualColor2:{value:new A.Color(ut(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 A.Vector3(f[0],f[1],l)),s.push(new A.Vector3(m[0],m[1],l))}}return s}initLineGeometry(){let t=this.options.map(e=>{let i=this.getBorderPoints(e);return new A.BufferGeometry().setFromPoints(i)});this.lineGeometry=(0,Ie.mergeGeometries)(t)}createBorder(){let t=new A.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new A.Mesh(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()}};var $=y("three"),Vn=y("three/examples/jsm/utils/BufferGeometryUtils"),Hi={uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},Dt=class extends $.Object3D{constructor(t,e){super();this.context=t;this.options=e.map(i=>({...Hi,...i})),this.init()}options;mesh;async init(){let t=this.options.map(s=>{let{geometry:l}=s,u=nt(l.coords[0],l.coords.slice(1)),a=new $.ShapeGeometry(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 $.Float32BufferAttribute(f,2)),a}),e=(0,Vn.mergeGeometries)(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 $.MeshBasicMaterial({map:u,alphaTest:.5,side:$.DoubleSide})})),r=new $.Mesh(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()}};var ft=y("three");var Wi={url:"",geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},id:"",width:0,rotate:1,airHeight:1,deltaHeight:0,center_x:0,center_y:0},ae=class extends ft.Object3D{constructor(t,e){super();this.context=t;this.options=Object.assign({},Wi,e),this.loadModel()}model=null;options;async loadModel(){let t=await Xt(this.options.url);t.scene.rotation.set(Math.PI/2,0,0);let i=new ft.Box3().setFromObject(t.scene).getSize(new ft.Vector3),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 ft.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(i=>{this.meshSetMaterial(i)})}dispose(){Z(this),this.model=null}};var V=y("three");var Ne=y("three/examples/jsm/utils/BufferGeometryUtils"),Hn=y("three/examples/jsm/lines/Line2"),Wn=y("three/examples/jsm/lines/LineGeometry"),le=class extends V.Object3D{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=nt(e.geometry.coords[0].slice(0,-1),e.geometry.coords.slice(1)),r=new V.ShapeGeometry(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=(0,Ne.mergeGeometries)(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 V.Vector3(p[0],p[1],s)),r.push(new V.Vector3(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 Wn.LineGeometry,u=s.geometry.otherCoords[1].map(c=>[...c,s.airHeight+(s.deltaHeight||0)]).flat(2);l.setPositions(u);let a=new Hn.Line2(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 V.BufferGeometry().setFromPoints(i)});this.lineGeometry=(0,Ne.mergeGeometries)(t)}createBorder(){let t=new V.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new V.Mesh(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()}};var N=y("three");var Xn=y("three/examples/jsm/utils/BufferGeometryUtils"),ue=class extends N.Object3D{constructor(t,e){super();this.context=t;this.options=e.map(i=>({...Re,...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=nt(i.geometry.coords[0],i.geometry.coords.slice(1));return new N.ExtrudeGeometry(r,{steps:1,bevelEnabled:!1,depth:i.height,curveSegments:4})}),e=(0,Xn.mergeGeometries)(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;
|