YZProjectCloud/yanzhu-ui-vue3/public/Engine/Workers/PrimitivePipeline-74f1bf27.js

2 lines
12 KiB
JavaScript
Raw Normal View History

2025-04-07 00:55:58 +08:00
define(["exports","./Transforms-98ffa11d","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./Check-741c5f3c","./Matrix2-e3fb4559","./GeometryAttribute-b025f9a8","./GeometryAttributes-32b29525","./GeometryPipeline-4b426993","./IndexDatatype-f1e3f799","./Matrix4-d34187af","./WebMercatorProjection-f5706bbf","./Cartesian3-7e9cc2ff"],(function(e,t,n,r,o,i,s,a,d,c,p,f,u){"use strict";function m(e,t,n){e=r.defaultValue(e,0),t=r.defaultValue(t,0),n=r.defaultValue(n,0),this.value=new Float32Array([e,t,n])}function l(e,t,n){let o=!n;const i=e.length;let s;if(!o&&i>1){const t=e[0].modelMatrix;for(s=1;s<i;++s)if(!p.Matrix4.equals(t,e[s].modelMatrix)){o=!0;break}}if(o)for(s=0;s<i;++s)r.defined(e[s].geometry)&&d.GeometryPipeline.transformToWorldCoordinates(e[s]);else p.Matrix4.multiplyTransformation(t,e[0].modelMatrix,t)}function h(e,t){const r=e.attributes,o=r.position,i=o.values.length/o.componentsPerAttribute;r.batchId=new s.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:1,values:new Float32Array(i)});const a=r.batchId.values;for(let e=0;e<i;++e)a[e]=t}function g(e){const t=e.length;for(let n=0;n<t;++n){const t=e[n];r.defined(t.geometry)?h(t.geometry,n):r.defined(t.westHemisphereGeometry)&&r.defined(t.eastHemisphereGeometry)&&(h(t.westHemisphereGeometry,n),h(t.eastHemisphereGeometry,n))}}function y(e,t,n,o){let i,s,a;const d=o.length-1;if(d>=0){const e=o[d];i=e.offset+e.count,a=e.index,s=n[a].indices.length}else i=0,a=0,s=n[a].indices.length;const c=e.length;for(let d=0;d<c;++d){const c=e[d][t];if(!r.defined(c))continue;const p=c.indices.length;i+p>s&&(i=0,s=n[++a].indices.length),o.push({index:a,offset:i,count:p}),i+=p}}function b(e,t){const n=[];return y(e,"geometry",t,n),y(e,"westHemisphereGeometry",t,n),y(e,"eastHemisphereGeometry",t,n),n}Object.defineProperties(m.prototype,{componentDatatype:{get:function(){return n.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 r.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 x={};function P(e,t){const n=e.attributes;for(const e in n)if(n.hasOwnProperty(e)){const o=n[e];r.defined(o)&&r.defined(o.values)&&t.push(o.values.buffer)}r.defined(e.indices)&&t.push(e.indices.buffer)}function G(e,t){const n=e.length,o=new Float64Array(1+19*n);let i=0;o[i++]=n;for(let t=0;t<n;t++){const n=e[t];if(p.Matrix4.pack(n.modelMatrix,o,i),i+=p.Matrix4.packedLength,r.defined(n.attributes)&&r.defined(n.attributes.offset)){const e=n.attributes.offset.value;o[i]=e[0],o[i+1]=e[1],o[i+2]=e[2]}i+=3}return t.push(o.buffer),o}function S(e){const n=e.length,o=1+(t.BoundingSphere.packedLength+1)*n,i=new Float32Array(o);let s=0;i[s++]=n;for(let o=0;o<n;++o){const n=e[o];r.defined(n)?(i[s++]=1,t.BoundingSphere.pack(e[o],i,s)):i[s++]=0,s+=t.BoundingSphere.packedLength}return i}function C(e){const n=new Array(e[0]);let r=0,o=1;for(;o<e.length;)1===e[o++]&&(n[r]=t.BoundingSphere.unpack(e,o)),++r,o+=t.BoundingSphere.packedLength;return n}x.combineGeometry=function(e){let o,i;const s=e.instances,a=s.length;let c,p,f=!1;a>0&&(o=function(e){const o=e.instances,i=e.projection,s=e.elementIndexUintSupported,a=e.scene3DOnly,c=e.vertexCacheOptimize,p=e.compressVertices,f=e.modelMatrix;var u=e.isfromGLP;let m,h,y=o.length;for(m=0;m<y;++m)if(r.defined(o[m].geometry)){o[m].geometry.primitiveType;break}if(l(o,f,a),!a)for(m=0;m<y;++m)r.defined(o[m].geometry)&&d.GeometryPipeline.splitLongitude(o[m]);if(g(o),c)for(m=0;m<y;++m){const e=o[m];r.defined(e.geometry)?(d.GeometryPipeline.reorderForPostVertexCache(e.geometry),d.GeometryPipeline.reorderForPreVertexCache(e.geometry)):r.defined(e.westHemisphereGeometry)&&r.defined(e.eastHemisphereGeometry)&&(d.GeometryPipeline.reorderForPostVertexCache(e.westHemisphereGeometry),d.GeometryPipeline.reorderForPreVertexCache(e.westHemisphereGeometry),d.GeometryPipeline.reorderForPostVertexCache(e.eastHemisphereGeometry),d.GeometryPipeline.reorderForPreVertexCache(e.eastHe