2 lines
9.7 KiB
JavaScript
2 lines
9.7 KiB
JavaScript
|
define(["exports","./Transforms-d13cc04e","./ComponentDatatype-93750d1a","./when-4bbc8319","./RuntimeError-346a3079","./Matrix2-9aa31791","./GeometryAttribute-43536dc0","./GeometryAttributes-7827a6c2","./GeometryPipeline-b1a36b18","./IndexDatatype-b7d979a6","./WebMercatorProjection-58801a11"],(function(e,t,r,n,i,o,a,s,d,p,u){"use strict";function f(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 c(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 m(e){var i,a,s=e.instances,p=e.projection,u=e.elementIndexUintSupported,f=e.scene3DOnly,m=e.vertexCacheOptimize,l=e.compressVertices,h=e.modelMatrix,g=s.length;for(i=0;i<g;++i)if(n.defined(s[i].geometry)){s[i].geometry.primitiveType;break}if(function(e,t,r){var i,a=!r,s=e.length;if(!a&&s>1){var p=e[0].modelMatrix;for(i=1;i<s;++i)if(!o.Matrix4.equals(p,e[i].modelMatrix)){a=!0;break}}if(a)for(i=0;i<s;++i)n.defined(e[i].geometry)&&d.GeometryPipeline.transformToWorldCoordinates(e[i]);else o.Matrix4.multiplyTransformation(t,e[0].modelMatrix,t)}(s,h,f),!f)for(i=0;i<g;++i)n.defined(s[i].geometry)&&d.GeometryPipeline.splitLongitude(s[i]);if(function(e){for(var t=e.length,r=0;r<t;++r){var i=e[r];n.defined(i.geometry)?c(i.geometry,r):n.defined(i.westHemisphereGeometry)&&n.defined(i.eastHemisphereGeometry)&&(c(i.westHemisphereGeometry,r),c(i.eastHemisphereGeometry,r))}}(s),m)for(i=0;i<g;++i){var y=s[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(s);for(g=b.length,i=0;i<g;++i){var v,x=(a=b[i]).attributes;if(f)for(v in x)x.hasOwnProperty(v)&&x[v].componentDatatype===r.ComponentDatatype.DOUBLE&&d.GeometryPipeline.encodeAttribute(a,v,v+"3DHigh",v+"3DLow");else for(v in x)if(x.hasOwnProperty(v)&&x[v].componentDatatype===r.ComponentDatatype.DOUBLE){var G=v+"3D",S=v+"2D";d.GeometryPipeline.projectTo2D(a,v,G,S,p),n.defined(a.boundingSphere)&&"position"===v&&(a.boundingSphereCV=t.BoundingSphere.fromVertices(a.attributes.position2D.values)),d.GeometryPipeline.encodeAttribute(a,G,G+"High",G+"Low"),d.GeometryPipeline.encodeAttribute(a,S,S+"High",S+"Low")}l&&d.GeometryPipeline.compressVertices(a)}if(!u){var P=[];for(g=b.length,i=0;i<g;++i)a=b[i],P=P.concat(d.GeometryPipeline.fitToUnsignedShortIndices(a));b=P}return b}function l(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(f.prototype,{componentDatatype:{get:function(){return r.ComponentDatatype.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}}),f.fromCartesian3=function(e){return new f(e.x,e.y,e.z)},f.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 h={};function g(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 y(e,t){var r=e.length,i=new Float64Array(1+19*r),a=0;i[a++]=r;for(var s=0;s<r;s++){var d=e[s];if(o.Matrix4.pack(d.modelMatrix,i,a),a+=o.Matrix4.packedLength,n.defined(d.attributes)&&n.defined(d.attributes.offset)){var p=d.attributes.offset.value;i[a]=p[0],i[
|