@loaders.gl/ply 3.1.3 → 4.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +2 -2
- package/dist/bundle.js.map +1 -0
- package/dist/dist.min.js +3 -11
- package/dist/index.js +11 -21
- package/dist/index.js.map +1 -0
- package/dist/lib/get-ply-schema.js +24 -33
- package/dist/lib/get-ply-schema.js.map +1 -0
- package/dist/lib/normalize-ply.js +65 -54
- package/dist/lib/normalize-ply.js.map +1 -0
- package/dist/lib/parse-ply-in-batches.d.ts.map +1 -1
- package/dist/lib/parse-ply-in-batches.js +200 -235
- package/dist/lib/parse-ply-in-batches.js.map +1 -0
- package/dist/lib/parse-ply.js +297 -320
- package/dist/lib/parse-ply.js.map +1 -0
- package/dist/lib/ply-types.js +2 -2
- package/dist/{es5/lib → lib}/ply-types.js.map +0 -0
- package/dist/ply-loader.js +18 -27
- package/dist/ply-loader.js.map +1 -0
- package/dist/ply-worker.js +1 -1
- package/dist/workers/ply-worker.js +4 -5
- package/dist/workers/ply-worker.js.map +1 -0
- package/package.json +7 -10
- package/src/lib/parse-ply-in-batches.ts +3 -4
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/index.js +0 -63
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/lib/get-ply-schema.js +0 -35
- package/dist/es5/lib/get-ply-schema.js.map +0 -1
- package/dist/es5/lib/normalize-ply.js +0 -78
- package/dist/es5/lib/normalize-ply.js.map +0 -1
- package/dist/es5/lib/parse-ply-in-batches.js +0 -370
- package/dist/es5/lib/parse-ply-in-batches.js.map +0 -1
- package/dist/es5/lib/parse-ply.js +0 -340
- package/dist/es5/lib/parse-ply.js.map +0 -1
- package/dist/es5/lib/ply-types.js +0 -2
- package/dist/es5/ply-loader.js +0 -27
- package/dist/es5/ply-loader.js.map +0 -1
- package/dist/es5/workers/ply-worker.js +0 -8
- package/dist/es5/workers/ply-worker.js.map +0 -1
- package/dist/esm/bundle.js +0 -5
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/index.js +0 -12
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/lib/get-ply-schema.js +0 -27
- package/dist/esm/lib/get-ply-schema.js.map +0 -1
- package/dist/esm/lib/normalize-ply.js +0 -69
- package/dist/esm/lib/normalize-ply.js.map +0 -1
- package/dist/esm/lib/parse-ply-in-batches.js +0 -218
- package/dist/esm/lib/parse-ply-in-batches.js.map +0 -1
- package/dist/esm/lib/parse-ply.js +0 -327
- package/dist/esm/lib/parse-ply.js.map +0 -1
- package/dist/esm/lib/ply-types.js +0 -2
- package/dist/esm/lib/ply-types.js.map +0 -1
- package/dist/esm/ply-loader.js +0 -19
- package/dist/esm/ply-loader.js.map +0 -1
- package/dist/esm/workers/ply-worker.js +0 -4
- package/dist/esm/workers/ply-worker.js.map +0 -1
package/dist/bundle.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
|
package/dist/dist.min.js
CHANGED
|
@@ -1025,14 +1025,6 @@
|
|
|
1025
1025
|
}
|
|
1026
1026
|
});
|
|
1027
1027
|
|
|
1028
|
-
// ../core/src/index.ts
|
|
1029
|
-
var init_src3 = __esm({
|
|
1030
|
-
"../core/src/index.ts"() {
|
|
1031
|
-
init_src2();
|
|
1032
|
-
init_src2();
|
|
1033
|
-
}
|
|
1034
|
-
});
|
|
1035
|
-
|
|
1036
1028
|
// src/lib/parse-ply-in-batches.ts
|
|
1037
1029
|
async function* parsePLYInBatches(iterator, options) {
|
|
1038
1030
|
const lineIterator = makeLineIterator(makeTextDecoderIterator(iterator));
|
|
@@ -1208,7 +1200,7 @@
|
|
|
1208
1200
|
var currentElement;
|
|
1209
1201
|
var init_parse_ply_in_batches = __esm({
|
|
1210
1202
|
"src/lib/parse-ply-in-batches.ts"() {
|
|
1211
|
-
|
|
1203
|
+
init_src2();
|
|
1212
1204
|
init_normalize_ply();
|
|
1213
1205
|
}
|
|
1214
1206
|
});
|
|
@@ -1221,7 +1213,7 @@
|
|
|
1221
1213
|
_typecheckPLYLoader: () => _typecheckPLYLoader
|
|
1222
1214
|
});
|
|
1223
1215
|
var PLYLoader2, _typecheckPLYLoader;
|
|
1224
|
-
var
|
|
1216
|
+
var init_src3 = __esm({
|
|
1225
1217
|
"src/index.ts"() {
|
|
1226
1218
|
init_ply_loader();
|
|
1227
1219
|
init_parse_ply();
|
|
@@ -1240,7 +1232,7 @@
|
|
|
1240
1232
|
// src/bundle.ts
|
|
1241
1233
|
var require_bundle = __commonJS({
|
|
1242
1234
|
"src/bundle.ts"(exports, module) {
|
|
1243
|
-
var moduleExports = (
|
|
1235
|
+
var moduleExports = (init_src3(), src_exports);
|
|
1244
1236
|
globalThis.loaders = globalThis.loaders || {};
|
|
1245
1237
|
module.exports = Object.assign(globalThis.loaders, moduleExports);
|
|
1246
1238
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { PLYLoader as PLYWorkerLoader } from './ply-loader';
|
|
2
|
+
import parsePLY from './lib/parse-ply';
|
|
3
|
+
import parsePLYInBatches from './lib/parse-ply-in-batches';
|
|
4
|
+
export { PLYWorkerLoader };
|
|
5
|
+
export const PLYLoader = { ...PLYWorkerLoader,
|
|
6
|
+
parse: async (arrayBuffer, options) => parsePLY(arrayBuffer, options),
|
|
7
|
+
parseTextSync: parsePLY,
|
|
8
|
+
parseSync: parsePLY,
|
|
9
|
+
parseInBatches: parsePLYInBatches
|
|
4
10
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const ply_loader_1 = require("./ply-loader");
|
|
8
|
-
Object.defineProperty(exports, "PLYWorkerLoader", { enumerable: true, get: function () { return ply_loader_1.PLYLoader; } });
|
|
9
|
-
const parse_ply_1 = __importDefault(require("./lib/parse-ply"));
|
|
10
|
-
const parse_ply_in_batches_1 = __importDefault(require("./lib/parse-ply-in-batches"));
|
|
11
|
-
/**
|
|
12
|
-
* Loader for PLY - Polygon File Format
|
|
13
|
-
*/
|
|
14
|
-
exports.PLYLoader = {
|
|
15
|
-
...ply_loader_1.PLYLoader,
|
|
16
|
-
// Note: parsePLY supports both text and binary
|
|
17
|
-
parse: async (arrayBuffer, options) => (0, parse_ply_1.default)(arrayBuffer, options),
|
|
18
|
-
parseTextSync: parse_ply_1.default,
|
|
19
|
-
parseSync: parse_ply_1.default,
|
|
20
|
-
parseInBatches: parse_ply_in_batches_1.default
|
|
21
|
-
};
|
|
22
|
-
exports._typecheckPLYLoader = exports.PLYLoader;
|
|
11
|
+
export const _typecheckPLYLoader = PLYLoader;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["PLYLoader","PLYWorkerLoader","parsePLY","parsePLYInBatches","parse","arrayBuffer","options","parseTextSync","parseSync","parseInBatches","_typecheckPLYLoader"],"mappings":"AACA,SAAQA,SAAS,IAAIC,eAArB,QAA2C,cAA3C;AACA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,iBAAP,MAA8B,4BAA9B;AAIA,SAAQF,eAAR;AAKA,OAAO,MAAMD,SAAS,GAAG,EACvB,GAAGC,eADoB;AAGvBG,EAAAA,KAAK,EAAE,OAAOC,WAAP,EAAoBC,OAApB,KAAgCJ,QAAQ,CAACG,WAAD,EAAcC,OAAd,CAHxB;AAIvBC,EAAAA,aAAa,EAAEL,QAJQ;AAKvBM,EAAAA,SAAS,EAAEN,QALY;AAMvBO,EAAAA,cAAc,EAAEN;AANO,CAAlB;AASP,OAAO,MAAMO,mBAAqC,GAAGV,SAA9C","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {PLYLoader as PLYWorkerLoader} from './ply-loader';\nimport parsePLY from './lib/parse-ply';\nimport parsePLYInBatches from './lib/parse-ply-in-batches';\n\n// PLYLoader\n\nexport {PLYWorkerLoader};\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), // TODO - this may not detect text correctly?\n parseTextSync: parsePLY,\n parseSync: parsePLY,\n parseInBatches: parsePLYInBatches\n};\n\nexport const _typecheckPLYLoader: LoaderWithParser = PLYLoader;\n"],"file":"index.js"}
|
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
* Gets schema from PLY header
|
|
7
|
-
* @param plyHeader
|
|
8
|
-
* @param metadata
|
|
9
|
-
* @returns Schema
|
|
10
|
-
*/
|
|
11
|
-
function getPLYSchema(plyHeader, attributes) {
|
|
12
|
-
const metadataMap = makeMetadataFromPlyHeader(plyHeader);
|
|
13
|
-
const schema = (0, schema_1.deduceMeshSchema)(attributes, metadataMap);
|
|
14
|
-
return schema;
|
|
1
|
+
import { deduceMeshSchema } from '@loaders.gl/schema';
|
|
2
|
+
export function getPLYSchema(plyHeader, attributes) {
|
|
3
|
+
const metadataMap = makeMetadataFromPlyHeader(plyHeader);
|
|
4
|
+
const schema = deduceMeshSchema(attributes, metadataMap);
|
|
5
|
+
return schema;
|
|
15
6
|
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Make arrow like schema metadata by PlyHeader properties
|
|
19
|
-
* @param plyHeader
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
7
|
+
|
|
22
8
|
function makeMetadataFromPlyHeader(plyHeader) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
const metadataMap = new Map();
|
|
10
|
+
metadataMap.set('ply_comments', JSON.stringify(plyHeader.comments));
|
|
11
|
+
metadataMap.set('ply_elements', JSON.stringify(plyHeader.elements));
|
|
12
|
+
|
|
13
|
+
if (plyHeader.format !== undefined) {
|
|
14
|
+
metadataMap.set('ply_format', plyHeader.format);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (plyHeader.version !== undefined) {
|
|
18
|
+
metadataMap.set('ply_version', plyHeader.version);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (plyHeader.headerLength !== undefined) {
|
|
22
|
+
metadataMap.set('ply_headerLength', plyHeader.headerLength.toString(10));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return metadataMap;
|
|
36
26
|
}
|
|
27
|
+
//# sourceMappingURL=get-ply-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/get-ply-schema.ts"],"names":["deduceMeshSchema","getPLYSchema","plyHeader","attributes","metadataMap","makeMetadataFromPlyHeader","schema","Map","set","JSON","stringify","comments","elements","format","undefined","version","headerLength","toString"],"mappings":"AAAA,SAAgCA,gBAAhC,QAAuD,oBAAvD;AASA,OAAO,SAASC,YAAT,CAAsBC,SAAtB,EAA4CC,UAA5C,EAAgF;AACrF,QAAMC,WAAW,GAAGC,yBAAyB,CAACH,SAAD,CAA7C;AACA,QAAMI,MAAM,GAAGN,gBAAgB,CAACG,UAAD,EAAaC,WAAb,CAA/B;AACA,SAAOE,MAAP;AACD;;AAOD,SAASD,yBAAT,CAAmCH,SAAnC,EAA8E;AAC5E,QAAME,WAAW,GAAG,IAAIG,GAAJ,EAApB;AACAH,EAAAA,WAAW,CAACI,GAAZ,CAAgB,cAAhB,EAAgCC,IAAI,CAACC,SAAL,CAAeR,SAAS,CAACS,QAAzB,CAAhC;AACAP,EAAAA,WAAW,CAACI,GAAZ,CAAgB,cAAhB,EAAgCC,IAAI,CAACC,SAAL,CAAeR,SAAS,CAACU,QAAzB,CAAhC;;AACA,MAAIV,SAAS,CAACW,MAAV,KAAqBC,SAAzB,EAAoC;AAClCV,IAAAA,WAAW,CAACI,GAAZ,CAAgB,YAAhB,EAA8BN,SAAS,CAACW,MAAxC;AACD;;AACD,MAAIX,SAAS,CAACa,OAAV,KAAsBD,SAA1B,EAAqC;AACnCV,IAAAA,WAAW,CAACI,GAAZ,CAAgB,aAAhB,EAA+BN,SAAS,CAACa,OAAzC;AACD;;AACD,MAAIb,SAAS,CAACc,YAAV,KAA2BF,SAA/B,EAA0C;AACxCV,IAAAA,WAAW,CAACI,GAAZ,CAAgB,kBAAhB,EAAoCN,SAAS,CAACc,YAAV,CAAuBC,QAAvB,CAAgC,EAAhC,CAApC;AACD;;AACD,SAAOb,WAAP;AACD","sourcesContent":["import {Schema, MeshAttributes, deduceMeshSchema} from '@loaders.gl/schema';\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 metadataMap = makeMetadataFromPlyHeader(plyHeader);\n const schema = deduceMeshSchema(attributes, metadataMap);\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): Map<string, string> {\n const metadataMap = new Map();\n metadataMap.set('ply_comments', JSON.stringify(plyHeader.comments));\n metadataMap.set('ply_elements', JSON.stringify(plyHeader.elements));\n if (plyHeader.format !== undefined) {\n metadataMap.set('ply_format', plyHeader.format);\n }\n if (plyHeader.version !== undefined) {\n metadataMap.set('ply_version', plyHeader.version);\n }\n if (plyHeader.headerLength !== undefined) {\n metadataMap.set('ply_headerLength', plyHeader.headerLength.toString(10));\n }\n return metadataMap;\n}\n"],"file":"get-ply-schema.js"}
|
|
@@ -1,58 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
import { getMeshBoundingBox } from '@loaders.gl/schema';
|
|
2
|
+
import { getPLYSchema } from './get-ply-schema';
|
|
3
|
+
export default function normalizePLY(plyHeader, plyAttributes, options) {
|
|
4
|
+
const attributes = getMeshAttributes(plyAttributes);
|
|
5
|
+
const boundingBox = getMeshBoundingBox(attributes);
|
|
6
|
+
const vertexCount = plyAttributes.indices.length || plyAttributes.vertices.length / 3;
|
|
7
|
+
const isTriangles = plyAttributes.indices && plyAttributes.indices.length > 0;
|
|
8
|
+
const mode = isTriangles ? 4 : 0;
|
|
9
|
+
const topology = isTriangles ? 'triangle-list' : 'point-list';
|
|
10
|
+
const schema = getPLYSchema(plyHeader, attributes);
|
|
11
|
+
const plyMesh = {
|
|
12
|
+
loader: 'ply',
|
|
13
|
+
loaderData: plyHeader,
|
|
14
|
+
header: {
|
|
15
|
+
vertexCount,
|
|
16
|
+
boundingBox
|
|
17
|
+
},
|
|
18
|
+
schema,
|
|
19
|
+
attributes,
|
|
20
|
+
indices: {
|
|
21
|
+
value: new Uint32Array(0),
|
|
22
|
+
size: 0
|
|
23
|
+
},
|
|
24
|
+
mode,
|
|
25
|
+
topology
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
if (plyAttributes.indices.length > 0) {
|
|
29
|
+
plyMesh.indices = {
|
|
30
|
+
value: new Uint32Array(plyAttributes.indices),
|
|
31
|
+
size: 1
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return plyMesh;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return plyMesh;
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @param attributes
|
|
41
|
-
* @returns accessors []
|
|
42
|
-
*/
|
|
37
|
+
|
|
43
38
|
function getMeshAttributes(attributes) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
39
|
+
const accessors = {};
|
|
40
|
+
accessors.POSITION = {
|
|
41
|
+
value: new Float32Array(attributes.vertices),
|
|
42
|
+
size: 3
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
if (attributes.normals.length > 0) {
|
|
46
|
+
accessors.NORMAL = {
|
|
47
|
+
value: new Float32Array(attributes.normals),
|
|
48
|
+
size: 3
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (attributes.uvs.length > 0) {
|
|
53
|
+
accessors.TEXCOORD_0 = {
|
|
54
|
+
value: new Float32Array(attributes.uvs),
|
|
55
|
+
size: 2
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (attributes.colors.length > 0) {
|
|
60
|
+
accessors.COLOR_0 = {
|
|
61
|
+
value: new Uint8Array(attributes.colors),
|
|
62
|
+
size: 3,
|
|
63
|
+
normalized: true
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return accessors;
|
|
58
68
|
}
|
|
69
|
+
//# sourceMappingURL=normalize-ply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/normalize-ply.ts"],"names":["getMeshBoundingBox","getPLYSchema","normalizePLY","plyHeader","plyAttributes","options","attributes","getMeshAttributes","boundingBox","vertexCount","indices","length","vertices","isTriangles","mode","topology","schema","plyMesh","loader","loaderData","header","value","Uint32Array","size","accessors","POSITION","Float32Array","normals","NORMAL","uvs","TEXCOORD_0","colors","COLOR_0","Uint8Array","normalized"],"mappings":"AACA,SAAQA,kBAAR,QAAiC,oBAAjC;AAEA,SAAQC,YAAR,QAA2B,kBAA3B;AAOA,eAAe,SAASC,YAAT,CACbC,SADa,EAEbC,aAFa,EAGbC,OAHa,EAIJ;AACT,QAAMC,UAAU,GAAGC,iBAAiB,CAACH,aAAD,CAApC;AACA,QAAMI,WAAW,GAAGR,kBAAkB,CAACM,UAAD,CAAtC;AACA,QAAMG,WAAW,GAAGL,aAAa,CAACM,OAAd,CAAsBC,MAAtB,IAAgCP,aAAa,CAACQ,QAAd,CAAuBD,MAAvB,GAAgC,CAApF;AAIA,QAAME,WAAW,GAAGT,aAAa,CAACM,OAAd,IAAyBN,aAAa,CAACM,OAAd,CAAsBC,MAAtB,GAA+B,CAA5E;AACA,QAAMG,IAAI,GAAGD,WAAW,GAAG,CAAH,GAAO,CAA/B;AACA,QAAME,QAAQ,GAAGF,WAAW,GAAG,eAAH,GAAqB,YAAjD;AAEA,QAAMG,MAAM,GAAGf,YAAY,CAACE,SAAD,EAAYG,UAAZ,CAA3B;AAEA,QAAMW,OAAgB,GAAG;AACvBC,IAAAA,MAAM,EAAE,KADe;AAEvBC,IAAAA,UAAU,EAAEhB,SAFW;AAGvBiB,IAAAA,MAAM,EAAE;AACNX,MAAAA,WADM;AAEND,MAAAA;AAFM,KAHe;AAOvBQ,IAAAA,MAPuB;AAQvBV,IAAAA,UARuB;AASvBI,IAAAA,OAAO,EAAE;AAACW,MAAAA,KAAK,EAAE,IAAIC,WAAJ,CAAgB,CAAhB,CAAR;AAA4BC,MAAAA,IAAI,EAAE;AAAlC,KATc;AAUvBT,IAAAA,IAVuB;AAWvBC,IAAAA;AAXuB,GAAzB;;AAcA,MAAIX,aAAa,CAACM,OAAd,CAAsBC,MAAtB,GAA+B,CAAnC,EAAsC;AACpCM,IAAAA,OAAO,CAACP,OAAR,GAAkB;AAACW,MAAAA,KAAK,EAAE,IAAIC,WAAJ,CAAgBlB,aAAa,CAACM,OAA9B,CAAR;AAAgDa,MAAAA,IAAI,EAAE;AAAtD,KAAlB;AACD;;AAED,SAAON,OAAP;AACD;;AAMD,SAASV,iBAAT,CAA2BD,UAA3B,EAAsE;AACpE,QAAMkB,SAAyB,GAAG,EAAlC;AAEAA,EAAAA,SAAS,CAACC,QAAV,GAAqB;AAACJ,IAAAA,KAAK,EAAE,IAAIK,YAAJ,CAAiBpB,UAAU,CAACM,QAA5B,CAAR;AAA+CW,IAAAA,IAAI,EAAE;AAArD,GAArB;;AAIA,MAAIjB,UAAU,CAACqB,OAAX,CAAmBhB,MAAnB,GAA4B,CAAhC,EAAmC;AACjCa,IAAAA,SAAS,CAACI,MAAV,GAAmB;AAACP,MAAAA,KAAK,EAAE,IAAIK,YAAJ,CAAiBpB,UAAU,CAACqB,OAA5B,CAAR;AAA8CJ,MAAAA,IAAI,EAAE;AAApD,KAAnB;AACD;;AAED,MAAIjB,UAAU,CAACuB,GAAX,CAAelB,MAAf,GAAwB,CAA5B,EAA+B;AAC7Ba,IAAAA,SAAS,CAACM,UAAV,GAAuB;AAACT,MAAAA,KAAK,EAAE,IAAIK,YAAJ,CAAiBpB,UAAU,CAACuB,GAA5B,CAAR;AAA0CN,MAAAA,IAAI,EAAE;AAAhD,KAAvB;AACD;;AAED,MAAIjB,UAAU,CAACyB,MAAX,CAAkBpB,MAAlB,GAA2B,CAA/B,EAAkC;AAEhCa,IAAAA,SAAS,CAACQ,OAAV,GAAoB;AAACX,MAAAA,KAAK,EAAE,IAAIY,UAAJ,CAAe3B,UAAU,CAACyB,MAA1B,CAAR;AAA2CR,MAAAA,IAAI,EAAE,CAAjD;AAAoDW,MAAAA,UAAU,EAAE;AAAhE,KAApB;AACD;;AAED,SAAOV,SAAP;AACD","sourcesContent":["import type {MeshAttributes} from '@loaders.gl/schema';\nimport {getMeshBoundingBox} from '@loaders.gl/schema';\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 */\nfunction getMeshAttributes(attributes: PLYAttributes): MeshAttributes {\n const accessors: MeshAttributes = {};\n\n accessors.POSITION = {value: new Float32Array(attributes.vertices), size: 3};\n\n // optional attributes data\n\n if (attributes.normals.length > 0) {\n accessors.NORMAL = {value: new Float32Array(attributes.normals), size: 3};\n }\n\n if (attributes.uvs.length > 0) {\n accessors.TEXCOORD_0 = {value: new Float32Array(attributes.uvs), size: 2};\n }\n\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\n return accessors;\n}\n"],"file":"normalize-ply.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-ply-in-batches.d.ts","sourceRoot":"","sources":["../../src/lib/parse-ply-in-batches.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-ply-in-batches.d.ts","sourceRoot":"","sources":["../../src/lib/parse-ply-in-batches.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAC,OAAO,EAAyC,MAAM,aAAa,CAAC;AAI5E;;;;GAIG;AACH,wBAA+B,iBAAiB,CAC9C,QAAQ,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,EAC5D,OAAO,EAAE,GAAG,GACX,aAAa,CAAC,OAAO,CAAC,CAexB"}
|