1 line
27 KiB
Plaintext
1 line
27 KiB
Plaintext
|
{"version":3,"file":"createPolylineVolumeGeometry.js","sources":["../../../../Source/Core/PolylineVolumeGeometry.js","../../../../Source/WorkersES6/createPolylineVolumeGeometry.js"],"sourcesContent":["import arrayRemoveDuplicates from \"./arrayRemoveDuplicates.js\";\nimport BoundingRectangle from \"./BoundingRectangle.js\";\nimport BoundingSphere from \"./BoundingSphere.js\";\nimport Cartesian2 from \"./Cartesian2.js\";\nimport Cartesian3 from \"./Cartesian3.js\";\nimport ComponentDatatype from \"./ComponentDatatype.js\";\nimport CornerType from \"./CornerType.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 GeometryPipeline from \"./GeometryPipeline.js\";\nimport IndexDatatype from \"./IndexDatatype.js\";\nimport CesiumMath from \"./Math.js\";\nimport oneTimeWarning from \"./oneTimeWarning.js\";\nimport PolygonPipeline from \"./PolygonPipeline.js\";\nimport PolylineVolumeGeometryLibrary from \"./PolylineVolumeGeometryLibrary.js\";\nimport PrimitiveType from \"./PrimitiveType.js\";\nimport VertexFormat from \"./VertexFormat.js\";\nimport WindingOrder from \"./WindingOrder.js\";\n\nfunction computeAttributes(\n combinedPositions,\n shape,\n boundingRectangle,\n vertexFormat\n) {\n const attributes = new GeometryAttributes();\n if (vertexFormat.position) {\n attributes.position = new GeometryAttribute({\n componentDatatype: ComponentDatatype.DOUBLE,\n componentsPerAttribute: 3,\n values: combinedPositions,\n });\n }\n const shapeLength = shape.length;\n const vertexCount = combinedPositions.length / 3;\n const length = (vertexCount - shapeLength * 2) / (shapeLength * 2);\n const firstEndIndices = PolygonPipeline.triangulate(shape);\n\n const indicesCount =\n (length - 1) * shapeLength * 6 + firstEndIndices.length * 2;\n const indices = IndexDatatype.createTypedArray(vertexCount, indicesCount);\n let i, j;\n let ll, ul, ur, lr;\n const offset = shapeLength * 2;\n let index = 0;\n for (i = 0; i < length - 1; i++) {\n for (j = 0; j < shapeLength - 1; j++) {\n ll = j * 2 + i * shapeLength * 2;\n lr = ll + offset;\n ul = ll + 1;\n ur = ul + offset;\n\n indices[index++] = ul;\n indices[index++] = ll;\n indices[index++] = ur;\n indices[index++] = ur;\n indices[index++] = ll;\n indices[index++] = lr;\n }\n ll = shapeLength * 2 - 2 + i * shapeLength * 2;\n ul = ll + 1;\n ur = ul + offset;\n lr = ll + offset;\n\n indices[index++] = ul;\n indices[index++] = ll;\n indices[index++] = ur;\n indices[index++] = ur;\n indices[index++] = ll;\n indices[index++] = lr;\n }\n\n if (vertexFormat.st || vertexFormat.tangent || vertexFormat.bitangent) {\n // st required for tangent/bitangent calculation\n const st = new Float32Array(vertexCount * 2);\n const lengthSt = 1 / (length - 1);\n const heightSt = 1 / boundingRectangle.height;\n const heightOffset = boundingRectangle.height / 2;\n let s, t;\n let stindex = 0;\n for (i = 0; i < length; i++) {\n s = i * lengthSt;\n t = heightSt * (shape[0].y + heightOffset);\n st[stindex++] = s;\n st[stindex++] = t;\n for (j = 1; j < shapeLength; j++) {\n t = heightSt * (shape[j].y + heightOffset);\n st[stindex++] = s;\n st[stindex++] = t;\n st[stindex++] = s;\n st[stindex++] = t;\n }\n t = heightSt * (shape[0].y + heightOffset);\n st[stindex++] = s;\n st[stindex++] = t;\n }\n for (j = 0; j < shapeLength; j++) {\n s = 0;\n t = heightSt * (shape[j].y + heightOffset);\n st[stindex++] = s;\n st[stindex++] = t;\n }\n for (j = 0; j < shapeLength; j++) {\n s = (length - 1) * lengthSt;\n t = heightSt * (shape[j].y + heightOffset);\n st
|