@loaders.gl/ply 3.0.13 → 3.0.14
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/dist.es5.min.js +1 -1
- package/dist/dist.es5.min.js.map +1 -1
- package/dist/dist.min.js +1 -1
- package/dist/es5/bundle.js +2 -2
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/index.js +37 -5
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/normalize-ply.js +4 -4
- package/dist/es5/lib/normalize-ply.js.map +1 -1
- package/dist/es5/lib/parse-ply-in-batches.js +247 -107
- package/dist/es5/lib/parse-ply-in-batches.js.map +1 -1
- package/dist/es5/lib/parse-ply.js +55 -52
- package/dist/es5/lib/parse-ply.js.map +1 -1
- package/dist/es5/ply-loader.js +3 -3
- package/dist/es5/ply-loader.js.map +1 -1
- package/dist/esm/ply-loader.js +1 -1
- package/dist/ply-worker.js +1 -1
- package/dist/ply-worker.js.map +1 -1
- package/package.json +5 -5
package/dist/dist.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(r,s,function(t){return e[t]}.bind(null,s));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){},function(e,t,n){(function(t){const r=n(3),s="undefined"==typeof window?t:window;s.loaders=s.loaders||{},e.exports=Object.assign(s.loaders,r)}).call(this,n(2))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t),n.d(t,"PLYWorkerLoader",(function(){return r})),n.d(t,"PLYLoader",(function(){return w})),n.d(t,"_typecheckPLYLoader",(function(){return b}));const r={name:"PLY",id:"ply",module:"ply",version:"3.0.
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(r,s,function(t){return e[t]}.bind(null,s));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){},function(e,t,n){(function(t){const r=n(3),s="undefined"==typeof window?t:window;s.loaders=s.loaders||{},e.exports=Object.assign(s.loaders,r)}).call(this,n(2))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t),n.d(t,"PLYWorkerLoader",(function(){return r})),n.d(t,"PLYLoader",(function(){return w})),n.d(t,"_typecheckPLYLoader",(function(){return b}));const r={name:"PLY",id:"ply",module:"ply",version:"3.0.14",worker:!0,extensions:["ply"],mimeTypes:["text/plain","application/octet-stream"],text:!0,binary:!0,tests:["ply"],options:{ply:{}}};function s(e){let t=1/0,n=1/0,r=1/0,s=-1/0,o=-1/0,i=-1/0;const c=e.POSITION?e.POSITION.value:[],a=c&&c.length;for(let e=0;e<a;e+=3){const a=c[e],u=c[e+1],l=c[e+2];t=a<t?a:t,n=u<n?u:n,r=l<r?l:r,s=a>s?a:s,o=u>o?u:o,i=l>i?l:i}return[[t,n,r],[s,o,i]]}function o(e,t,n){const r=function(e){const t={};t.POSITION={value:new Float32Array(e.vertices),size:3},e.normals.length>0&&(t.NORMAL={value:new Float32Array(e.normals),size:3});e.uvs.length>0&&(t.TEXCOORD_0={value:new Float32Array(e.uvs),size:2});e.colors.length>0&&(t.COLOR_0={value:new Uint8Array(e.colors),size:3,normalized:!0});return t}(t),o={loaderData:{header:e},header:{vertexCount:t.indices.length||t.vertices.length/3,boundingBox:s(r)},mode:t.indices&&t.indices.length>0?4:0,attributes:r,indices:{value:new Uint32Array(0),size:0}};return t.indices&&t.indices.length>0&&(o.indices={value:new Uint32Array(t.indices),size:1}),o}function i(e,t={}){let n,r;if(e instanceof ArrayBuffer){const s=(new TextDecoder).decode(e);n=c(s,t),r="ascii"===n.format?f(s,n):function(e,t){const n={indices:[],vertices:[],normals:[],uvs:[],colors:[]},r="binary_little_endian"===t.format,s=new DataView(e,t.headerLength);let o,i=0;for(let e=0;e<t.elements.length;e++){const c=t.elements[e].count;for(let a=0;a<c;a++){o=m(s,i,t.elements[e].properties,r),i+=o[1];const c=o[0];p(n,t.elements[e].name,c)}}return n}(e,n)}else n=c(e,t),r=f(e,n);return o(n,r)}function c(e,t){let n="",r=0;const s=/ply([\s\S]*)end_header\s/.exec(e);null!==s&&(n=s[1],r=s[0].length);return function(e,t,n){const r={comments:[],elements:[],headerLength:t};let s,o,i=null;for(let t=0;t<e.length;t++){let c=e[t];if(c=c.trim(),""!==c)switch(o=c.split(/\s+/),s=o.shift(),c=o.join(" "),s){case"format":r.format=o[0],r.version=o[1];break;case"comment":r.comments.push(c);break;case"element":i&&r.elements.push(i),i={name:o[0],count:parseInt(o[1],10),properties:[]};break;case"property":if(!i)break;i.properties.push(a(o,n.propertyNameMapping));break;default:console.log("unhandled",s,o)}}void 0!==i&&r.elements.push(i);return r}(n.split("\n"),r,t)}function a(e,t){const n={type:e[0]};return"list"===n.type?(n.name=e[3],n.countType=e[1],n.itemType=e[2]):n.name=e[1],t&&n.name in t&&(n.name=t[n.name]),n}function u(e,t){switch(t){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(e,10);case"float":case"double":case"float32":case"float64":return parseFloat(e);default:throw new Error(t)}}function l(e,t){const n=t.split(/\s+/),r={};for(let t=0;t<e.length;t++)if("list"===e[t].type){const s=[],o=u(n.shift(),e[t].countType);for(let r=0;r<o;r++)s.push(u(n.shift(),e[t].itemType));r[e[t].name]=s}else r[e[t].name]=u(n.shift(),e[t].type);return r}function f(e,t){const n={indices:[],vertices:[],normals:[],uvs:[],colors:[]};let r;let s="";null!==(r=/end_header\s([\s\S]*)$/.exec(e))&&(s=r[1]);const o=s.split("\n");let i=0,c=0;for(let e=0;e<o.length;e++){let r=o[e];if(r=r.trim(),""!==r){c>=t.elements[i].count&&(i++,c=0);const e=l(t.elements[i].properties,r);p(n,t.elements[i].name,e),c++}}return n}function p(e,t,n={}){if("vertex"===t)e.vertices.push(n.x,n.y,n.z),"nx"in n&&"ny"in n&&"nz"in n&&e.normals.push(n.nx,n.ny,n.nz),"s"in n&&"t"in n&&e.uvs.push(n.s,n.t),"red"in n&&"green"in n&&"blue"in n&&e.colors.push(n.red,n.green,n.blue);else if("face"===t){const t=n.vertex_indices||n.vertex_index;3===t.length?e.indices.push(t[0],t[1],t[2]):4===t.length&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3]))}}function d(e,t,n,r){switch(n){case"int8":case"char":return[e.getInt8(t),1];case"uint8":case"uchar":return[e.getUint8(t),1];case"int16":case"short":return[e.getInt16(t,r),2];case"uint16":case"ushort":return[e.getUint16(t,r),2];case"int32":case"int":return[e.getInt32(t,r),4];case"uint32":case"uint":return[e.getUint32(t,r),4];case"float32":case"float":return[e.getFloat32(t,r),4];case"float64":case"double":return[e.getFloat64(t,r),8];default:throw new Error(n)}}function m(e,t,n,r){const s={};let o,i=0;for(let c=0;c<n.length;c++)if("list"===n[c].type){const a=[];o=d(e,t+i,n[c].countType,r);const u=o[0];i+=o[1];for(let s=0;s<u;s++)o=d(e,t+i,n[c].itemType,r),a.push(o[0]),i+=o[1];s[n[c].name]=a}else o=d(e,t+i,n[c].type,r),s[n[c].name]=o[0],i+=o[1];return[s,i]}n(0);let h;function y(e,t){switch(t){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(e,10);case"float":case"double":case"float32":case"float64":return parseFloat(e);default:throw new Error(t)}}function g(e,t){const n=t.split(/\s+/),r={};for(let t=0;t<e.length;t++)if("list"===e[t].type){const s=[],o=y(n.shift(),e[t].countType);for(let r=0;r<o;r++)s.push(y(n.shift(),e[t].itemType));r[e[t].name]=s}else r[e[t].name]=y(n.shift(),e[t].type);return r}function v(e,t,n={}){switch(t){case"vertex":e.vertices.push(n.x,n.y,n.z),"nx"in n&&"ny"in n&&"nz"in n&&e.normals.push(n.nx,n.ny,n.nz),"s"in n&&"t"in n&&e.uvs.push(n.s,n.t),"red"in n&&"green"in n&&"blue"in n&&e.colors.push(n.red/255,n.green/255,n.blue/255);break;case"face":const t=n.vertex_indices||n.vertex_index;3===t.length?e.indices.push(t[0],t[1],t[2]):4===t.length&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3]))}}const w={...r,parse:async(e,t)=>i(e,t),parseTextSync:i,parseSync:i,parseInBatches:async function*(e,t){const n=async function*(e){let t="";for await(const n of e){let e;for(t+=n;(e=t.indexOf("\n"))>=0;){const n=t.slice(0,e+1);t=t.slice(e+1),yield n}}t.length>0&&(yield t)}(async function*(e,t={}){const n=new TextDecoder(void 0,t);for await(const t of e)yield"string"==typeof t?t:n.decode(t,{stream:!0})}(e)),r=await async function(e,t){const n={comments:[],elements:[]};await async function(e,t){for(;;){const{done:n,value:r}=await e.next();if(n)return void e.return();if(t(r))return}}(e,e=>{if("end_header"===(e=e.trim()))return!0;if(""===e)return!1;const r=e.split(/\s+/),s=r.shift();switch(e=r.join(" "),s){case"ply":break;case"format":n.format=r[0],n.version=r[1];break;case"comment":n.comments.push(e);break;case"element":h&&n.elements.push(h),h={name:r[0],count:parseInt(r[1],10),properties:[]};break;case"property":const o=function(e,t){const n={type:e[0]};"list"===n.type?(n.name=e[3],n.countType=e[1],n.itemType=e[2]):n.name=e[1];t&&n.name in t&&(n.name=t[n.name]);return n}(r,t.propertyNameMapping);h.properties.push(o);break;default:console.log("unhandled",s,r)}return!1}),h&&n.elements.push(h);return n}(n,t);let s;switch(r.format){case"ascii":s=await async function(e,t){const n={indices:[],vertices:[],normals:[],uvs:[],colors:[]};let r=0,s=0;for await(let o of e)if(o=o.trim(),""!==o){s>=t.elements[r].count&&(r++,s=0);const e=g(t.elements[r].properties,o);v(n,t.elements[r].name,e),s++}return n}(n,r);break;default:throw new Error("Binary PLY can not yet be parsed in streaming mode")}yield o(r,s)}},b=w}])}));
|
|
2
2
|
//# sourceMappingURL=dist.min.js.map
|
package/dist/es5/bundle.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var moduleExports = require('./index');
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
var _global = typeof window === 'undefined' ? global : window;
|
|
6
6
|
|
|
7
7
|
_global.loaders = _global.loaders || {};
|
|
8
8
|
module.exports = Object.assign(_global.loaders, moduleExports);
|
package/dist/es5/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","_global","window","global","loaders","module","exports","Object","assign"],"mappings":";;AACA,
|
|
1
|
+
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","_global","window","global","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACA,IAAMC,OAAO,GAAG,OAAOC,MAAP,KAAkB,WAAlB,GAAgCC,MAAhC,GAAyCD,MAAzD;;AACAD,OAAO,CAACG,OAAR,GAAkBH,OAAO,CAACG,OAAR,IAAmB,EAArC;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcP,OAAO,CAACG,OAAtB,EAA+BL,aAA/B,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nconst _global = typeof window === 'undefined' ? global : window;\n_global.loaders = _global.loaders || {};\nmodule.exports = Object.assign(_global.loaders, moduleExports);\n"],"file":"bundle.js"}
|
package/dist/es5/index.js
CHANGED
|
@@ -7,25 +7,57 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
Object.defineProperty(exports, "PLYWorkerLoader", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () {
|
|
10
|
+
get: function get() {
|
|
11
11
|
return _plyLoader.PLYLoader;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
exports._typecheckPLYLoader = exports.PLYLoader = void 0;
|
|
15
15
|
|
|
16
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
17
|
+
|
|
18
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
19
|
+
|
|
20
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
+
|
|
16
22
|
var _plyLoader = require("./ply-loader");
|
|
17
23
|
|
|
18
24
|
var _parsePly = _interopRequireDefault(require("./lib/parse-ply"));
|
|
19
25
|
|
|
20
26
|
var _parsePlyInBatches = _interopRequireDefault(require("./lib/parse-ply-in-batches"));
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
31
|
+
|
|
32
|
+
var PLYLoader = _objectSpread(_objectSpread({}, _plyLoader.PLYLoader), {}, {
|
|
33
|
+
parse: function () {
|
|
34
|
+
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
|
|
35
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
36
|
+
while (1) {
|
|
37
|
+
switch (_context.prev = _context.next) {
|
|
38
|
+
case 0:
|
|
39
|
+
return _context.abrupt("return", (0, _parsePly.default)(arrayBuffer, options));
|
|
40
|
+
|
|
41
|
+
case 1:
|
|
42
|
+
case "end":
|
|
43
|
+
return _context.stop();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, _callee);
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
function parse(_x, _x2) {
|
|
50
|
+
return _parse.apply(this, arguments);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return parse;
|
|
54
|
+
}(),
|
|
24
55
|
parseTextSync: _parsePly.default,
|
|
25
56
|
parseSync: _parsePly.default,
|
|
26
57
|
parseInBatches: _parsePlyInBatches.default
|
|
27
|
-
};
|
|
58
|
+
});
|
|
59
|
+
|
|
28
60
|
exports.PLYLoader = PLYLoader;
|
|
29
|
-
|
|
61
|
+
var _typecheckPLYLoader = PLYLoader;
|
|
30
62
|
exports._typecheckPLYLoader = _typecheckPLYLoader;
|
|
31
63
|
//# sourceMappingURL=index.js.map
|
package/dist/es5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":["PLYLoader","PLYWorkerLoader","parse","arrayBuffer","options","parseTextSync","parsePLY","parseSync","parseInBatches","parsePLYInBatches","_typecheckPLYLoader"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":["PLYLoader","PLYWorkerLoader","parse","arrayBuffer","options","parseTextSync","parsePLY","parseSync","parseInBatches","parsePLYInBatches","_typecheckPLYLoader"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;;;;;AASO,IAAMA,SAAS,mCACjBC,oBADiB;AAGpBC,EAAAA,KAAK;AAAA,2EAAE,iBAAOC,WAAP,EAAoBC,OAApB;AAAA;AAAA;AAAA;AAAA;AAAA,+CAAgC,uBAASD,WAAT,EAAsBC,OAAtB,CAAhC;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAF;;AAAA;AAAA;AAAA;;AAAA;AAAA,KAHe;AAIpBC,EAAAA,aAAa,EAAEC,iBAJK;AAKpBC,EAAAA,SAAS,EAAED,iBALS;AAMpBE,EAAAA,cAAc,EAAEC;AANI,EAAf;;;AASA,IAAMC,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"}
|
|
@@ -8,10 +8,10 @@ exports.default = normalizePLY;
|
|
|
8
8
|
var _schema = require("@loaders.gl/schema");
|
|
9
9
|
|
|
10
10
|
function normalizePLY(header, attributes, options) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
var normalizedAttributes = normalizeAttributes(attributes);
|
|
12
|
+
var result = {
|
|
13
13
|
loaderData: {
|
|
14
|
-
header
|
|
14
|
+
header: header
|
|
15
15
|
},
|
|
16
16
|
header: {
|
|
17
17
|
vertexCount: attributes.indices.length || attributes.vertices.length / 3,
|
|
@@ -36,7 +36,7 @@ function normalizePLY(header, attributes, options) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function normalizeAttributes(attributes) {
|
|
39
|
-
|
|
39
|
+
var accessors = {};
|
|
40
40
|
accessors.POSITION = {
|
|
41
41
|
value: new Float32Array(attributes.vertices),
|
|
42
42
|
size: 3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/normalize-ply.ts"],"names":["normalizePLY","header","attributes","options","normalizedAttributes","normalizeAttributes","result","loaderData","vertexCount","indices","length","vertices","boundingBox","mode","value","Uint32Array","size","accessors","POSITION","Float32Array","normals","NORMAL","uvs","TEXCOORD_0","colors","COLOR_0","Uint8Array","normalized"],"mappings":";;;;;;;AACA;;AAOe,SAASA,YAAT,CACbC,MADa,EAEbC,UAFa,EAGbC,OAHa,EAIJ;AACT,
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/normalize-ply.ts"],"names":["normalizePLY","header","attributes","options","normalizedAttributes","normalizeAttributes","result","loaderData","vertexCount","indices","length","vertices","boundingBox","mode","value","Uint32Array","size","accessors","POSITION","Float32Array","normals","NORMAL","uvs","TEXCOORD_0","colors","COLOR_0","Uint8Array","normalized"],"mappings":";;;;;;;AACA;;AAOe,SAASA,YAAT,CACbC,MADa,EAEbC,UAFa,EAGbC,OAHa,EAIJ;AACT,MAAMC,oBAAoB,GAAGC,mBAAmB,CAACH,UAAD,CAAhD;AAEA,MAAMI,MAAM,GAAG;AACbC,IAAAA,UAAU,EAAE;AACVN,MAAAA,MAAM,EAANA;AADU,KADC;AAMbA,IAAAA,MAAM,EAAE;AACNO,MAAAA,WAAW,EAAEN,UAAU,CAACO,OAAX,CAAmBC,MAAnB,IAA6BR,UAAU,CAACS,QAAX,CAAoBD,MAApB,GAA6B,CADjE;AAENE,MAAAA,WAAW,EAAE,gCAAmBR,oBAAnB;AAFP,KANK;AAUbS,IAAAA,IAAI,EAAEX,UAAU,CAACO,OAAX,IAAsBP,UAAU,CAACO,OAAX,CAAmBC,MAAnB,GAA4B,CAAlD,GAAsD,CAAtD,GAA0D,CAVnD;AAWbR,IAAAA,UAAU,EAAEE,oBAXC;AAYbK,IAAAA,OAAO,EAAE;AAACK,MAAAA,KAAK,EAAE,IAAIC,WAAJ,CAAgB,CAAhB,CAAR;AAA4BC,MAAAA,IAAI,EAAE;AAAlC;AAZI,GAAf;;AAeA,MAAId,UAAU,CAACO,OAAX,IAAsBP,UAAU,CAACO,OAAX,CAAmBC,MAAnB,GAA4B,CAAtD,EAAyD;AACvDJ,IAAAA,MAAM,CAACG,OAAP,GAAiB;AAACK,MAAAA,KAAK,EAAE,IAAIC,WAAJ,CAAgBb,UAAU,CAACO,OAA3B,CAAR;AAA6CO,MAAAA,IAAI,EAAE;AAAnD,KAAjB;AACD;;AAED,SAAOV,MAAP;AACD;;AAMD,SAASD,mBAAT,CAA6BH,UAA7B,EAAsE;AACpE,MAAMe,SAAuB,GAAG,EAAhC;AAEAA,EAAAA,SAAS,CAACC,QAAV,GAAqB;AAACJ,IAAAA,KAAK,EAAE,IAAIK,YAAJ,CAAiBjB,UAAU,CAACS,QAA5B,CAAR;AAA+CK,IAAAA,IAAI,EAAE;AAArD,GAArB;;AAIA,MAAId,UAAU,CAACkB,OAAX,CAAmBV,MAAnB,GAA4B,CAAhC,EAAmC;AACjCO,IAAAA,SAAS,CAACI,MAAV,GAAmB;AAACP,MAAAA,KAAK,EAAE,IAAIK,YAAJ,CAAiBjB,UAAU,CAACkB,OAA5B,CAAR;AAA8CJ,MAAAA,IAAI,EAAE;AAApD,KAAnB;AACD;;AAED,MAAId,UAAU,CAACoB,GAAX,CAAeZ,MAAf,GAAwB,CAA5B,EAA+B;AAC7BO,IAAAA,SAAS,CAACM,UAAV,GAAuB;AAACT,MAAAA,KAAK,EAAE,IAAIK,YAAJ,CAAiBjB,UAAU,CAACoB,GAA5B,CAAR;AAA0CN,MAAAA,IAAI,EAAE;AAAhD,KAAvB;AACD;;AAED,MAAId,UAAU,CAACsB,MAAX,CAAkBd,MAAlB,GAA2B,CAA/B,EAAkC;AAEhCO,IAAAA,SAAS,CAACQ,OAAV,GAAoB;AAACX,MAAAA,KAAK,EAAE,IAAIY,UAAJ,CAAexB,UAAU,CAACsB,MAA1B,CAAR;AAA2CR,MAAAA,IAAI,EAAE,CAAjD;AAAoDW,MAAAA,UAAU,EAAE;AAAhE,KAApB;AACD;;AAED,SAAOV,SAAP;AACD","sourcesContent":["import type {PlyAccessors, PlyData, PlyAttributes, NormalizeHeader, PlyHeader} from './types';\nimport {getMeshBoundingBox} from '@loaders.gl/schema';\n\n/**\n * @param header\n * @param attributes\n * @returns data and header\n */\nexport default function normalizePLY(\n header: NormalizeHeader & PlyHeader,\n attributes: PlyAttributes,\n options?: {}\n): PlyData {\n const normalizedAttributes = normalizeAttributes(attributes);\n\n const result = {\n loaderData: {\n header\n },\n // TODO - how to detect POINT CLOUDS vs MESHES?\n // TODO - For Meshes, PLY quadrangles must be split?\n header: {\n vertexCount: attributes.indices.length || attributes.vertices.length / 3,\n boundingBox: getMeshBoundingBox(normalizedAttributes)\n },\n mode: attributes.indices && attributes.indices.length > 0 ? 4 : 0, // TRIANGLES vs POINTS\n attributes: normalizedAttributes,\n indices: {value: new Uint32Array(0), size: 0}\n };\n\n if (attributes.indices && attributes.indices.length > 0) {\n result.indices = {value: new Uint32Array(attributes.indices), size: 1};\n }\n\n return result;\n}\n\n/**\n * @param attributes\n * @returns accessors []\n */\nfunction normalizeAttributes(attributes: PlyAttributes): PlyAccessors {\n const accessors: PlyAccessors = {};\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"}
|
|
@@ -7,95 +7,155 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = parsePLYInBatches;
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var _normalizePly = _interopRequireDefault(require("./normalize-ply"));
|
|
13
|
-
|
|
14
|
-
let currentElement;
|
|
15
|
-
|
|
16
|
-
async function* parsePLYInBatches(iterator, options) {
|
|
17
|
-
const lineIterator = (0, _core.makeLineIterator)((0, _core.makeTextDecoderIterator)(iterator));
|
|
18
|
-
const header = await parseHeader(lineIterator, options);
|
|
19
|
-
let attributes;
|
|
20
|
-
|
|
21
|
-
switch (header.format) {
|
|
22
|
-
case 'ascii':
|
|
23
|
-
attributes = await parseASCII(lineIterator, header);
|
|
24
|
-
break;
|
|
25
|
-
|
|
26
|
-
default:
|
|
27
|
-
throw new Error('Binary PLY can not yet be parsed in streaming mode');
|
|
28
|
-
}
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
29
11
|
|
|
30
|
-
|
|
31
|
-
}
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
32
13
|
|
|
33
|
-
|
|
34
|
-
const header = {
|
|
35
|
-
comments: [],
|
|
36
|
-
elements: []
|
|
37
|
-
};
|
|
38
|
-
await (0, _core.forEach)(lineIterator, line => {
|
|
39
|
-
line = line.trim();
|
|
14
|
+
var _asyncIterator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncIterator"));
|
|
40
15
|
|
|
41
|
-
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
16
|
+
var _awaitAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/awaitAsyncGenerator"));
|
|
44
17
|
|
|
45
|
-
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
18
|
+
var _wrapAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapAsyncGenerator"));
|
|
48
19
|
|
|
49
|
-
|
|
50
|
-
const lineType = lineValues.shift();
|
|
51
|
-
line = lineValues.join(' ');
|
|
20
|
+
var _core = require("@loaders.gl/core");
|
|
52
21
|
|
|
53
|
-
|
|
54
|
-
case 'ply':
|
|
55
|
-
break;
|
|
22
|
+
var _normalizePly = _interopRequireDefault(require("./normalize-ply"));
|
|
56
23
|
|
|
57
|
-
|
|
58
|
-
header.format = lineValues[0];
|
|
59
|
-
header.version = lineValues[1];
|
|
60
|
-
break;
|
|
24
|
+
var currentElement;
|
|
61
25
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
26
|
+
function parsePLYInBatches(_x, _x2) {
|
|
27
|
+
return _parsePLYInBatches.apply(this, arguments);
|
|
28
|
+
}
|
|
65
29
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
30
|
+
function _parsePLYInBatches() {
|
|
31
|
+
_parsePLYInBatches = (0, _wrapAsyncGenerator2.default)(_regenerator.default.mark(function _callee(iterator, options) {
|
|
32
|
+
var lineIterator, header, attributes;
|
|
33
|
+
return _regenerator.default.wrap(function _callee$(_context2) {
|
|
34
|
+
while (1) {
|
|
35
|
+
switch (_context2.prev = _context2.next) {
|
|
36
|
+
case 0:
|
|
37
|
+
lineIterator = (0, _core.makeLineIterator)((0, _core.makeTextDecoderIterator)(iterator));
|
|
38
|
+
_context2.next = 3;
|
|
39
|
+
return (0, _awaitAsyncGenerator2.default)(parseHeader(lineIterator, options));
|
|
40
|
+
|
|
41
|
+
case 3:
|
|
42
|
+
header = _context2.sent;
|
|
43
|
+
_context2.t0 = header.format;
|
|
44
|
+
_context2.next = _context2.t0 === 'ascii' ? 7 : 11;
|
|
45
|
+
break;
|
|
46
|
+
|
|
47
|
+
case 7:
|
|
48
|
+
_context2.next = 9;
|
|
49
|
+
return (0, _awaitAsyncGenerator2.default)(parseASCII(lineIterator, header));
|
|
50
|
+
|
|
51
|
+
case 9:
|
|
52
|
+
attributes = _context2.sent;
|
|
53
|
+
return _context2.abrupt("break", 12);
|
|
54
|
+
|
|
55
|
+
case 11:
|
|
56
|
+
throw new Error('Binary PLY can not yet be parsed in streaming mode');
|
|
57
|
+
|
|
58
|
+
case 12:
|
|
59
|
+
_context2.next = 14;
|
|
60
|
+
return (0, _normalizePly.default)(header, attributes, options);
|
|
61
|
+
|
|
62
|
+
case 14:
|
|
63
|
+
case "end":
|
|
64
|
+
return _context2.stop();
|
|
69
65
|
}
|
|
66
|
+
}
|
|
67
|
+
}, _callee);
|
|
68
|
+
}));
|
|
69
|
+
return _parsePLYInBatches.apply(this, arguments);
|
|
70
|
+
}
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
properties: []
|
|
75
|
-
};
|
|
76
|
-
break;
|
|
77
|
-
|
|
78
|
-
case 'property':
|
|
79
|
-
const property = makePLYElementProperty(lineValues, options.propertyNameMapping);
|
|
80
|
-
currentElement.properties.push(property);
|
|
81
|
-
break;
|
|
82
|
-
|
|
83
|
-
default:
|
|
84
|
-
console.log('unhandled', lineType, lineValues);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return false;
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
if (currentElement) {
|
|
91
|
-
header.elements.push(currentElement);
|
|
92
|
-
}
|
|
72
|
+
function parseHeader(_x3, _x4) {
|
|
73
|
+
return _parseHeader.apply(this, arguments);
|
|
74
|
+
}
|
|
93
75
|
|
|
94
|
-
|
|
76
|
+
function _parseHeader() {
|
|
77
|
+
_parseHeader = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(lineIterator, options) {
|
|
78
|
+
var header;
|
|
79
|
+
return _regenerator.default.wrap(function _callee2$(_context3) {
|
|
80
|
+
while (1) {
|
|
81
|
+
switch (_context3.prev = _context3.next) {
|
|
82
|
+
case 0:
|
|
83
|
+
header = {
|
|
84
|
+
comments: [],
|
|
85
|
+
elements: []
|
|
86
|
+
};
|
|
87
|
+
_context3.next = 3;
|
|
88
|
+
return (0, _core.forEach)(lineIterator, function (line) {
|
|
89
|
+
line = line.trim();
|
|
90
|
+
|
|
91
|
+
if (line === 'end_header') {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (line === '') {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
var lineValues = line.split(/\s+/);
|
|
100
|
+
var lineType = lineValues.shift();
|
|
101
|
+
line = lineValues.join(' ');
|
|
102
|
+
|
|
103
|
+
switch (lineType) {
|
|
104
|
+
case 'ply':
|
|
105
|
+
break;
|
|
106
|
+
|
|
107
|
+
case 'format':
|
|
108
|
+
header.format = lineValues[0];
|
|
109
|
+
header.version = lineValues[1];
|
|
110
|
+
break;
|
|
111
|
+
|
|
112
|
+
case 'comment':
|
|
113
|
+
header.comments.push(line);
|
|
114
|
+
break;
|
|
115
|
+
|
|
116
|
+
case 'element':
|
|
117
|
+
if (currentElement) {
|
|
118
|
+
header.elements.push(currentElement);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
currentElement = {
|
|
122
|
+
name: lineValues[0],
|
|
123
|
+
count: parseInt(lineValues[1], 10),
|
|
124
|
+
properties: []
|
|
125
|
+
};
|
|
126
|
+
break;
|
|
127
|
+
|
|
128
|
+
case 'property':
|
|
129
|
+
var property = makePLYElementProperty(lineValues, options.propertyNameMapping);
|
|
130
|
+
currentElement.properties.push(property);
|
|
131
|
+
break;
|
|
132
|
+
|
|
133
|
+
default:
|
|
134
|
+
console.log('unhandled', lineType, lineValues);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return false;
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
case 3:
|
|
141
|
+
if (currentElement) {
|
|
142
|
+
header.elements.push(currentElement);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return _context3.abrupt("return", header);
|
|
146
|
+
|
|
147
|
+
case 5:
|
|
148
|
+
case "end":
|
|
149
|
+
return _context3.stop();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}, _callee2);
|
|
153
|
+
}));
|
|
154
|
+
return _parseHeader.apply(this, arguments);
|
|
95
155
|
}
|
|
96
156
|
|
|
97
157
|
function makePLYElementProperty(propertValues, propertyNameMapping) {
|
|
98
|
-
|
|
158
|
+
var property = {
|
|
99
159
|
type: propertValues[0]
|
|
100
160
|
};
|
|
101
161
|
|
|
@@ -114,33 +174,111 @@ function makePLYElementProperty(propertValues, propertyNameMapping) {
|
|
|
114
174
|
return property;
|
|
115
175
|
}
|
|
116
176
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
177
|
+
function parseASCII(lineIterator, header) {
|
|
178
|
+
var attributes, currentElement, currentElementCount, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, line, element;
|
|
179
|
+
|
|
180
|
+
return _regenerator.default.async(function parseASCII$(_context) {
|
|
181
|
+
while (1) {
|
|
182
|
+
switch (_context.prev = _context.next) {
|
|
183
|
+
case 0:
|
|
184
|
+
attributes = {
|
|
185
|
+
indices: [],
|
|
186
|
+
vertices: [],
|
|
187
|
+
normals: [],
|
|
188
|
+
uvs: [],
|
|
189
|
+
colors: []
|
|
190
|
+
};
|
|
191
|
+
currentElement = 0;
|
|
192
|
+
currentElementCount = 0;
|
|
193
|
+
_iteratorNormalCompletion = true;
|
|
194
|
+
_didIteratorError = false;
|
|
195
|
+
_context.prev = 5;
|
|
196
|
+
_iterator = (0, _asyncIterator2.default)(lineIterator);
|
|
197
|
+
|
|
198
|
+
case 7:
|
|
199
|
+
_context.next = 9;
|
|
200
|
+
return _regenerator.default.awrap(_iterator.next());
|
|
201
|
+
|
|
202
|
+
case 9:
|
|
203
|
+
_step = _context.sent;
|
|
204
|
+
_iteratorNormalCompletion = _step.done;
|
|
205
|
+
_context.next = 13;
|
|
206
|
+
return _regenerator.default.awrap(_step.value);
|
|
207
|
+
|
|
208
|
+
case 13:
|
|
209
|
+
_value = _context.sent;
|
|
210
|
+
|
|
211
|
+
if (_iteratorNormalCompletion) {
|
|
212
|
+
_context.next = 21;
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
line = _value;
|
|
217
|
+
line = line.trim();
|
|
218
|
+
|
|
219
|
+
if (line !== '') {
|
|
220
|
+
if (currentElementCount >= header.elements[currentElement].count) {
|
|
221
|
+
currentElement++;
|
|
222
|
+
currentElementCount = 0;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
element = parseASCIIElement(header.elements[currentElement].properties, line);
|
|
226
|
+
handleElement(attributes, header.elements[currentElement].name, element);
|
|
227
|
+
currentElementCount++;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
case 18:
|
|
231
|
+
_iteratorNormalCompletion = true;
|
|
232
|
+
_context.next = 7;
|
|
233
|
+
break;
|
|
234
|
+
|
|
235
|
+
case 21:
|
|
236
|
+
_context.next = 27;
|
|
237
|
+
break;
|
|
238
|
+
|
|
239
|
+
case 23:
|
|
240
|
+
_context.prev = 23;
|
|
241
|
+
_context.t0 = _context["catch"](5);
|
|
242
|
+
_didIteratorError = true;
|
|
243
|
+
_iteratorError = _context.t0;
|
|
244
|
+
|
|
245
|
+
case 27:
|
|
246
|
+
_context.prev = 27;
|
|
247
|
+
_context.prev = 28;
|
|
248
|
+
|
|
249
|
+
if (!(!_iteratorNormalCompletion && _iterator.return != null)) {
|
|
250
|
+
_context.next = 32;
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
_context.next = 32;
|
|
255
|
+
return _regenerator.default.awrap(_iterator.return());
|
|
256
|
+
|
|
257
|
+
case 32:
|
|
258
|
+
_context.prev = 32;
|
|
259
|
+
|
|
260
|
+
if (!_didIteratorError) {
|
|
261
|
+
_context.next = 35;
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
throw _iteratorError;
|
|
266
|
+
|
|
267
|
+
case 35:
|
|
268
|
+
return _context.finish(32);
|
|
269
|
+
|
|
270
|
+
case 36:
|
|
271
|
+
return _context.finish(27);
|
|
272
|
+
|
|
273
|
+
case 37:
|
|
274
|
+
return _context.abrupt("return", attributes);
|
|
275
|
+
|
|
276
|
+
case 38:
|
|
277
|
+
case "end":
|
|
278
|
+
return _context.stop();
|
|
135
279
|
}
|
|
136
|
-
|
|
137
|
-
const element = parseASCIIElement(header.elements[currentElement].properties, line);
|
|
138
|
-
handleElement(attributes, header.elements[currentElement].name, element);
|
|
139
|
-
currentElementCount++;
|
|
140
280
|
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return attributes;
|
|
281
|
+
}, null, null, [[5, 23, 27, 37], [28,, 32, 36]], Promise);
|
|
144
282
|
}
|
|
145
283
|
|
|
146
284
|
function parseASCIINumber(n, type) {
|
|
@@ -171,15 +309,15 @@ function parseASCIINumber(n, type) {
|
|
|
171
309
|
}
|
|
172
310
|
|
|
173
311
|
function parseASCIIElement(properties, line) {
|
|
174
|
-
|
|
175
|
-
|
|
312
|
+
var values = line.split(/\s+/);
|
|
313
|
+
var element = {};
|
|
176
314
|
|
|
177
|
-
for (
|
|
315
|
+
for (var i = 0; i < properties.length; i++) {
|
|
178
316
|
if (properties[i].type === 'list') {
|
|
179
|
-
|
|
180
|
-
|
|
317
|
+
var list = [];
|
|
318
|
+
var n = parseASCIINumber(values.shift(), properties[i].countType);
|
|
181
319
|
|
|
182
|
-
for (
|
|
320
|
+
for (var j = 0; j < n; j++) {
|
|
183
321
|
list.push(parseASCIINumber(values.shift(), properties[i].itemType));
|
|
184
322
|
}
|
|
185
323
|
|
|
@@ -192,7 +330,9 @@ function parseASCIIElement(properties, line) {
|
|
|
192
330
|
return element;
|
|
193
331
|
}
|
|
194
332
|
|
|
195
|
-
function handleElement(buffer, elementName
|
|
333
|
+
function handleElement(buffer, elementName) {
|
|
334
|
+
var element = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
335
|
+
|
|
196
336
|
switch (elementName) {
|
|
197
337
|
case 'vertex':
|
|
198
338
|
buffer.vertices.push(element.x, element.y, element.z);
|
|
@@ -212,7 +352,7 @@ function handleElement(buffer, elementName, element = {}) {
|
|
|
212
352
|
break;
|
|
213
353
|
|
|
214
354
|
case 'face':
|
|
215
|
-
|
|
355
|
+
var vertexIndices = element.vertex_indices || element.vertex_index;
|
|
216
356
|
|
|
217
357
|
if (vertexIndices.length === 3) {
|
|
218
358
|
buffer.indices.push(vertexIndices[0], vertexIndices[1], vertexIndices[2]);
|