2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
|
define(["exports","./BoundingSphere-9a3b5656","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./Check-741c5f3c","./Cartesian2-bd414876","./GeographicProjection-c931c7fb","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./GeometryPipeline-e7083fea","./IndexDatatype-3f3c99e8","./Matrix4-4c545f70","./WebMercatorProjection-44373a3d"],(function(e,t,n,o,r,i,s,c,a,d,p,u,f){"use strict";function l(e,t,n){e=o.defaultValue(e,0),t=o.defaultValue(t,0),n=o.defaultValue(n,0),this.value=new Float32Array([e,t,n])}function m(e,t){const o=e.attributes,r=o.position,i=r.values.length/r.componentsPerAttribute;o.batchId=new c.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:1,values:new Float32Array(i)});const s=o.batchId.values;for(let e=0;e<i;++e)s[e]=t}function h(e){const r=e.instances,i=e.projection,s=e.elementIndexUintSupported,c=e.scene3DOnly,a=e.vertexCacheOptimize,p=e.compressVertices,f=e.modelMatrix;let l,h,g=r.length;for(l=0;l<g;++l)if(o.defined(r[l].geometry)){r[l].geometry.primitiveType;break}if(function(e,t,n){let r=!n;const i=e.length;let s;if(!r&&i>1){const t=e[0].modelMatrix;for(s=1;s<i;++s)if(!u.Matrix4.equals(t,e[s].modelMatrix)){r=!0;break}}if(r)for(s=0;s<i;++s)o.defined(e[s].geometry)&&d.GeometryPipeline.transformToWorldCoordinates(e[s]);else u.Matrix4.multiplyTransformation(t,e[0].modelMatrix,t)}(r,f,c),!c)for(l=0;l<g;++l)o.defined(r[l].geometry)&&d.GeometryPipeline.splitLongitude(r[l]);if(function(e){const t=e.length;for(let n=0;n<t;++n){const t=e[n];o.defined(t.geometry)?m(t.geometry,n):o.defined(t.westHemisphereGeometry)&&o.defined(t.eastHemisphereGeometry)&&(m(t.westHemisphereGeometry,n),m(t.eastHemisphereGeometry,n))}}(r),a)for(l=0;l<g;++l){const e=r[l];o.defined(e.geometry)?(d.GeometryPipeline.reorderForPostVertexCache(e.geometry),d.GeometryPipeline.reorderForPreVertexCache(e.geometry)):o.defined(e.westHemisphereGeometry)&&o.defined(e.eastHemisphereGeometry)&&(d.GeometryPipeline.reorderForPostVertexCache(e.westHemisphereGeometry),d.GeometryPipeline.reorderForPreVertexCache(e.westHemisphereGeometry),d.GeometryPipeline.reorderForPostVertexCache(e.eastHemisphereGeometry),d.GeometryPipeline.reorderForPreVertexCache(e.eastHemisphereGeometry))}let y=d.GeometryPipeline.combineInstances(r);for(g=y.length,l=0;l<g;++l){h=y[l];const e=h.attributes;if(c)for(const t in e)e.hasOwnProperty(t)&&e[t].componentDatatype===n.ComponentDatatype.DOUBLE&&d.GeometryPipeline.encodeAttribute(h,t,`${t}3DHigh`,`${t}3DLow`);else for(const r in e)if(e.hasOwnProperty(r)&&e[r].componentDatatype===n.ComponentDatatype.DOUBLE){const e=`${r}3D`,n=`${r}2D`;d.GeometryPipeline.projectTo2D(h,r,e,n,i),o.defined(h.boundingSphere)&&"position"===r&&(h.boundingSphereCV=t.BoundingSphere.fromVertices(h.attributes.position2D.values)),d.GeometryPipeline.encodeAttribute(h,e,`${e}High`,`${e}Low`),d.GeometryPipeline.encodeAttribute(h,n,`${n}High`,`${n}Low`)}p&&d.GeometryPipeline.compressVertices(h)}if(!s){let e=[];for(g=y.length,l=0;l<g;++l)h=y[l],e=e.concat(d.GeometryPipeline.fitToUnsignedShortIndices(h));y=e}return y}function g(e,t,n,r){let i,s,c;const a=r.length-1;if(a>=0){const e=r[a];i=e.offset+e.count,c=e.index,s=n[c].indices.length}else i=0,c=0,s=n[c].indices.length;const d=e.length;for(let a=0;a<d;++a){const d=e[a][t];if(!o.defined(d))continue;const p=d.indices.length;i+p>s&&(i=0,s=n[++c].indices.length),r.push({index:c,offset:i,count:p}),i+=p}}Object.defineProperties(l.prototype,{componentDatatype:{get:function(){return n.ComponentDatatype.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}}),l.fromCartesian3=function(e){return new l(e.x,e.y,e.z)},l.toValue=function(e,t){return o.defined(t)||(t=new Float32Array([e.x,e.y,e.z])),t[0]=e.x,t[1]=e.y,t[2]=e.z,t};const y={};function b(e,t){const n=e.attributes;for(const e in n)if(n.hasOwnProperty(e)){const r=n[e];o.defined(r)&&o.defined(r.values)&&t.push(r.values.buffer)}o.defined(e.indices)&&t.push(e.indices.buffer)}function G(e,t){const n=e.length,r=new Float64Array(1+19*n);let i=0;r[i++]=n;for(let t=0;t<n;t++
|