UNPKG

@loaders.gl/ply

Version:

Framework-independent loader for the PLY format

8 lines (7 loc) 41.6 kB
{ "version": 3, "sources": ["../src/index.ts", "../src/ply-format.ts", "../src/lib/normalize-ply.ts", "../src/lib/get-ply-schema.ts", "../src/lib/parse-ply.ts", "../src/lib/parse-ply-in-batches.ts", "../src/ply-loader.ts", "../src/ply-arrow-loader.ts"], "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// PLYLoader\nexport {PLYFormat} from './ply-format';\n\nexport type {PLYLoaderOptions} from './ply-loader';\nexport {PLYWorkerLoader, PLYLoader} from './ply-loader';\nexport {PLYArrowLoader} from './ply-arrow-loader';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Format} from '@loaders.gl/loader-utils';\n\n/**\n * PLY - Polygon File Format (aka Stanford Triangle Format)\n * @see http://paulbourke.net/dataformats/ply/,\n * @see https://en.wikipedia.org/wiki/PLY_(file_format)\n */\nexport const PLYFormat = {\n name: 'PLY',\n id: 'ply',\n module: 'ply',\n // shapes: ['mesh', 'gltf', 'columnar-table'],\n extensions: ['ply'],\n mimeTypes: ['text/plain', 'application/octet-stream'],\n text: true,\n binary: true,\n tests: ['ply']\n} as const satisfies Format;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {MeshAttributes} from '@loaders.gl/schema';\nimport {getMeshBoundingBox} from '@loaders.gl/schema-utils';\nimport type {PLYMesh, PLYHeader, PLYAttributes, MeshHeader} from './ply-types';\nimport {getPLYSchema} from './get-ply-schema';\n\n/**\n * @param header\n * @param attributes\n * @returns data and header\n */\nexport default function normalizePLY(\n plyHeader: MeshHeader & PLYHeader,\n plyAttributes: PLYAttributes,\n options?: {}\n): PLYMesh {\n const attributes = getMeshAttributes(plyAttributes);\n const boundingBox = getMeshBoundingBox(attributes);\n const vertexCount = plyAttributes.indices.length || plyAttributes.vertices.length / 3;\n\n // TODO - how to detect POINT CLOUDS vs MESHES?\n // TODO - For Meshes, PLY quadrangles must be split?\n const isTriangles = plyAttributes.indices && plyAttributes.indices.length > 0;\n const mode = isTriangles ? 4 : 0; // TRIANGLES vs POINTS\n const topology = isTriangles ? 'triangle-list' : 'point-list';\n\n const schema = getPLYSchema(plyHeader, attributes);\n\n const plyMesh: PLYMesh = {\n loader: 'ply',\n loaderData: plyHeader,\n header: {\n vertexCount,\n boundingBox\n },\n schema,\n attributes,\n indices: {value: new Uint32Array(0), size: 0},\n mode,\n topology\n };\n\n if (plyAttributes.indices.length > 0) {\n plyMesh.indices = {value: new Uint32Array(plyAttributes.indices), size: 1};\n }\n\n return plyMesh;\n}\n\n/**\n * @param attributes\n * @returns accessors []\n */\n// eslint-disable-next-line complexity\nfunction getMeshAttributes(attributes: PLYAttributes): MeshAttributes {\n const accessors: MeshAttributes = {};\n\n for (const attributeName of Object.keys(attributes)) {\n switch (attributeName) {\n case 'vertices':\n if (attributes.vertices.length > 0) {\n accessors.POSITION = {value: new Float32Array(attributes.vertices), size: 3};\n }\n break;\n\n // optional attributes data\n case 'normals':\n if (attributes.normals.length > 0) {\n accessors.NORMAL = {value: new Float32Array(attributes.normals), size: 3};\n }\n break;\n\n case 'uvs':\n if (attributes.uvs.length > 0) {\n accessors.TEXCOORD_0 = {value: new Float32Array(attributes.uvs), size: 2};\n }\n break;\n\n case 'colors':\n if (attributes.colors.length > 0) {\n // TODO - normalized shoud be based on `uchar` flag in source data?\n accessors.COLOR_0 = {value: new Uint8Array(attributes.colors), size: 3, normalized: true};\n }\n break;\n\n case 'indices':\n break;\n\n default:\n if (attributes[attributeName].length > 0) {\n accessors[attributeName] = {value: new Float32Array(attributes[attributeName]), size: 1};\n }\n break;\n }\n }\n return accessors;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Schema, MeshAttributes} from '@loaders.gl/schema';\nimport {deduceMeshSchema} from '@loaders.gl/schema-utils';\nimport type {PLYHeader} from './ply-types';\n\n/**\n * Gets schema from PLY header\n * @param plyHeader\n * @param metadata\n * @returns Schema\n */\nexport function getPLYSchema(plyHeader: PLYHeader, attributes: MeshAttributes): Schema {\n const metadata = makeMetadataFromPlyHeader(plyHeader);\n const schema = deduceMeshSchema(attributes, metadata);\n return schema;\n}\n\n/**\n * Make arrow like schema metadata by PlyHeader properties\n * @param plyHeader\n * @returns\n */\nfunction makeMetadataFromPlyHeader(plyHeader: PLYHeader): Record<string, string> {\n /* eslint-disable camelcase */\n const metadata: Record<string, string> = {};\n metadata.ply_comments = JSON.stringify(plyHeader.comments);\n metadata.ply_elements = JSON.stringify(plyHeader.elements);\n if (plyHeader.format !== undefined) {\n metadata.ply_format = plyHeader.format;\n }\n if (plyHeader.version !== undefined) {\n metadata.ply_version = plyHeader.version;\n }\n if (plyHeader.headerLength !== undefined) {\n metadata.ply_headerLength = plyHeader.headerLength.toString(10);\n }\n return metadata;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// PLY Loader, adapted from THREE.js (MIT license)\n//\n// Attributions per original THREE.js source file:\n//\n// @author Wei Meng / http://about.me/menway\n//\n// Description: A loader for PLY ASCII files (known as the Polygon File Format\n// or the Stanford Triangle Format).\n//\n// Limitations: ASCII decoding assumes file is UTF-8.\n//\n// If the PLY file uses non standard property names, they can be mapped while\n// loading. For example, the following maps the properties\n// \u201Cdiffuse_(red|green|blue)\u201D in the file to standard color names.\n//\n// parsePLY(data, {\n// propertyNameMapping: {\n// diffuse_red: 'red',\n// diffuse_green: 'green',\n// diffuse_blue: 'blue'\n// }\n// });\nimport type {\n PLYMesh,\n PLYHeader,\n PLYAttributes,\n MeshHeader,\n PLYElement,\n PLYProperty\n} from './ply-types';\nimport normalizePLY from './normalize-ply';\n\nexport type ParsePLYOptions = {\n propertyNameMapping?: Record<string, string>;\n};\n\n/**\n * @param data\n * @param options\n * @returns\n */\nexport function parsePLY(data: ArrayBuffer | string, options: ParsePLYOptions = {}): PLYMesh {\n let header: PLYHeader & MeshHeader;\n let attributes: PLYAttributes;\n\n if (data instanceof ArrayBuffer) {\n const text = new TextDecoder().decode(data);\n header = parseHeader(text, options);\n attributes = header.format === 'ascii' ? parseASCII(text, header) : parseBinary(data, header);\n } else {\n header = parseHeader(data, options);\n attributes = parseASCII(data, header);\n }\n\n return normalizePLY(header, attributes);\n}\n\n/**\n * @param data\n * @param options\n * @returns header\n */\nfunction parseHeader(data: any, options?: ParsePLYOptions): PLYHeader {\n const PLY_HEADER_PATTERN = /ply([\\s\\S]*)end_header\\s/;\n\n let headerText = '';\n let headerLength = 0;\n\n const result = PLY_HEADER_PATTERN.exec(data);\n\n if (result !== null) {\n headerText = result[1];\n headerLength = result[0].length;\n }\n const lines = headerText.split('\\n');\n const header = parseHeaderLines(lines, headerLength, options);\n\n return header;\n}\n\n/**\n * @param lines\n * @param headerLength\n * @param options\n * @returns header\n */\n// eslint-disable-next-line complexity\nfunction parseHeaderLines(\n lines: string[],\n headerLength: number,\n options?: ParsePLYOptions\n): PLYHeader {\n const header: PLYHeader = {\n comments: [],\n elements: [],\n headerLength\n };\n\n let lineType: string | undefined;\n let lineValues: string[];\n let currentElement: PLYElement | null = null;\n\n for (let i = 0; i < lines.length; i++) {\n let line: string = lines[i];\n line = line.trim();\n\n if (line === '') {\n // eslint-disable-next-line\n continue;\n }\n\n lineValues = line.split(/\\s+/);\n lineType = lineValues.shift();\n line = lineValues.join(' ');\n\n switch (lineType) {\n case 'format':\n header.format = lineValues[0];\n header.version = lineValues[1];\n break;\n\n case 'comment':\n header.comments.push(line);\n break;\n\n case 'element':\n // Start new element, store previous element\n if (currentElement) {\n header.elements.push(currentElement);\n }\n\n currentElement = {\n name: lineValues[0],\n count: parseInt(lineValues[1], 10),\n properties: []\n };\n break;\n\n case 'property':\n if (currentElement) {\n const property = makePLYElementProperty(lineValues);\n if (options?.propertyNameMapping && property.name in options?.propertyNameMapping) {\n property.name = options?.propertyNameMapping[property.name];\n }\n currentElement.properties.push(property);\n }\n break;\n\n default:\n // eslint-disable-next-line\n console.log('unhandled', lineType, lineValues);\n }\n }\n\n // Store in-progress element\n if (currentElement) {\n header.elements.push(currentElement);\n }\n\n return header;\n}\n\n/** Generate attributes arrays from the header */\n// eslint-disable-next-line complexity\nfunction getPLYAttributes(header: PLYHeader): PLYAttributes {\n // TODO Generate only the attribute arrays actually in the header\n const attributes = {\n indices: [],\n vertices: [],\n normals: [],\n uvs: [],\n colors: []\n };\n\n for (const element of header.elements) {\n if (element.name === 'vertex') {\n for (const property of element.properties) {\n switch (property.name) {\n case 'x':\n case 'y':\n case 'z':\n case 'nx':\n case 'ny':\n case 'nz':\n case 's':\n case 't':\n case 'red':\n case 'green':\n case 'blue':\n break;\n default:\n // Add any non-geometry attributes\n attributes[property.name] = [];\n break;\n }\n }\n }\n }\n\n return attributes;\n}\n\n/**\n * @param propertyValues\n * @returns property of ply element\n */\nfunction makePLYElementProperty(propertyValues: string[]): PLYProperty {\n const type = propertyValues[0];\n switch (type) {\n case 'list':\n return {\n type,\n name: propertyValues[3],\n countType: propertyValues[1],\n itemType: propertyValues[2]\n };\n default:\n return {\n type,\n name: propertyValues[1]\n };\n }\n}\n\n/**\n * Parses ASCII number\n * @param n\n * @param type\n * @returns\n */\n// eslint-disable-next-line complexity\nfunction parseASCIINumber(n: string, type: string): number {\n switch (type) {\n case 'char':\n case 'uchar':\n case 'short':\n case 'ushort':\n case 'int':\n case 'uint':\n case 'int8':\n case 'uint8':\n case 'int16':\n case 'uint16':\n case 'int32':\n case 'uint32':\n return parseInt(n, 10);\n\n case 'float':\n case 'double':\n case 'float32':\n case 'float64':\n return parseFloat(n);\n\n default:\n throw new Error(type);\n }\n}\n\n/**\n * @param properties\n * @param line\n * @returns ASCII element\n */\nfunction parsePLYElement(properties: any[], line: string) {\n const values: any = line.split(/\\s+/);\n\n const element = {};\n\n for (let i = 0; i < properties.length; i++) {\n if (properties[i].type === 'list') {\n const list: any = [];\n const n = parseASCIINumber(values.shift(), properties[i].countType);\n\n for (let j = 0; j < n; j++) {\n list.push(parseASCIINumber(values.shift(), properties[i].itemType));\n }\n\n element[properties[i].name] = list;\n } else {\n element[properties[i].name] = parseASCIINumber(values.shift(), properties[i].type);\n }\n }\n\n return element;\n}\n\n/**\n * @param data\n * @param header\n * @returns [attributes]\n */\nfunction parseASCII(data: any, header: PLYHeader): PLYAttributes {\n // PLY ascii format specification, as per http://en.wikipedia.org/wiki/PLY_(file_format)\n\n const attributes = getPLYAttributes(header);\n\n let result: RegExpExecArray | null;\n\n const patternBody = /end_header\\s([\\s\\S]*)$/;\n let body = '';\n if ((result = patternBody.exec(data)) !== null) {\n body = result[1];\n }\n\n const lines = body.split('\\n');\n let currentElement = 0;\n let currentElementCount = 0;\n\n for (let i = 0; i < lines.length; i++) {\n let line = lines[i];\n line = line.trim();\n\n if (line !== '') {\n if (currentElementCount >= header.elements[currentElement].count) {\n currentElement++;\n currentElementCount = 0;\n }\n\n const element = parsePLYElement(header.elements[currentElement].properties, line);\n handleElement(attributes, header.elements[currentElement].name, element);\n currentElementCount++;\n }\n }\n\n return attributes;\n}\n\n/**\n * @param buffer\n * @param elementName\n * @param element\n */\n// eslint-disable-next-line complexity\nfunction handleElement(\n buffer: {[index: string]: number[]},\n elementName: string,\n element: any = {}\n) {\n if (elementName === 'vertex') {\n for (const propertyName of Object.keys(element)) {\n switch (propertyName) {\n case 'x':\n buffer.vertices.push(element.x, element.y, element.z);\n break;\n case 'y':\n case 'z':\n break;\n\n case 'nx':\n if ('nx' in element && 'ny' in element && 'nz' in element) {\n buffer.normals.push(element.nx, element.ny, element.nz);\n }\n break;\n case 'ny':\n case 'nz':\n break;\n\n case 's':\n if ('s' in element && 't' in element) {\n buffer.uvs.push(element.s, element.t);\n }\n break;\n case 't':\n break;\n\n case 'red':\n if ('red' in element && 'green' in element && 'blue' in element) {\n buffer.colors.push(element.red, element.green, element.blue);\n }\n break;\n case 'green':\n case 'blue':\n break;\n\n default:\n buffer[propertyName].push(element[propertyName]);\n }\n }\n } else if (elementName === 'face') {\n const vertexIndices = element.vertex_indices || element.vertex_index; // issue #9338\n\n if (vertexIndices.length === 3) {\n buffer.indices.push(vertexIndices[0], vertexIndices[1], vertexIndices[2]);\n } else if (vertexIndices.length === 4) {\n buffer.indices.push(vertexIndices[0], vertexIndices[1], vertexIndices[3]);\n buffer.indices.push(vertexIndices[1], vertexIndices[2], vertexIndices[3]);\n }\n }\n}\n\n/**\n * Reads binary data\n * @param dataview\n * @param at\n * @param type\n * @param littleEndian\n * @returns [number, number]\n */\n// eslint-disable-next-line complexity\nfunction binaryRead(dataview: DataView, at: number, type: any, littleEndian: boolean): number[] {\n switch (type) {\n // corespondences for non-specific length types here match rply:\n case 'int8':\n case 'char':\n return [dataview.getInt8(at), 1];\n case 'uint8':\n case 'uchar':\n return [dataview.getUint8(at), 1];\n case 'int16':\n case 'short':\n return [dataview.getInt16(at, littleEndian), 2];\n case 'uint16':\n case 'ushort':\n return [dataview.getUint16(at, littleEndian), 2];\n case 'int32':\n case 'int':\n return [dataview.getInt32(at, littleEndian), 4];\n case 'uint32':\n case 'uint':\n return [dataview.getUint32(at, littleEndian), 4];\n case 'float32':\n case 'float':\n return [dataview.getFloat32(at, littleEndian), 4];\n case 'float64':\n case 'double':\n return [dataview.getFloat64(at, littleEndian), 8];\n\n default:\n throw new Error(type);\n }\n}\n\n/**\n * Reads binary data\n * @param dataview\n * @param at\n * @param properties\n * @param littleEndian\n * @returns [object, number]\n */\nfunction binaryReadElement(\n dataview: DataView,\n at: number,\n properties: {[index: string]: any},\n littleEndian: boolean\n): {}[] {\n const element = {};\n let result: number[];\n let read = 0;\n\n for (let i = 0; i < properties.length; i++) {\n if (properties[i].type === 'list') {\n const list = [];\n\n result = binaryRead(dataview, at + read, properties[i].countType, littleEndian);\n const n = result[0];\n read += result[1];\n\n for (let j = 0; j < n; j++) {\n result = binaryRead(dataview, at + read, properties[i].itemType, littleEndian);\n // @ts-ignore\n list.push(result[0]);\n read += result[1];\n }\n\n element[properties[i].name] = list;\n } else {\n result = binaryRead(dataview, at + read, properties[i].type, littleEndian);\n element[properties[i].name] = result[0];\n read += result[1];\n }\n }\n\n return [element, read];\n}\n\ntype BinaryAttributes = {\n [index: string]: number[];\n};\n\n/**\n * Parses binary data\n * @param data\n * @param header\n * @returns [attributes] of data\n */\nfunction parseBinary(data: ArrayBuffer, header: PLYHeader): BinaryAttributes {\n const attributes = getPLYAttributes(header);\n\n const littleEndian = header.format === 'binary_little_endian';\n const body = new DataView(data, header.headerLength);\n let result: any[];\n let loc = 0;\n\n for (let currentElement = 0; currentElement < header.elements.length; currentElement++) {\n const count = header.elements[currentElement].count;\n for (let currentElementCount = 0; currentElementCount < count; currentElementCount++) {\n result = binaryReadElement(\n body,\n loc,\n header.elements[currentElement].properties,\n littleEndian\n );\n loc += result[1];\n const element = result[0];\n\n handleElement(attributes, header.elements[currentElement].name, element);\n }\n }\n\n return attributes;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// PLY Loader, adapted from THREE.js (MIT license)\n//\n// Attributions per original THREE.js source file:\n//\n// @author Wei Meng / http://about.me/menway\n//\n// Description: A loader for PLY ASCII files (known as the Polygon File Format\n// or the Stanford Triangle Format).\n//\n// Limitations: ASCII decoding assumes file is UTF-8.\n//\n// If the PLY file uses non standard property names, they can be mapped while\n// loading. For example, the following maps the properties\n// \u201Cdiffuse_(red|green|blue)\u201D in the file to standard color names.\n//\n// parsePLY(data, {\n// propertyNameMapping: {\n// diffuse_red: 'red',\n// diffuse_green: 'green',\n// diffuse_blue: 'blue'\n// }\n// });\n\nimport {\n makeLineIterator,\n makeTextDecoderIterator,\n forEach,\n toArrayBufferIterator\n} from '@loaders.gl/loader-utils';\nimport normalizePLY from './normalize-ply';\nimport {PLYMesh, PLYHeader, PLYElement, PLYProperty, PLYAttributes} from './ply-types';\n\nlet currentElement: PLYElement;\n\n/**\n * PARSER\n * @param iterator\n * @param options\n */\nexport async function* parsePLYInBatches(\n iterator:\n | AsyncIterable<ArrayBufferLike | ArrayBufferView>\n | Iterable<ArrayBufferLike | ArrayBufferView>,\n options: any\n): AsyncIterable<PLYMesh> {\n const lineIterator = makeLineIterator(makeTextDecoderIterator(toArrayBufferIterator(iterator)));\n const header = await parsePLYHeader(lineIterator, options);\n\n let attributes: PLYAttributes;\n switch (header.format) {\n case 'ascii':\n attributes = await parseASCII(lineIterator, header);\n break;\n default:\n throw new Error('Binary PLY can not yet be parsed in streaming mode');\n // attributes = await parseBinary(lineIterator, header);\n }\n\n yield normalizePLY(header, attributes, options);\n}\n\n/**\n * Parses header\n * @param lineIterator\n * @param options\n * @returns\n */\nasync function parsePLYHeader(\n lineIterator: AsyncIterable<string> | Iterable<string>,\n options: {[key: string]: any}\n): Promise<PLYHeader> {\n const header: PLYHeader = {\n comments: [],\n elements: []\n // headerLength\n };\n\n // Note: forEach does not reset iterator if exiting loop prematurely\n // so that iteration can continue in a second loop\n await forEach(lineIterator, (line: string) => {\n line = line.trim();\n\n // End of header\n if (line === 'end_header') {\n return true; // Returning true cancels `forEach`\n }\n\n // Ignore empty lines\n if (line === '') {\n // eslint-disable-next-line\n return false; // Returning false does not cancel `forEach`\n }\n\n const lineValues = line.split(/\\s+/);\n const lineType = lineValues.shift();\n line = lineValues.join(' ');\n\n switch (lineType) {\n case 'ply':\n // First line magic characters, ignore\n break;\n\n case 'format':\n header.format = lineValues[0];\n header.version = lineValues[1];\n break;\n\n case 'comment':\n header.comments.push(line);\n break;\n\n case 'element':\n if (currentElement) {\n header.elements.push(currentElement);\n }\n\n currentElement = {\n name: lineValues[0],\n count: parseInt(lineValues[1], 10),\n properties: []\n };\n break;\n\n case 'property':\n const property = makePLYElementProperty(lineValues, options.propertyNameMapping);\n currentElement.properties.push(property);\n break;\n\n default:\n // eslint-disable-next-line\n console.log('unhandled', lineType, lineValues);\n }\n\n return false;\n });\n\n if (currentElement) {\n header.elements.push(currentElement);\n }\n\n return header;\n}\n\nfunction makePLYElementProperty(propertyValues: string[], propertyNameMapping: []): PLYProperty {\n const type = propertyValues[0];\n switch (type) {\n case 'list':\n return {\n type,\n name: propertyValues[3],\n countType: propertyValues[1],\n itemType: propertyValues[2]\n };\n default:\n return {\n type,\n name: propertyValues[1]\n };\n }\n}\n\n// ASCII PARSING\n/**\n * @param lineIterator\n * @param header\n * @returns\n */\nasync function parseASCII(lineIterator: AsyncIterable<string>, header: PLYHeader) {\n // PLY ascii format specification, as per http://en.wikipedia.org/wiki/PLY_(file_format)\n const attributes: PLYAttributes = {\n indices: [],\n vertices: [],\n normals: [],\n uvs: [],\n colors: []\n };\n\n let currentElement = 0;\n let currentElementCount = 0;\n\n for await (let line of lineIterator) {\n line = line.trim();\n\n if (line !== '') {\n if (currentElementCount >= header.elements[currentElement].count) {\n currentElement++;\n currentElementCount = 0;\n }\n\n const element = parsePLYElement(header.elements[currentElement].properties, line);\n handleElement(attributes, header.elements[currentElement].name, element);\n currentElementCount++;\n }\n }\n\n return attributes;\n}\n/**\n * Parses ASCII number\n * @param n\n * @param type\n * @returns ASCII number\n */\n// eslint-disable-next-line complexity\nfunction parseASCIINumber(n: string, type: string): number {\n switch (type) {\n case 'char':\n case 'uchar':\n case 'short':\n case 'ushort':\n case 'int':\n case 'uint':\n case 'int8':\n case 'uint8':\n case 'int16':\n case 'uint16':\n case 'int32':\n case 'uint32':\n return parseInt(n, 10);\n\n case 'float':\n case 'double':\n case 'float32':\n case 'float64':\n return parseFloat(n);\n\n default:\n throw new Error(type);\n }\n}\n/**\n * Parses ASCII element\n * @param properties\n * @param line\n * @returns element\n */\nfunction parsePLYElement(properties: any[], line: string) {\n const values: any = line.split(/\\s+/);\n\n const element = {};\n\n for (let i = 0; i < properties.length; i++) {\n if (properties[i].type === 'list') {\n const list: any = [];\n const n = parseASCIINumber(values.shift(), properties[i].countType);\n\n for (let j = 0; j < n; j++) {\n list.push(parseASCIINumber(values.shift(), properties[i].itemType));\n }\n\n element[properties[i].name] = list;\n } else {\n element[properties[i].name] = parseASCIINumber(values.shift(), properties[i].type);\n }\n }\n\n return element;\n}\n/**\n * @param buffer\n * @param elementName\n * @param element\n */\n// HELPER FUNCTIONS\n// eslint-disable-next-line complexity\nfunction handleElement(\n buffer: {[index: string]: number[]},\n elementName: string,\n element: any = {}\n) {\n switch (elementName) {\n case 'vertex':\n buffer.vertices.push(element.x, element.y, element.z);\n if ('nx' in element && 'ny' in element && 'nz' in element) {\n buffer.normals.push(element.nx, element.ny, element.nz);\n }\n if ('s' in element && 't' in element) {\n buffer.uvs.push(element.s, element.t);\n }\n if ('red' in element && 'green' in element && 'blue' in element) {\n buffer.colors.push(element.red / 255.0, element.green / 255.0, element.blue / 255.0);\n }\n break;\n\n case 'face':\n const vertexIndices = element.vertex_indices || element.vertex_index; // issue #9338\n if (vertexIndices.length === 3) {\n buffer.indices.push(vertexIndices[0], vertexIndices[1], vertexIndices[2]);\n } else if (vertexIndices.length === 4) {\n buffer.indices.push(vertexIndices[0], vertexIndices[1], vertexIndices[3]);\n buffer.indices.push(vertexIndices[1], vertexIndices[2], vertexIndices[3]);\n }\n break;\n\n default:\n break;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// PLY Loader\nimport type {Loader, LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {PLYMesh} from './lib/ply-types';\nimport type {ParsePLYOptions} from './lib/parse-ply';\nimport {parsePLY} from './lib/parse-ply';\nimport {parsePLYInBatches} from './lib/parse-ply-in-batches';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type PLYLoaderOptions = LoaderOptions & {\n ply?: ParsePLYOptions & {\n /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n workerUrl?: string;\n };\n};\n\n/**\n * Worker loader for PLY - Polygon File Format (aka Stanford Triangle Format)'\n * links: ['http://paulbourke.net/dataformats/ply/',\n * 'https://en.wikipedia.org/wiki/PLY_(file_format)']\n */\nexport const PLYWorkerLoader = {\n dataType: null as unknown as PLYMesh,\n batchType: null as never,\n\n name: 'PLY',\n id: 'ply',\n module: 'ply',\n // shapes: ['mesh', 'gltf', 'columnar-table'],\n version: VERSION,\n worker: true,\n extensions: ['ply'],\n mimeTypes: ['text/plain', 'application/octet-stream'],\n text: true,\n binary: true,\n tests: ['ply'],\n options: {\n ply: {}\n }\n} as const satisfies Loader<PLYMesh, never, LoaderOptions>;\n\n/**\n * Loader for PLY - Polygon File Format\n */\nexport const PLYLoader = {\n ...PLYWorkerLoader,\n // Note: parsePLY supports both text and binary\n parse: async (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply), // TODO - this may not detect text correctly?\n parseTextSync: (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),\n parseSync: (arrayBuffer, options) => parsePLY(arrayBuffer, options?.ply),\n parseInBatches: (\n arrayBuffer:\n | AsyncIterable<ArrayBufferLike | ArrayBufferView>\n | Iterable<ArrayBufferLike | ArrayBufferView>,\n options\n ) => parsePLYInBatches(arrayBuffer, options?.ply)\n} as const satisfies LoaderWithParser<PLYMesh, any, PLYLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArrowTable} from '@loaders.gl/schema';\n\nimport {PLYLoaderOptions, PLYWorkerLoader} from './ply-loader';\nimport {convertMeshToTable} from '@loaders.gl/schema-utils';\nimport {parsePLY} from './lib/parse-ply';\n\n/**\n * Worker loader for PLY -\n */\nexport const PLYArrowLoader = {\n ...PLYWorkerLoader,\n dataType: null as unknown as ArrowTable,\n batchType: null as never,\n worker: false,\n parse: async (arrayBuffer: ArrayBuffer) => {\n const mesh = parsePLY(arrayBuffer);\n const arrowTable = convertMeshToTable(mesh, 'arrow-table');\n return arrowTable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G;;EACzE,eAAe,CAAC,aAAa,YAAY,SAAS,aAAa,mCAAS,GAAG;EAC3E,WAAW,CAAC,aAAa,YAAY,SAAS,aAAa,mCAAS,GAAG;EACvE,gBAAgB,CACd,aAGA,YACG,kBAAkB,aAAa,mCAAS,GAAG;;;;ACrDlD,IAAAE,uBAAiC;AAM1B,IAAM,iBAAiB;EAC5B,GAAG;EACH,UAAU;EACV,WAAW;EACX,QAAQ;EACR,OAAO,OAAO,gBAA4B;AACxC,UAAM,OAAO,SAAS,WAAW;AACjC,UAAM,iBAAa,yCAAmB,MAAM,aAAa;AACzD,WAAO;EACT;;", "names": ["import_schema_utils", "currentElement", "parseASCII", "makePLYElementProperty", "currentElement", "parsePLYElement", "handleElement", "parseASCIINumber", "import_schema_utils"] }