2 lines
9.9 KiB
JavaScript
2 lines
9.9 KiB
JavaScript
|
/* 2020-9-22 15:23:25 | 版权所有 军懋国兴 */
|
||
|
define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./ComponentDatatype-607c9a0c","./GeometryAttribute-2303bbfb","./GeometryAttributes-90846c5f","./GeometryPipeline-1ea64cde","./IndexDatatype-79bb407c","./WebMercatorProjection-3da37aae"],function(e,v,G,u,P,k,C,w,x,A,c){"use strict";function m(e,t,r){e=v.defaultValue(e,0),t=v.defaultValue(t,0),r=v.defaultValue(r,0),this.value=new Float32Array([e,t,r])}function S(e,t){var r=e.attributes,n=r.position,i=n.values.length/n.componentsPerAttribute;r.batchId=new C.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:1,values:new Float32Array(i)});for(var o=r.batchId.values,a=0;a<i;++a)o[a]=t}function b(e){var t,r,n=e.instances,i=e.projection,o=e.elementIndexUintSupported,a=e.scene3DOnly,s=e.vertexCacheOptimize,d=e.compressVertices,p=e.modelMatrix,f=n.length;for(b=0;b<f;++b)if(v.defined(n[b].geometry)){r=n[b].geometry.primitiveType;break}for(b=1;b<f;++b)if(v.defined(n[b].geometry)&&n[b].geometry.primitiveType!==r)throw new G.DeveloperError("All instance geometries must have the same primitiveType.");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)v.defined(e[a].geometry)&&x.GeometryPipeline.transformToWorldCoordinates(e[a]);else P.Matrix4.multiplyTransformation(t,e[0].modelMatrix,t)}(n,p,a),!a)for(b=0;b<f;++b)v.defined(n[b].geometry)&&x.GeometryPipeline.splitLongitude(n[b]);if(!function(e){for(var t=e.length,r=0;r<t;++r){var n=e[r];v.defined(n.geometry)?S(n.geometry,r):v.defined(n.westHemisphereGeometry)&&v.defined(n.eastHemisphereGeometry)&&(S(n.westHemisphereGeometry,r),S(n.eastHemisphereGeometry,r))}}(n),s)for(b=0;b<f;++b){var u=n[b];v.defined(u.geometry)?(x.GeometryPipeline.reorderForPostVertexCache(u.geometry),x.GeometryPipeline.reorderForPreVertexCache(u.geometry)):v.defined(u.westHemisphereGeometry)&&v.defined(u.eastHemisphereGeometry)&&(x.GeometryPipeline.reorderForPostVertexCache(u.westHemisphereGeometry),x.GeometryPipeline.reorderForPreVertexCache(u.westHemisphereGeometry),x.GeometryPipeline.reorderForPostVertexCache(u.eastHemisphereGeometry),x.GeometryPipeline.reorderForPreVertexCache(u.eastHemisphereGeometry))}var c=x.GeometryPipeline.combineInstances(n);for(f=c.length,b=0;b<f;++b){var m,h,l,g=(t=c[b]).attributes;if(a)for(m in g)g.hasOwnProperty(m)&&g[m].componentDatatype===k.ComponentDatatype.DOUBLE&&x.GeometryPipeline.encodeAttribute(t,m,m+"3DHigh",m+"3DLow");else for(m in g){g.hasOwnProperty(m)&&g[m].componentDatatype===k.ComponentDatatype.DOUBLE&&(h=m+"3D",l=m+"2D",x.GeometryPipeline.projectTo2D(t,m,h,l,i),v.defined(t.boundingSphere)&&"position"===m&&(t.boundingSphereCV=P.BoundingSphere.fromVertices(t.attributes.position2D.values)),x.GeometryPipeline.encodeAttribute(t,h,h+"High",h+"Low"),x.GeometryPipeline.encodeAttribute(t,l,l+"High",l+"Low"))}d&&x.GeometryPipeline.compressVertices(t)}if(!o){for(var y=[],f=c.length,b=0;b<f;++b)t=c[b],y=y.concat(x.GeometryPipeline.fitToUnsignedShortIndices(t));c=y}return c}function V(e,t,r,n){var i,o,a,s,d=n.length-1;s=0<=d?(o=(i=n[d]).offset+i.count,r[a=i.index].indices.length):r[a=o=0].indices.length;for(var p=e.length,f=0;f<p;++f){var u,c=e[f][t];v.defined(c)&&(s<o+(u=c.indices.length)&&(o=0,s=r[++a].indices.length),n.push({index:a,offset:o,count:u}),o+=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 G.Check.defined("offset",e),new m(e.x,e.y,e.z)},m.toValue=function(e,t){return G.Check.defined("offset",e),v.defined(t)||(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],v.defined(n)&&v.defined(n.values)&&t.push(n.values.buffer))}v.defined(e.indices)&&t.push(e.indices.buffer)}(e[n],t)}function o(e){var
|