qd-changjing/public/static/Build/CesiumUnminified/Workers/createRectangleGeometry.js.map

1 line
94 KiB
Plaintext
Raw Normal View History

2022-07-05 16:56:29 +08:00
{"version":3,"file":"createRectangleGeometry.js","sources":["../../../../Source/Core/RectangleGeometry.js","../../../../Source/WorkersES6/createRectangleGeometry.js"],"sourcesContent":["import arrayFill from \"./arrayFill.js\";\nimport BoundingSphere from \"./BoundingSphere.js\";\nimport Cartesian2 from \"./Cartesian2.js\";\nimport Cartesian3 from \"./Cartesian3.js\";\nimport Cartographic from \"./Cartographic.js\";\nimport Check from \"./Check.js\";\nimport ComponentDatatype from \"./ComponentDatatype.js\";\nimport defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\nimport DeveloperError from \"./DeveloperError.js\";\nimport Ellipsoid from \"./Ellipsoid.js\";\nimport Geometry from \"./Geometry.js\";\nimport GeometryAttribute from \"./GeometryAttribute.js\";\nimport GeometryAttributes from \"./GeometryAttributes.js\";\nimport GeometryInstance from \"./GeometryInstance.js\";\nimport GeometryOffsetAttribute from \"./GeometryOffsetAttribute.js\";\nimport GeometryPipeline from \"./GeometryPipeline.js\";\nimport IndexDatatype from \"./IndexDatatype.js\";\nimport CesiumMath from \"./Math.js\";\nimport Matrix2 from \"./Matrix2.js\";\nimport Matrix3 from \"./Matrix3.js\";\nimport PolygonPipeline from \"./PolygonPipeline.js\";\nimport PrimitiveType from \"./PrimitiveType.js\";\nimport Quaternion from \"./Quaternion.js\";\nimport Rectangle from \"./Rectangle.js\";\nimport RectangleGeometryLibrary from \"./RectangleGeometryLibrary.js\";\nimport VertexFormat from \"./VertexFormat.js\";\n\nconst positionScratch = new Cartesian3();\nconst normalScratch = new Cartesian3();\nconst tangentScratch = new Cartesian3();\nconst bitangentScratch = new Cartesian3();\nconst rectangleScratch = new Rectangle();\nconst stScratch = new Cartesian2();\nconst bottomBoundingSphere = new BoundingSphere();\nconst topBoundingSphere = new BoundingSphere();\n\nfunction createAttributes(vertexFormat, attributes) {\n const geo = new Geometry({\n attributes: new GeometryAttributes(),\n primitiveType: PrimitiveType.TRIANGLES,\n });\n\n geo.attributes.position = new GeometryAttribute({\n componentDatatype: ComponentDatatype.DOUBLE,\n componentsPerAttribute: 3,\n values: attributes.positions,\n });\n if (vertexFormat.normal) {\n geo.attributes.normal = new GeometryAttribute({\n componentDatatype: ComponentDatatype.FLOAT,\n componentsPerAttribute: 3,\n values: attributes.normals,\n });\n }\n if (vertexFormat.tangent) {\n geo.attributes.tangent = new GeometryAttribute({\n componentDatatype: ComponentDatatype.FLOAT,\n componentsPerAttribute: 3,\n values: attributes.tangents,\n });\n }\n if (vertexFormat.bitangent) {\n geo.attributes.bitangent = new GeometryAttribute({\n componentDatatype: ComponentDatatype.FLOAT,\n componentsPerAttribute: 3,\n values: attributes.bitangents,\n });\n }\n return geo;\n}\n\nfunction calculateAttributes(\n positions,\n vertexFormat,\n ellipsoid,\n tangentRotationMatrix\n) {\n const length = positions.length;\n\n const normals = vertexFormat.normal ? new Float32Array(length) : undefined;\n const tangents = vertexFormat.tangent ? new Float32Array(length) : undefined;\n const bitangents = vertexFormat.bitangent\n ? new Float32Array(length)\n : undefined;\n\n let attrIndex = 0;\n const bitangent = bitangentScratch;\n const tangent = tangentScratch;\n let normal = normalScratch;\n if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {\n for (let i = 0; i < length; i += 3) {\n const p = Cartesian3.fromArray(positions, i, positionScratch);\n const attrIndex1 = attrIndex + 1;\n const attrIndex2 = attrIndex + 2;\n\n normal = ellipsoid.geodeticSurfaceNormal(p, normal);\n if (vertexFormat.tangent || vertexFormat.bitangent) {\n Cartesian3.cross(Cartesian3.UNIT_Z, normal, tangent);\n Matrix3.multiplyByVector(tangentRotationMatrix, tangent, tangent);\n Cartesian3.normalize(tangent, tangent);\n\n if (vertexFormat.bitangent) {\n Cart