2 lines
9.8 KiB
JavaScript
2 lines
9.8 KiB
JavaScript
|
define(["exports","./buildModuleUrl-4e1b81e7","./ComponentDatatype-c140a87d","./when-b60132fc","./Check-7b2a090c","./Cartesian2-47311507","./GeometryAttribute-3a88ba31","./GeometryAttributes-252e9929","./GeometryPipeline-9d1ef0b6","./IndexDatatype-8a5eead4","./PrimitiveType-a54dc62f","./WebMercatorProjection-01b1b5e7"],(function(e,t,r,n,i,o,a,s,d,p,u,f){"use strict";function c(e,t,r){e=n.defaultValue(e,0),t=n.defaultValue(t,0),r=n.defaultValue(r,0),this.value=new Float32Array([e,t,r])}function m(e,t){var n=e.attributes,i=n.position,o=i.values.length/i.componentsPerAttribute;n.batchId=new a.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:1,values:new Float32Array(o)});for(var s=n.batchId.values,d=0;d<o;++d)s[d]=t}function l(e){var i,o,a=e.instances,s=e.projection,p=e.elementIndexUintSupported,f=e.scene3DOnly,c=e.vertexCacheOptimize,l=e.compressVertices,h=e.modelMatrix,g=a.length;for(i=0;i<g;++i)if(n.defined(a[i].geometry)){a[i].geometry.primitiveType;break}if(function(e,t,r){var i,o=!r,a=e.length;if(!o&&a>1){var s=e[0].modelMatrix;for(i=1;i<a;++i)if(!u.Matrix4.equals(s,e[i].modelMatrix)){o=!0;break}}if(o)for(i=0;i<a;++i)n.defined(e[i].geometry)&&d.GeometryPipeline.transformToWorldCoordinates(e[i]);else u.Matrix4.multiplyTransformation(t,e[0].modelMatrix,t)}(a,h,f),!f)for(i=0;i<g;++i)n.defined(a[i].geometry)&&d.GeometryPipeline.splitLongitude(a[i]);if(function(e){for(var t=e.length,r=0;r<t;++r){var i=e[r];n.defined(i.geometry)?m(i.geometry,r):n.defined(i.westHemisphereGeometry)&&n.defined(i.eastHemisphereGeometry)&&(m(i.westHemisphereGeometry,r),m(i.eastHemisphereGeometry,r))}}(a),c)for(i=0;i<g;++i){var y=a[i];n.defined(y.geometry)?(d.GeometryPipeline.reorderForPostVertexCache(y.geometry),d.GeometryPipeline.reorderForPreVertexCache(y.geometry)):n.defined(y.westHemisphereGeometry)&&n.defined(y.eastHemisphereGeometry)&&(d.GeometryPipeline.reorderForPostVertexCache(y.westHemisphereGeometry),d.GeometryPipeline.reorderForPreVertexCache(y.westHemisphereGeometry),d.GeometryPipeline.reorderForPostVertexCache(y.eastHemisphereGeometry),d.GeometryPipeline.reorderForPreVertexCache(y.eastHemisphereGeometry))}var b=d.GeometryPipeline.combineInstances(a);for(g=b.length,i=0;i<g;++i){var v,G=(o=b[i]).attributes;if(f)for(v in G)G.hasOwnProperty(v)&&G[v].componentDatatype===r.ComponentDatatype.DOUBLE&&d.GeometryPipeline.encodeAttribute(o,v,v+"3DHigh",v+"3DLow");else for(v in G)if(G.hasOwnProperty(v)&&G[v].componentDatatype===r.ComponentDatatype.DOUBLE){var x=v+"3D",S=v+"2D";d.GeometryPipeline.projectTo2D(o,v,x,S,s),n.defined(o.boundingSphere)&&"position"===v&&(o.boundingSphereCV=t.BoundingSphere.fromVertices(o.attributes.position2D.values)),d.GeometryPipeline.encodeAttribute(o,x,x+"High",x+"Low"),d.GeometryPipeline.encodeAttribute(o,S,S+"High",S+"Low")}l&&d.GeometryPipeline.compressVertices(o)}if(!p){var P=[];for(g=b.length,i=0;i<g;++i)o=b[i],P=P.concat(d.GeometryPipeline.fitToUnsignedShortIndices(o));b=P}return b}function h(e,t,r,i){var o,a,s,d=i.length-1;if(d>=0){var p=i[d];o=p.offset+p.count,a=r[s=p.index].indices.length}else o=0,a=r[s=0].indices.length;for(var u=e.length,f=0;f<u;++f){var c=e[f][t];if(n.defined(c)){var m=c.indices.length;o+m>a&&(o=0,a=r[++s].indices.length),i.push({index:s,offset:o,count:m}),o+=m}}}Object.defineProperties(c.prototype,{componentDatatype:{get:function(){return r.ComponentDatatype.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}}),c.fromCartesian3=function(e){return new c(e.x,e.y,e.z)},c.toValue=function(e,t){return n.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 g={};function y(e,t){var r=e.attributes;for(var i in r)if(r.hasOwnProperty(i)){var o=r[i];n.defined(o)&&n.defined(o.values)&&t.push(o.values.buffer)}n.defined(e.indices)&&t.push(e.indices.buffer)}function b(e,t){var r=e.length,i=new Float64Array(1+19*r),o=0;i[o++]=r;for(var a=0;a<r;a++){var s=e[a];if(u.Matrix4.pack(s.modelMatrix,i,o),o+=u.Matrix4.packedLength,n.defined(s.attributes)&&n.defined(s.attributes.offset)){var d=s.attribu
|