bmh_cesium/public/lib/cesiumjs/CesiumUnminified/Workers/createPlaneGeometry.js

2 lines
2.6 KiB
JavaScript
Raw Normal View History

2025-03-09 23:23:50 +00:00
/* 2020-9-22 15:23:25 | 版权所有 军懋国兴 */
define(["./when-cbf8cd21","./Check-35e1a91d","./Math-69007a69","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./RuntimeError-f4c64df1","./WebGLConstants-95ceb4e9","./ComponentDatatype-607c9a0c","./GeometryAttribute-2303bbfb","./GeometryAttributes-90846c5f","./VertexFormat-fe64931e"],function(n,o,e,c,p,t,r,y,s,b,i){"use strict";function m(e){e=n.defaultValue(e,n.defaultValue.EMPTY_OBJECT);var t=n.defaultValue(e.vertexFormat,i.VertexFormat.DEFAULT);this._vertexFormat=t,this._workerName="createPlaneGeometry"}m.packedLength=i.VertexFormat.packedLength,m.pack=function(e,t,r){return o.Check.typeOf.object("value",e),o.Check.defined("array",t),r=n.defaultValue(r,0),i.VertexFormat.pack(e._vertexFormat,t,r),t};var u=new i.VertexFormat,l={vertexFormat:u};m.unpack=function(e,t,r){o.Check.defined("array",e),t=n.defaultValue(t,0);var a=i.VertexFormat.unpack(e,t,u);return n.defined(r)?(r._vertexFormat=i.VertexFormat.clone(a,r._vertexFormat),r):new m(l)};var A=new c.Cartesian3(-.5,-.5,0),f=new c.Cartesian3(.5,.5,0);return m.createGeometry=function(e){var t,r,a,n,o,i,m=e._vertexFormat,u=new b.GeometryAttributes;return m.position&&((i=new Float64Array(12))[0]=A.x,i[1]=A.y,i[2]=0,i[3]=f.x,i[4]=A.y,i[5]=0,i[6]=f.x,i[7]=f.y,i[8]=0,i[9]=A.x,i[10]=f.y,i[11]=0,u.position=new s.GeometryAttribute({componentDatatype:y.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:i}),m.normal&&((r=new Float32Array(12))[0]=0,r[1]=0,r[2]=1,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=1,r[9]=0,r[10]=0,r[11]=1,u.normal=new s.GeometryAttribute({componentDatatype:y.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:r})),m.st&&((a=new Float32Array(8))[0]=0,a[1]=0,a[2]=1,a[3]=0,a[4]=1,a[5]=1,a[6]=0,a[7]=1,u.st=new s.GeometryAttribute({componentDatatype:y.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:a})),m.tangent&&((n=new Float32Array(12))[0]=1,n[1]=0,n[2]=0,n[3]=1,n[4]=0,n[5]=0,n[6]=1,n[7]=0,n[8]=0,n[9]=1,n[10]=0,n[11]=0,u.tangent=new s.GeometryAttribute({componentDatatype:y.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:n})),m.bitangent&&((o=new Float32Array(12))[0]=0,o[1]=1,o[2]=0,o[3]=0,o[4]=1,o[5]=0,o[6]=0,o[7]=1,o[8]=0,o[9]=0,o[10]=1,o[11]=0,u.bitangent=new s.GeometryAttribute({componentDatatype:y.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:o})),(t=new Uint16Array(6))[0]=0,t[1]=1,t[2]=2,t[3]=0,t[4]=2,t[5]=3),new s.Geometry({attributes:u,indices:t,primitiveType:s.PrimitiveType.TRIANGLES,boundingSphere:new p.BoundingSphere(c.Cartesian3.ZERO,Math.sqrt(2))})},function(e,t){return n.defined(t)&&(e=m.unpack(e,t)),m.createGeometry(e)}});