锦水三维代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
9.5 KiB

2 years ago
define(["exports","./Transforms-a73b3b3b","./ComponentDatatype-9204e9f6","./when-208fe5b0","./Check-d18af7c4","./Cartesian2-8417ca3d","./GeometryAttribute-04a19cfe","./GeometryAttributes-b0b294d8","./GeometryPipeline-5e672526","./IndexDatatype-d47ad6f6","./WebMercatorProjection-ffb6b9f8"],function(e,P,k,y,t,f,C,w,b,A,c){"use strict";function m(e,t,r){e=y.defaultValue(e,0),t=y.defaultValue(t,0),r=y.defaultValue(r,0),this.value=new Float32Array([e,t,r])}function v(e,t){var r=e.attributes,e=r.position,n=e.values.length/e.componentsPerAttribute;r.batchId=new C.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:1,values:new Float32Array(n)});for(var i=r.batchId.values,o=0;o<n;++o)i[o]=t}function l(e){var t=e.instances,r=e.projection,n=e.elementIndexUintSupported,i=e.scene3DOnly,o=e.vertexCacheOptimize,a=e.compressVertices,e=e.modelMatrix,s=t.length;for(g=0;g<s;++g)if(y.defined(t[g].geometry)){t[g].geometry.primitiveType;break}if(!function(e,t,r){var n=!r,i=e.length;if(!n&&1<i)for(var o=e[0].modelMatrix,a=1;a<i;++a)if(!P.Matrix4.equals(o,e[a].modelMatrix)){n=!0;break}if(n)for(a=0;a<i;++a)y.defined(e[a].geometry)&&b.GeometryPipeline.transformToWorldCoordinates(e[a]);else P.Matrix4.multiplyTransformation(t,e[0].modelMatrix,t)}(t,e,i),!i)for(g=0;g<s;++g)y.defined(t[g].geometry)&&b.GeometryPipeline.splitLongitude(t[g]);if(!function(e){for(var t=e.length,r=0;r<t;++r){var n=e[r];y.defined(n.geometry)?v(n.geometry,r):y.defined(n.westHemisphereGeometry)&&y.defined(n.eastHemisphereGeometry)&&(v(n.westHemisphereGeometry,r),v(n.eastHemisphereGeometry,r))}}(t),o)for(g=0;g<s;++g){var d=t[g];y.defined(d.geometry)?(b.GeometryPipeline.reorderForPostVertexCache(d.geometry),b.GeometryPipeline.reorderForPreVertexCache(d.geometry)):y.defined(d.westHemisphereGeometry)&&y.defined(d.eastHemisphereGeometry)&&(b.GeometryPipeline.reorderForPostVertexCache(d.westHemisphereGeometry),b.GeometryPipeline.reorderForPreVertexCache(d.westHemisphereGeometry),b.GeometryPipeline.reorderForPostVertexCache(d.eastHemisphereGeometry),b.GeometryPipeline.reorderForPreVertexCache(d.eastHemisphereGeometry))}var p=b.GeometryPipeline.combineInstances(t);for(s=p.length,g=0;g<s;++g){var u,f,c,m,h=(u=p[g]).attributes;if(i)for(f in h)h.hasOwnProperty(f)&&h[f].componentDatatype===k.ComponentDatatype.DOUBLE&&b.GeometryPipeline.encodeAttribute(u,f,f+"3DHigh",f+"3DLow");else for(f in h)h.hasOwnProperty(f)&&h[f].componentDatatype===k.ComponentDatatype.DOUBLE&&(b.GeometryPipeline.projectTo2D(u,f,c=f+"3D",m=f+"2D",r),y.defined(u.boundingSphere)&&"position"===f&&(u.boundingSphereCV=P.BoundingSphere.fromVertices(u.attributes.position2D.values)),b.GeometryPipeline.encodeAttribute(u,c,c+"High",c+"Low"),b.GeometryPipeline.encodeAttribute(u,m,m+"High",m+"Low"));a&&b.GeometryPipeline.compressVertices(u)}if(!n){for(var l=[],s=p.length,g=0;g<s;++g)u=p[g],l=l.concat(b.GeometryPipeline.fitToUnsignedShortIndices(u));p=l}return p}function g(e,t,r,n){var i,o,a,s=n.length-1;a=0<=s?(i=(s=n[s]).offset+s.count,r[o=s.index].indices.length):r[o=i=0].indices.length;for(var d=e.length,p=0;p<d;++p){var u=e[p][t];y.defined(u)&&(a<i+(u=u.indices.length)&&(i=0,a=r[++o].indices.length),n.push({index:o,offset:i,count:u}),i+=u)}}Object.defineProperties(m.prototype,{componentDatatype:{get:function(){return k.ComponentDatatype.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}}),m.fromCartesian3=function(e){return new m(e.x,e.y,e.z)},m.toValue=function(e,t){return(t=!y.defined(t)?new Float32Array([e.x,e.y,e.z]):t)[0]=e.x,t[1]=e.y,t[2]=e.z,t};var h={};function i(e,t){for(var r=e.length,n=0;n<r;++n)!function(e,t){var r,n,i=e.attributes;for(r in i)i.hasOwnProperty(r)&&(n=i[r],y.defined(n)&&y.defined(n.values)&&t.push(n.values.buffer));y.defined(e.indices)&&t.push(e.indices.buffer)}(e[n],t)}function o(e){var t=e.length,r=1+(P.BoundingSphere.packedLength+1)*t,n=new Float32Array(r),i=0;n[i++]=t;for(var o=0;o<t;++o){var a=e[o];y.defined(a)?(n[i++]=1,P.BoundingSphere.pack(e[o],n,i)):n[i++]=0,i+=P.BoundingSphere.packedLength}return n}function r