qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/GetRidingLanternGeometry.js

2 lines
2.4 KiB
JavaScript
Raw Permalink Normal View History

2023-12-17 15:30:40 +08:00
define(["./Color-82ef4a75","./GeometryInstance-1b39c9e8","./GeometryAttribute-2b42a913","./ComponentDatatype-aaeec80f","./Cartesian2-bd414876","./BoundingSphere-9a3b5656","./Check-741c5f3c","./defaultValue-81eec7ed","./Transforms-5b829630","./when-422ea0ae","./Cartesian3-e0307675","./Math-e73894ab","./Matrix4-4c545f70","./RuntimeError-26acdd3b","./Resource-8ae1a924","./combine-3c023bda","./Matrix2-dc0c61cc","./WebGLConstants-508b9636","./Rectangle-cf3e0e3e","./GeographicProjection-c931c7fb"],(function(t,e,s,i,o,r,n,a,h,c,p,u,l,m,y,d,b,g,f,A){"use strict";return class{constructor(e){this.positions=null,this.normals=null,this.sts=null,this.indices=null,this.geometrys=e.positions,this.color=e.color,this.u_tcolor=e.u_tcolor||t.Color.YELLOW,this.height=e.height||500,this.speed=e.speed||600,this.direction=e.direction||-1,this.translucent=e.translucent||!1,this.type=e.type||1}createGeometryInstances(){let t=[];for(let s=0;s<this.geometrys.length;s++){let i=this.geometrys[s],o=this.computePositions_dws(i,this.height);this.positions=o.pos,this.normals=o.normals,this.sts=o.sts,this.indices=o.indices;let r=this.createGeometry(this.positions,this.normals,this.sts,this.indices),n=new e.GeometryInstance({id:Math.random(),geometry:r});t.push(n)}return t}createGeometry(t,e,o,n){let a=new Float64Array(t),h=new Float32Array(e),c=new Float32Array(o),p=new Uint16Array(n);return new s.Geometry({attributes:{position:new s.GeometryAttribute({componentDatatype:i.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:a}),normal:new s.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:h}),st:new s.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:c})},indices:p,primitiveType:s.PrimitiveType.TRIANGLES,boundingSphere:r.BoundingSphere.fromVertices(a)})}computePositions_dws(t,e){let s=t.length,i=[];for(let s in t)i.push(this.addHeight(t[s],e));let o=[],r=[],n=[],a=[];for(let e=0;e<s-1;e++){let s=e+1;o.push(t[e].x,t[e].y,t[e].z),o.push(t[s].x,t[s].y,t[s].z),o.push(i[s].x,i[s].y,i[s].z),o.push(i[e].x,i[e].y,i[e].z),a.push(0,0,1),a.push(0,0,1),a.push(0,0,1),a.push(0,0,1),r.push(0,0,1,0,1,1,0,1);let h=4*e,c=h+1,p=h+2,u=h+3;n.push(h,c,p,p,u,h)}return{pos:o,normals:a,sts:r,indices:n}}addHeight(t,e){let s=e||0;if(t.hasOwnProperty("height"))return t.height+=s,t;{let e=o.Cartographic.fromCartesian(t);return e.height+=s,o.Cartographic.toCartesian(e)}}}}));