@loaders.gl/obj 3.1.0-alpha.4 → 4.0.0-alpha.1

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.
Files changed (41) hide show
  1. package/dist/{esm/bundle.js → bundle.js} +0 -0
  2. package/dist/bundle.js.map +1 -0
  3. package/dist/{esm/index.js → index.js} +0 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/{esm/lib → lib}/get-obj-schema.js +0 -0
  6. package/dist/lib/get-obj-schema.js.map +1 -0
  7. package/dist/{esm/lib → lib}/load-obj.js +0 -0
  8. package/dist/lib/load-obj.js.map +1 -0
  9. package/dist/{esm/lib → lib}/obj-types.js +0 -0
  10. package/dist/{es5/lib → lib}/obj-types.js.map +0 -0
  11. package/dist/{esm/lib → lib}/parse-obj.js +1 -1
  12. package/dist/lib/parse-obj.js.map +1 -0
  13. package/dist/{esm/obj-loader.js → obj-loader.js} +1 -1
  14. package/dist/obj-loader.js.map +1 -0
  15. package/dist/obj-worker.js +1134 -2
  16. package/dist/{es5/workers → workers}/obj-worker.js +0 -0
  17. package/package.json +8 -8
  18. package/dist/dist.min.js +0 -2
  19. package/dist/dist.min.js.map +0 -1
  20. package/dist/es5/bundle.js +0 -7
  21. package/dist/es5/bundle.js.map +0 -1
  22. package/dist/es5/index.js +0 -59
  23. package/dist/es5/index.js.map +0 -1
  24. package/dist/es5/lib/get-obj-schema.js +0 -46
  25. package/dist/es5/lib/get-obj-schema.js.map +0 -1
  26. package/dist/es5/lib/load-obj.js +0 -121
  27. package/dist/es5/lib/load-obj.js.map +0 -1
  28. package/dist/es5/lib/obj-types.js +0 -2
  29. package/dist/es5/lib/parse-obj.js +0 -561
  30. package/dist/es5/lib/parse-obj.js.map +0 -1
  31. package/dist/es5/obj-loader.js +0 -29
  32. package/dist/es5/obj-loader.js.map +0 -1
  33. package/dist/esm/bundle.js.map +0 -1
  34. package/dist/esm/index.js.map +0 -1
  35. package/dist/esm/lib/get-obj-schema.js.map +0 -1
  36. package/dist/esm/lib/load-obj.js.map +0 -1
  37. package/dist/esm/lib/obj-types.js.map +0 -1
  38. package/dist/esm/lib/parse-obj.js.map +0 -1
  39. package/dist/esm/obj-loader.js.map +0 -1
  40. package/dist/esm/workers/obj-worker.js +0 -4
  41. package/dist/obj-worker.js.map +0 -1
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/obj",
3
- "version": "3.1.0-alpha.4",
3
+ "version": "4.0.0-alpha.1",
4
4
  "description": "Framework-independent loader for the OBJ format",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -19,8 +19,8 @@
19
19
  "OBJ"
20
20
  ],
21
21
  "types": "src/index.ts",
22
- "main": "dist/es5/index.js",
23
- "module": "dist/esm/index.js",
22
+ "main": "dist/index.js",
23
+ "module": "dist/index.js",
24
24
  "sideEffects": false,
25
25
  "files": [
26
26
  "src",
@@ -29,13 +29,13 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "pre-build": "npm run build-worker && npm run build-bundle",
32
- "build-bundle": "webpack --display=minimal --config ../../scripts/webpack/bundle.js",
33
- "build-worker": "webpack --entry ./src/workers/obj-worker.js --output ./dist/obj-worker.js --config ../../scripts/webpack/worker.js"
32
+ "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/bundle.js",
33
+ "build-worker": "esbuild src/workers/obj-worker.js --bundle --outfile=dist/obj-worker.js"
34
34
  },
35
35
  "dependencies": {
36
36
  "@babel/runtime": "^7.3.1",
37
- "@loaders.gl/loader-utils": "3.1.0-alpha.4",
38
- "@loaders.gl/schema": "3.1.0-alpha.4"
37
+ "@loaders.gl/loader-utils": "4.0.0-alpha.1",
38
+ "@loaders.gl/schema": "4.0.0-alpha.1"
39
39
  },
40
- "gitHead": "e309784af37ef9f3640c7733c7851124c72e1fa3"
40
+ "gitHead": "e48f5534fe7188c810f23f965a440c144b3cf6d0"
41
41
  }
package/dist/dist.min.js DELETED
@@ -1,2 +0,0 @@
1
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var i in s)("object"==typeof exports?exports:t)[i]=s[i]}}(window,(function(){return function(t){var e={};function s(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,s),n.l=!0,n.exports}return s.m=t,s.c=e,s.d=function(t,e,i){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)s.d(i,n,function(e){return t[e]}.bind(null,n));return i},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=0)}([function(t,e,s){const i=s(2);globalThis.loaders=globalThis.loaders||{},t.exports=Object.assign(globalThis.loaders,i)},,function(t,e,s){"use strict";function i(t){let e=1/0,s=1/0,i=1/0,n=-1/0,r=-1/0,o=-1/0;const a=t.POSITION?t.POSITION.value:[],l=a&&a.length;for(let t=0;t<l;t+=3){const l=a[t],c=a[t+1],u=a[t+2];e=l<e?l:e,s=c<s?c:s,i=u<i?u:i,n=l>n?l:n,r=c>r?c:r,o=u>o?u:o}return[[e,s,i],[n,r,o]]}s.r(e),s.d(e,"OBJWorkerLoader",(function(){return R})),s.d(e,"OBJLoader",(function(){return $})),s.d(e,"_typecheckOBJLoader",(function(){return k}));const n=/^[og]\s*(.+)?/,r=/^mtllib /,o=/^usemtl /;class a{constructor({index:t,name:e="",mtllib:s,smooth:i,groupStart:n}){this.index=t,this.name=e,this.mtllib=s,this.smooth=i,this.groupStart=n,this.groupEnd=-1,this.groupCount=-1,this.inherited=!1}clone(t=this.index){return new a({index:t,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0})}}class l{constructor(t=""){this.name=t,this.geometry={vertices:[],normals:[],colors:[],uvs:[]},this.materials=[],this.smooth=!0,this.fromDeclaration=null}startMaterial(t,e){const s=this._finalize(!1);s&&(s.inherited||s.groupCount<=0)&&this.materials.splice(s.index,1);const i=new a({index:this.materials.length,name:t,mtllib:Array.isArray(e)&&e.length>0?e[e.length-1]:"",smooth:void 0!==s?s.smooth:this.smooth,groupStart:void 0!==s?s.groupEnd:0});return this.materials.push(i),i}currentMaterial(){if(this.materials.length>0)return this.materials[this.materials.length-1]}_finalize(t){const e=this.currentMaterial();if(e&&-1===e.groupEnd&&(e.groupEnd=this.geometry.vertices.length/3,e.groupCount=e.groupEnd-e.groupStart,e.inherited=!1),t&&this.materials.length>1)for(let t=this.materials.length-1;t>=0;t--)this.materials[t].groupCount<=0&&this.materials.splice(t,1);return t&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),e}}class c{constructor(){this.objects=[],this.object=null,this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.materialLibraries=[],this.startObject("",!1)}startObject(t,e=!0){if(this.object&&!this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=e);const s=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object=new l(t),this.object.fromDeclaration=e,s&&s.name&&"function"==typeof s.clone){const t=s.clone(0);t.inherited=!0,this.object.materials.push(t)}this.objects.push(this.object)}finalize(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)}parseVertexIndex(t,e){const s=parseInt(t);return 3*(s>=0?s-1:s+e/3)}parseNormalIndex(t,e){const s=parseInt(t);return 3*(s>=0?s-1:s+e/3)}parseUVIndex(t,e){const s=parseInt(t);return 2*(s>=0?s-1:s+e/2)}addVertex(t,e,s){const i=this.vertices,n=this.object.geometry.vertices;n.push(i[t+0],i[t+1],i[t+2]),n.push(i[e+0],i[e+1],i[e+2]),n.push(i[s+0],i[s+1],i[s+2])}addVertexPoint(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])}addVertexLine(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])}addNormal(t,e,s){const i=this.normals,n=this.object.geometry.normals;n.push(i[t+0],i[t+1],i[t+2]),n.push(i[e+0],i[e+1],i[e+2]),n.push(i[s+0],i[s+1],i[s+2])}addColor(t,e,s){const i=this.colors,n=this.object.geometry.colors;n.push(i[t+0],i[t+1],i[t+2]),n.push(i[e+0],i[e+1],i[e+2]),n.push(i[s+0],i[s+1],i[s+2])}addUV(t,e,s){const i=this.uvs,n=this.object.geometry.uvs;n.push(i[t+0],i[t+1]),n.push(i[e+0],i[e+1]),n.push(i[s+0],i[s+1])}addUVLine(t){const e=this.uvs;this.object.geometry.uvs.push(e[t+0],e[t+1])}addFace(t,e,s,i,n,r,o,a,l){const c=this.vertices.length;let u=this.parseVertexIndex(t,c),h=this.parseVertexIndex(e,c),d=this.parseVertexIndex(s,c);if(this.addVertex(u,h,d),void 0!==i&&""!==i){const t=this.uvs.length;u=this.parseUVIndex(i,t),h=this.parseUVIndex(n,t),d=this.parseUVIndex(r,t),this.addUV(u,h,d)}if(void 0!==o&&""!==o){const t=this.normals.length;u=this.parseNormalIndex(o,t),h=o===a?u:this.parseNormalIndex(a,t),d=o===l?u:this.parseNormalIndex(l,t),this.addNormal(u,h,d)}this.colors.length>0&&this.addColor(u,h,d)}addPointGeometry(t){this.object.geometry.type="Points";const e=this.vertices.length;for(const s of t)this.addVertexPoint(this.parseVertexIndex(s,e))}addLineGeometry(t,e){this.object.geometry.type="Line";const s=this.vertices.length,i=this.uvs.length;for(const e of t)this.addVertexLine(this.parseVertexIndex(e,s));for(const t of e)this.addUVLine(this.parseUVIndex(t,i))}}function u(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class h{constructor(t,e){u(this,"fields",void 0),u(this,"metadata",void 0),function(t,e){if(!t)throw new Error(e||"loader assertion failed.")}(Array.isArray(t)),function(t){const e={};for(const s of t)e[s.name]&&console.warn("Schema: duplicated field name",s.name,s),e[s.name]=!0}(t),this.fields=t,this.metadata=e||new Map}compareTo(t){if(this.metadata!==t.metadata)return!1;if(this.fields.length!==t.fields.length)return!1;for(let e=0;e<this.fields.length;++e)if(!this.fields[e].compareTo(t.fields[e]))return!1;return!0}select(...t){const e=Object.create(null);for(const s of t)e[s]=!0;const s=this.fields.filter(t=>e[t.name]);return new h(s,this.metadata)}selectAt(...t){const e=t.map(t=>this.fields[t]).filter(Boolean);return new h(e,this.metadata)}assign(t){let e,s=this.metadata;if(t instanceof h){const i=t;e=i.fields,s=d(d(new Map,this.metadata),i.metadata)}else e=t;const i=Object.create(null);for(const t of this.fields)i[t.name]=t;for(const t of e)i[t.name]=t;const n=Object.values(i);return new h(n,s)}}function d(t,e){return new Map([...t||new Map,...e||new Map])}let p,m,f,y,b,g,v,x,I;function S(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(p||(p={}));class T{static isNull(t){return t&&t.typeId===p.Null}static isInt(t){return t&&t.typeId===p.Int}static isFloat(t){return t&&t.typeId===p.Float}static isBinary(t){return t&&t.typeId===p.Binary}static isUtf8(t){return t&&t.typeId===p.Utf8}static isBool(t){return t&&t.typeId===p.Bool}static isDecimal(t){return t&&t.typeId===p.Decimal}static isDate(t){return t&&t.typeId===p.Date}static isTime(t){return t&&t.typeId===p.Time}static isTimestamp(t){return t&&t.typeId===p.Timestamp}static isInterval(t){return t&&t.typeId===p.Interval}static isList(t){return t&&t.typeId===p.List}static isStruct(t){return t&&t.typeId===p.Struct}static isUnion(t){return t&&t.typeId===p.Union}static isFixedSizeBinary(t){return t&&t.typeId===p.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===p.FixedSizeList}static isMap(t){return t&&t.typeId===p.Map}static isDictionary(t){return t&&t.typeId===p.Dictionary}get typeId(){return p.NONE}compareTo(t){return this===t}}Symbol.toStringTag;Symbol.toStringTag;m=Symbol.toStringTag;class j extends T{constructor(t,e){super(),S(this,"isSigned",void 0),S(this,"bitWidth",void 0),this.isSigned=t,this.bitWidth=e}get typeId(){return p.Int}get[m](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}class w extends j{constructor(){super(!0,8)}}class O extends j{constructor(){super(!0,16)}}class F extends j{constructor(){super(!0,32)}}class M extends j{constructor(){super(!1,8)}}class L extends j{constructor(){super(!1,16)}}class U extends j{constructor(){super(!1,32)}}const z=32,D=64;f=Symbol.toStringTag;class N extends T{constructor(t){super(),S(this,"precision",void 0),this.precision=t}get typeId(){return p.Float}get[f](){return"Float"}toString(){return"Float"+this.precision}}class A extends N{constructor(){super(z)}}class V extends N{constructor(){super(D)}}Symbol.toStringTag;Symbol.toStringTag;y=Symbol.toStringTag;b=Symbol.toStringTag;g=Symbol.toStringTag;v=Symbol.toStringTag;x=Symbol.toStringTag;class B extends T{constructor(t,e){super(),S(this,"listSize",void 0),S(this,"children",void 0),this.listSize=t,this.children=[e]}get typeId(){return p.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[x](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}I=Symbol.toStringTag;function P(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class _{constructor(t,e,s=!1,i=new Map){P(this,"name",void 0),P(this,"type",void 0),P(this,"nullable",void 0),P(this,"metadata",void 0),this.name=t,this.type=e,this.nullable=s,this.metadata=i}get typeId(){return this.type&&this.type.typeId}clone(){return new _(this.name,this.type,this.nullable,this.metadata)}compareTo(t){return this.name===t.name&&this.type===t.type&&this.nullable===t.nullable&&this.metadata===t.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?", metadata: "+this.metadata:""}`}}function C(t,e){const s=new Map;for(const t in e)"value"!==t&&s.set(t,JSON.stringify(e[t]));const i=function(t){switch(t.constructor){case Int8Array:return new w;case Uint8Array:return new M;case Int16Array:return new O;case Uint16Array:return new L;case Int32Array:return new F;case Uint32Array:return new U;case Float32Array:return new A;case Float64Array:return new V;default:throw new Error("array type not supported")}}(e.value),n=!("size"in e)||1===e.size;return new _(t,n?i:new B(e.size,new _("value",i)),!1,s)}function E(t,e){const{meshes:s}=(t=>{const e=new c;-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));const s=t.split("\n");let i="",a="",l=0,u=[];const h="function"==typeof"".trimLeft;for(let t=0,c=s.length;t<c;t++)if(i=s[t],i=h?i.trimLeft():i.trim(),l=i.length,0!==l&&(a=i.charAt(0),"#"!==a))if("v"===a){const t=i.split(/\s+/);switch(t[0]){case"v":e.vertices.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),8===t.length&&e.colors.push(parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6]));break;case"vn":e.normals.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]));break;case"vt":e.uvs.push(parseFloat(t[1]),parseFloat(t[2]))}}else if("f"===a){const t=i.substr(1).trim().split(/\s+/),s=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(i.length>0){const t=i.split("/");s.push(t)}}const n=s[0];for(let t=1,i=s.length-1;t<i;t++){const i=s[t],r=s[t+1];e.addFace(n[0],i[0],r[0],n[1],i[1],r[1],n[2],i[2],r[2])}}else if("l"===a){const t=i.substring(1).trim().split(" ");let s;const n=[];if(-1===i.indexOf("/"))s=t;else{s=[];for(let e=0,i=t.length;e<i;e++){const i=t[e].split("/");""!==i[0]&&s.push(i[0]),""!==i[1]&&n.push(i[1])}}e.addLineGeometry(s,n)}else if("p"===a){const t=i.substr(1).trim().split(" ");e.addPointGeometry(t)}else if(null!==(u=n.exec(i))){const t=(" "+u[0].substr(1).trim()).substr(1);e.startObject(t)}else if(o.test(i))e.object.startMaterial(i.substring(7).trim(),e.materialLibraries);else if(r.test(i))e.materialLibraries.push(i.substring(7).trim());else{if("s"!==a){if("\0"===i)continue;throw new Error(`Unexpected line: "${i}"`)}{if(u=i.split(" "),u.length>1){const t=u[1].trim().toLowerCase();e.object.smooth="0"!==t&&"off"!==t}else e.object.smooth=!0;const t=e.object.currentMaterial();t&&(t.smooth=e.object.smooth)}}e.finalize();const d=[],p=[];for(const t of e.objects){const{geometry:e}=t;if(0===e.vertices.length)continue;const s={header:{vertexCount:e.vertices.length/3},attributes:{}};switch(e.type){case"Points":s.mode=0;break;case"Line":s.mode=1;break;default:s.mode=4}s.attributes.POSITION={value:new Float32Array(e.vertices),size:3},e.normals.length>0&&(s.attributes.NORMAL={value:new Float32Array(e.normals),size:3}),e.colors.length>0&&(s.attributes.COLOR_0={value:new Float32Array(e.colors),size:3}),e.uvs.length>0&&(s.attributes.TEXCOORD_0={value:new Float32Array(e.uvs),size:2}),s.materials=[];for(const e of t.materials){const t={name:e.name,flatShading:!e.smooth};s.materials.push(t),p.push(t)}s.name=t.name,d.push(s)}return{meshes:d,materials:p}})(t),a=s.reduce((t,e)=>t+e.header.vertexCount,0),l=function(t,e){const s=new Float32Array(3*e);let i,n,r,o=0;for(const a of t){const{POSITION:t,NORMAL:l,COLOR_0:c,TEXCOORD_0:u}=a.attributes;s.set(t.value,3*o),l&&(i=i||new Float32Array(3*e),i.set(l.value,3*o)),c&&(n=n||new Float32Array(3*e),n.set(c.value,3*o)),u&&(r=r||new Float32Array(2*e),r.set(u.value,2*o)),o+=t.value.length/3}const a={};a.POSITION={value:s,size:3},i&&(a.NORMAL={value:i,size:3});n&&(a.COLOR_0={value:n,size:3});r&&(a.TEXCOORD_0={value:r,size:2});return a}(s,a),u={vertexCount:a,boundingBox:i(l)};return{loaderData:{header:{}},schema:function(t,e={}){let s;for(const t in e)s=s||new Map,"value"!==t&&s.set(t,JSON.stringify(e[t]));const i=[];for(const e in t){const s=C(e,t[e]);i.push(s)}return new h(i,s)}(l,{mode:4,boundingBox:u.boundingBox}),header:u,mode:4,attributes:l}}const R={name:"OBJ",id:"obj",module:"obj",version:"3.1.0-alpha.4",worker:!0,extensions:["obj"],mimeTypes:["text/plain"],testText:function(t){return"v"===t[0]},options:{obj:{}}};const $={...R,parse:async(t,e)=>E((new TextDecoder).decode(t)),parseTextSync:E},k=$}])}));
2
- //# sourceMappingURL=dist.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/bundle.ts","webpack:///../schema/src/category/mesh/mesh-utils.ts","webpack:///./src/lib/parse-obj.ts","webpack:///../schema/src/lib/schema/impl/schema.ts","webpack:///../schema/src/lib/utils/assert.ts","webpack:///../schema/src/lib/schema/impl/enum.ts","webpack:///../schema/src/lib/schema/impl/type.ts","webpack:///../schema/src/lib/schema/impl/field.ts","webpack:///./src/lib/get-obj-schema.ts","webpack:///../schema/src/lib/arrow/arrow-like-type-utils.ts","webpack:///./src/lib/load-obj.ts","webpack:///./src/obj-loader.ts","webpack:///./src/index.ts"],"names":["root","factory","exports","module","define","amd","a","i","window","installedModules","__webpack_require__","moduleId","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","moduleExports","require","globalThis","loaders","assign","getMeshBoundingBox","attributes","minX","Infinity","minY","minZ","maxX","maxY","maxZ","positions","POSITION","len","length","x","y","z","OBJECT_RE","MATERIAL_RE","MATERIAL_USE_RE","MeshMaterial","constructor","index","mtllib","smooth","groupStart","this","groupEnd","groupCount","inherited","clone","MeshObject","geometry","vertices","normals","colors","uvs","materials","fromDeclaration","startMaterial","libraries","previous","_finalize","splice","material","Array","isArray","undefined","push","currentMaterial","end","lastMultiMaterial","mi","ParserState","objects","materialLibraries","startObject","previousMaterial","declared","finalize","parseVertexIndex","parseInt","parseNormalIndex","parseUVIndex","addVertex","b","src","dst","addVertexPoint","addVertexLine","addNormal","addColor","addUV","addUVLine","addFace","ua","ub","uc","na","nb","nc","vLen","ia","ib","ic","uvLen","nLen","addPointGeometry","type","vertex","addLineGeometry","uv","Schema","fields","metadata","condition","message","Error","assert","usedNames","field","console","warn","checkNames","Map","compareTo","other","select","columnNames","nameMap","selectedFields","filter","selectAt","columnIndices","map","Boolean","schemaOrFields","otherSchema","mergeMaps","fieldMap","mergedFields","values","m1","m2","Type","DataType","typeId","Null","Int","Float","Binary","Utf8","Bool","Decimal","Date","Time","Timestamp","Interval","List","Struct","Union","FixedSizeBinary","FixedSizeList","Dictionary","NONE","isSigned","bitWidth","super","toString","Int8","Int16","Int32","Uint8","Uint16","Uint32","Precision","precision","Float32","Float64","listSize","child","children","valueType","Field","nullable","getArrowFieldFromAttribute","attributeName","attribute","metadataMap","set","JSON","stringify","array","Int8Array","Uint8Array","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","getArrowTypeFromTypedArray","isSingleValue","size","loadOBJ","text","options","meshes","state","indexOf","replace","lines","split","line","lineFirstChar","lineLength","result","trimLeft","trim","charAt","data","parseFloat","vertexData","substr","faceVertices","j","jl","vertexParts","v1","v2","v3","lineParts","substring","lineVertices","lineUVs","li","llen","parts","pointData","exec","test","toLowerCase","mesh","header","vertexCount","NORMAL","COLOR_0","TEXCOORD_0","sourceMaterial","_material","flatShading","parseOBJ","reduce","mergeAttributes","boundingBox","loaderData","schema","getOBJSchema","OBJLoader","id","version","worker","extensions","mimeTypes","testText","obj","OBJWorkerLoader","parse","async","arrayBuffer","TextDecoder","decode","parseTextSync","_typecheckOBJLoader"],"mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,SACb,GAAqB,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,OACP,CACJ,IAAIK,EAAIL,IACR,IAAI,IAAIM,KAAKD,GAAuB,iBAAZJ,QAAuBA,QAAUF,GAAMO,GAAKD,EAAEC,IAPxE,CASGC,QAAQ,W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X,EAAOW,cAWpBX,SACAhP,KAAM,EAENmB,cC/BJ,MAKa4O,EAAY,CACvB3Q,KAAM,MACN4Q,GAAI,MACJ3R,OAAQ,MACR4R,QATc,gBAUdC,QAAQ,EACRC,WAAY,CAAC,OACbC,UAAW,CAAC,cACZC,SAMF,SAAqB3D,GAEnB,MAAmB,MAAZA,EAAK,IAPZC,QAAS,CACP2D,IAAK,KASF,MCjBMP,EAAY,IACpBQ,EACHC,MAAOC,MAAOC,EAAa/D,IAAYF,GAAQ,IAAIkE,aAAcC,OAAOF,IACxEG,cAAepE,GAGJqE,EAAwCf","file":"dist.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n","// Mesh category utilities\n// TODO - move to mesh category module, or to math.gl/geometry module\nimport {TypedArray} from '../../types';\nimport {MeshAttributes} from './mesh-types';\n\ntype TypedArrays = {[key: string]: TypedArray};\n\n/**\n * Holds an axis aligned bounding box\n * TODO - make sure AxisAlignedBoundingBox in math.gl/culling understands this format (or change this format)\n */\ntype BoundingBox = [[number, number, number], [number, number, number]];\n\n/**\n * Get number of vertices in mesh\n * @param attributes\n */\nexport function getMeshSize(attributes: TypedArrays): number {\n let size = 0;\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n if (ArrayBuffer.isView(attribute)) {\n // @ts-ignore DataView doesn't have BYTES_PER_ELEMENT\n size += attribute.byteLength * attribute.BYTES_PER_ELEMENT;\n }\n }\n return size;\n}\n\n/**\n * Get the (axis aligned) bounding box of a mesh\n * @param attributes\n * @returns array of two vectors representing the axis aligned bounding box\n */\n// eslint-disable-next-line complexity\nexport function getMeshBoundingBox(attributes: MeshAttributes): BoundingBox {\n let minX = Infinity;\n let minY = Infinity;\n let minZ = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n let maxZ = -Infinity;\n\n const positions = attributes.POSITION ? attributes.POSITION.value : [];\n const len = positions && positions.length;\n\n for (let i = 0; i < len; i += 3) {\n const x = positions[i];\n const y = positions[i + 1];\n const z = positions[i + 2];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n minZ = z < minZ ? z : minZ;\n\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n maxZ = z > maxZ ? z : maxZ;\n }\n return [\n [minX, minY, minZ],\n [maxX, maxY, maxZ]\n ];\n}\n","// OBJ Loader, adapted from THREE.js (MIT license)\n//\n// Attributions per original THREE.js source file:\n//\n// @author mrdoob / http://mrdoob.com/\n\n// @ts-nocheck\n\n// o object_name | g group_name\nconst OBJECT_RE = /^[og]\\s*(.+)?/;\n// mtllib file_reference\nconst MATERIAL_RE = /^mtllib /;\n// usemtl material_name\nconst MATERIAL_USE_RE = /^usemtl /;\n\nclass MeshMaterial {\n constructor({index, name = '', mtllib, smooth, groupStart}) {\n this.index = index;\n this.name = name;\n this.mtllib = mtllib;\n this.smooth = smooth;\n this.groupStart = groupStart;\n this.groupEnd = -1;\n this.groupCount = -1;\n this.inherited = false;\n }\n\n clone(index = this.index) {\n return new MeshMaterial({\n index,\n name: this.name,\n mtllib: this.mtllib,\n smooth: this.smooth,\n groupStart: 0\n });\n }\n}\n\nclass MeshObject {\n constructor(name = '') {\n this.name = name;\n\n this.geometry = {\n vertices: [],\n normals: [],\n colors: [],\n uvs: []\n };\n\n this.materials = [];\n this.smooth = true;\n\n this.fromDeclaration = null;\n }\n\n startMaterial(name, libraries) {\n const previous = this._finalize(false);\n\n // New usemtl declaration overwrites an inherited material, except if faces were declared\n // after the material, then it must be preserved for proper MultiMaterial continuation.\n if (previous && (previous.inherited || previous.groupCount <= 0)) {\n this.materials.splice(previous.index, 1);\n }\n\n const material = new MeshMaterial({\n index: this.materials.length,\n name,\n mtllib:\n Array.isArray(libraries) && libraries.length > 0 ? libraries[libraries.length - 1] : '',\n smooth: previous !== undefined ? previous.smooth : this.smooth,\n groupStart: previous !== undefined ? previous.groupEnd : 0\n });\n\n this.materials.push(material);\n\n return material;\n }\n\n currentMaterial() {\n if (this.materials.length > 0) {\n return this.materials[this.materials.length - 1];\n }\n\n return undefined;\n }\n\n _finalize(end) {\n const lastMultiMaterial = this.currentMaterial();\n if (lastMultiMaterial && lastMultiMaterial.groupEnd === -1) {\n lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3;\n lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart;\n lastMultiMaterial.inherited = false;\n }\n\n // Ignore objects tail materials if no face declarations followed them before a new o/g started.\n if (end && this.materials.length > 1) {\n for (let mi = this.materials.length - 1; mi >= 0; mi--) {\n if (this.materials[mi].groupCount <= 0) {\n this.materials.splice(mi, 1);\n }\n }\n }\n\n // Guarantee at least one empty material, this makes the creation later more straight forward.\n if (end && this.materials.length === 0) {\n this.materials.push({\n name: '',\n smooth: this.smooth\n });\n }\n\n return lastMultiMaterial;\n }\n}\n\nclass ParserState {\n constructor() {\n this.objects = [];\n this.object = null;\n\n this.vertices = [];\n this.normals = [];\n this.colors = [];\n this.uvs = [];\n\n this.materialLibraries = [];\n\n this.startObject('', false);\n }\n\n startObject(name, fromDeclaration = true) {\n // If the current object (initial from reset) is not from a g/o declaration in the parsed\n // file. We need to use it for the first parsed g/o to keep things in sync.\n if (this.object && !this.object.fromDeclaration) {\n this.object.name = name;\n this.object.fromDeclaration = fromDeclaration;\n return;\n }\n\n const previousMaterial =\n this.object && typeof this.object.currentMaterial === 'function'\n ? this.object.currentMaterial()\n : undefined;\n\n if (this.object && typeof this.object._finalize === 'function') {\n this.object._finalize(true);\n }\n\n this.object = new MeshObject(name);\n this.object.fromDeclaration = fromDeclaration;\n\n // Inherit previous objects material.\n // Spec tells us that a declared material must be set to all objects until a new material is declared.\n // If a usemtl declaration is encountered while this new object is being parsed, it will\n // overwrite the inherited material. Exception being that there was already face declarations\n // to the inherited material, then it will be preserved for proper MultiMaterial continuation.\n if (previousMaterial && previousMaterial.name && typeof previousMaterial.clone === 'function') {\n const declared = previousMaterial.clone(0);\n declared.inherited = true;\n this.object.materials.push(declared);\n }\n\n this.objects.push(this.object);\n }\n\n finalize() {\n if (this.object && typeof this.object._finalize === 'function') {\n this.object._finalize(true);\n }\n }\n\n parseVertexIndex(value, len) {\n const index = parseInt(value);\n return (index >= 0 ? index - 1 : index + len / 3) * 3;\n }\n\n parseNormalIndex(value, len) {\n const index = parseInt(value);\n return (index >= 0 ? index - 1 : index + len / 3) * 3;\n }\n\n parseUVIndex(value, len) {\n const index = parseInt(value);\n return (index >= 0 ? index - 1 : index + len / 2) * 2;\n }\n\n addVertex(a, b, c) {\n const src = this.vertices;\n const dst = this.object.geometry.vertices;\n\n dst.push(src[a + 0], src[a + 1], src[a + 2]);\n dst.push(src[b + 0], src[b + 1], src[b + 2]);\n dst.push(src[c + 0], src[c + 1], src[c + 2]);\n }\n\n addVertexPoint(a) {\n const src = this.vertices;\n const dst = this.object.geometry.vertices;\n\n dst.push(src[a + 0], src[a + 1], src[a + 2]);\n }\n\n addVertexLine(a) {\n const src = this.vertices;\n const dst = this.object.geometry.vertices;\n\n dst.push(src[a + 0], src[a + 1], src[a + 2]);\n }\n\n addNormal(a, b, c) {\n const src = this.normals;\n const dst = this.object.geometry.normals;\n\n dst.push(src[a + 0], src[a + 1], src[a + 2]);\n dst.push(src[b + 0], src[b + 1], src[b + 2]);\n dst.push(src[c + 0], src[c + 1], src[c + 2]);\n }\n\n addColor(a, b, c) {\n const src = this.colors;\n const dst = this.object.geometry.colors;\n\n dst.push(src[a + 0], src[a + 1], src[a + 2]);\n dst.push(src[b + 0], src[b + 1], src[b + 2]);\n dst.push(src[c + 0], src[c + 1], src[c + 2]);\n }\n\n addUV(a, b, c) {\n const src = this.uvs;\n const dst = this.object.geometry.uvs;\n\n dst.push(src[a + 0], src[a + 1]);\n dst.push(src[b + 0], src[b + 1]);\n dst.push(src[c + 0], src[c + 1]);\n }\n\n addUVLine(a) {\n const src = this.uvs;\n const dst = this.object.geometry.uvs;\n\n dst.push(src[a + 0], src[a + 1]);\n }\n\n // eslint-disable-next-line max-params\n addFace(a, b, c, ua, ub, uc, na, nb, nc) {\n const vLen = this.vertices.length;\n\n let ia = this.parseVertexIndex(a, vLen);\n let ib = this.parseVertexIndex(b, vLen);\n let ic = this.parseVertexIndex(c, vLen);\n\n this.addVertex(ia, ib, ic);\n\n if (ua !== undefined && ua !== '') {\n const uvLen = this.uvs.length;\n ia = this.parseUVIndex(ua, uvLen);\n ib = this.parseUVIndex(ub, uvLen);\n ic = this.parseUVIndex(uc, uvLen);\n this.addUV(ia, ib, ic);\n }\n\n if (na !== undefined && na !== '') {\n // Normals are many times the same. If so, skip function call and parseInt.\n const nLen = this.normals.length;\n ia = this.parseNormalIndex(na, nLen);\n\n ib = na === nb ? ia : this.parseNormalIndex(nb, nLen);\n ic = na === nc ? ia : this.parseNormalIndex(nc, nLen);\n\n this.addNormal(ia, ib, ic);\n }\n\n if (this.colors.length > 0) {\n this.addColor(ia, ib, ic);\n }\n }\n\n addPointGeometry(vertices) {\n this.object.geometry.type = 'Points';\n\n const vLen = this.vertices.length;\n\n for (const vertex of vertices) {\n this.addVertexPoint(this.parseVertexIndex(vertex, vLen));\n }\n }\n\n addLineGeometry(vertices, uvs) {\n this.object.geometry.type = 'Line';\n\n const vLen = this.vertices.length;\n const uvLen = this.uvs.length;\n\n for (const vertex of vertices) {\n this.addVertexLine(this.parseVertexIndex(vertex, vLen));\n }\n\n for (const uv of uvs) {\n this.addUVLine(this.parseUVIndex(uv, uvLen));\n }\n }\n}\n\n// eslint-disable-next-line max-statements, complexity\nexport default (text) => {\n const state = new ParserState();\n\n if (text.indexOf('\\r\\n') !== -1) {\n // This is faster than String.split with regex that splits on both\n text = text.replace(/\\r\\n/g, '\\n');\n }\n\n if (text.indexOf('\\\\\\n') !== -1) {\n // join lines separated by a line continuation character (\\)\n text = text.replace(/\\\\\\n/g, '');\n }\n\n const lines = text.split('\\n');\n let line = '';\n let lineFirstChar = '';\n let lineLength = 0;\n let result = [];\n\n // Faster to just trim left side of the line. Use if available.\n const trimLeft = typeof ''.trimLeft === 'function';\n\n /* eslint-disable no-continue, max-depth */\n for (let i = 0, l = lines.length; i < l; i++) {\n line = lines[i];\n line = trimLeft ? line.trimLeft() : line.trim();\n lineLength = line.length;\n\n if (lineLength === 0) continue;\n\n lineFirstChar = line.charAt(0);\n\n // @todo invoke passed in handler if any\n if (lineFirstChar === '#') continue;\n\n if (lineFirstChar === 'v') {\n const data = line.split(/\\s+/);\n\n switch (data[0]) {\n case 'v':\n state.vertices.push(parseFloat(data[1]), parseFloat(data[2]), parseFloat(data[3]));\n if (data.length === 8) {\n state.colors.push(parseFloat(data[4]), parseFloat(data[5]), parseFloat(data[6]));\n }\n break;\n case 'vn':\n state.normals.push(parseFloat(data[1]), parseFloat(data[2]), parseFloat(data[3]));\n break;\n case 'vt':\n state.uvs.push(parseFloat(data[1]), parseFloat(data[2]));\n break;\n default:\n }\n } else if (lineFirstChar === 'f') {\n const lineData = line.substr(1).trim();\n const vertexData = lineData.split(/\\s+/);\n const faceVertices = [];\n\n // Parse the face vertex data into an easy to work with format\n\n for (let j = 0, jl = vertexData.length; j < jl; j++) {\n const vertex = vertexData[j];\n\n if (vertex.length > 0) {\n const vertexParts = vertex.split('/');\n faceVertices.push(vertexParts);\n }\n }\n\n // Draw an edge between the first vertex and all subsequent vertices to form an n-gon\n\n const v1 = faceVertices[0];\n\n for (let j = 1, jl = faceVertices.length - 1; j < jl; j++) {\n const v2 = faceVertices[j];\n const v3 = faceVertices[j + 1];\n\n state.addFace(v1[0], v2[0], v3[0], v1[1], v2[1], v3[1], v1[2], v2[2], v3[2]);\n }\n } else if (lineFirstChar === 'l') {\n const lineParts = line.substring(1).trim().split(' ');\n let lineVertices;\n const lineUVs = [];\n\n if (line.indexOf('/') === -1) {\n lineVertices = lineParts;\n } else {\n lineVertices = [];\n for (let li = 0, llen = lineParts.length; li < llen; li++) {\n const parts = lineParts[li].split('/');\n\n if (parts[0] !== '') lineVertices.push(parts[0]);\n if (parts[1] !== '') lineUVs.push(parts[1]);\n }\n }\n state.addLineGeometry(lineVertices, lineUVs);\n } else if (lineFirstChar === 'p') {\n const lineData = line.substr(1).trim();\n const pointData = lineData.split(' ');\n\n state.addPointGeometry(pointData);\n } else if ((result = OBJECT_RE.exec(line)) !== null) {\n // o object_name\n // or\n // g group_name\n\n // WORKAROUND: https://bugs.chromium.org/p/v8/issues/detail?id=2869\n // var name = result[ 0 ].substr( 1 ).trim();\n const name = (' ' + result[0].substr(1).trim()).substr(1); // eslint-disable-line\n\n state.startObject(name);\n } else if (MATERIAL_USE_RE.test(line)) {\n // material\n\n state.object.startMaterial(line.substring(7).trim(), state.materialLibraries);\n } else if (MATERIAL_RE.test(line)) {\n // mtl file\n\n state.materialLibraries.push(line.substring(7).trim());\n } else if (lineFirstChar === 's') {\n result = line.split(' ');\n\n // smooth shading\n\n // @todo Handle files that have varying smooth values for a set of faces inside one geometry,\n // but does not define a usemtl for each face set.\n // This should be detected and a dummy material created (later MultiMaterial and geometry groups).\n // This requires some care to not create extra material on each smooth value for \"normal\" obj files.\n // where explicit usemtl defines geometry groups.\n // Example asset: examples/models/obj/cerberus/Cerberus.obj\n\n /*\n * http://paulbourke.net/dataformats/obj/\n * or\n * http://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf\n *\n * From chapter \"Grouping\" Syntax explanation \"s group_number\":\n * \"group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.\n * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form\n * surfaces, smoothing groups are either turned on or off; there is no difference between values greater\n * than 0.\"\n */\n if (result.length > 1) {\n const value = result[1].trim().toLowerCase();\n state.object.smooth = value !== '0' && value !== 'off';\n } else {\n // ZBrush can produce \"s\" lines #11707\n state.object.smooth = true;\n }\n const material = state.object.currentMaterial();\n if (material) material.smooth = state.object.smooth;\n } else {\n // Handle null terminated files without exception\n if (line === '\\0') continue;\n\n throw new Error(`Unexpected line: \"${line}\"`);\n }\n }\n\n state.finalize();\n\n const meshes = [];\n const materials = [];\n\n for (const object of state.objects) {\n const {geometry} = object;\n\n // Skip o/g line declarations that did not follow with any faces\n if (geometry.vertices.length === 0) continue;\n\n const mesh = {\n header: {\n vertexCount: geometry.vertices.length / 3\n },\n attributes: {}\n };\n\n switch (geometry.type) {\n case 'Points':\n mesh.mode = 0; // GL.POINTS\n break;\n case 'Line':\n mesh.mode = 1; // GL.LINES\n break;\n default:\n mesh.mode = 4; // GL.TRIANGLES\n break;\n }\n\n mesh.attributes.POSITION = {value: new Float32Array(geometry.vertices), size: 3};\n\n if (geometry.normals.length > 0) {\n mesh.attributes.NORMAL = {value: new Float32Array(geometry.normals), size: 3};\n }\n\n if (geometry.colors.length > 0) {\n mesh.attributes.COLOR_0 = {value: new Float32Array(geometry.colors), size: 3};\n }\n\n if (geometry.uvs.length > 0) {\n mesh.attributes.TEXCOORD_0 = {value: new Float32Array(geometry.uvs), size: 2};\n }\n\n // Create materials\n mesh.materials = [];\n for (const sourceMaterial of object.materials) {\n // TODO - support full spec\n const _material = {\n name: sourceMaterial.name,\n flatShading: !sourceMaterial.smooth\n };\n mesh.materials.push(_material);\n materials.push(_material);\n }\n\n mesh.name = object.name;\n meshes.push(mesh);\n }\n\n return {meshes, materials};\n};\n","import {assert} from '../../utils/assert';\nimport Field from './field';\n\nexport type SchemaMetadata = Map<string, any>;\n\n/**\n * ArrowJS `Schema` API-compatible class for row-based tables (returned from `DataTable`)\n * https://loaders.gl/arrowjs/docs/api-reference/schema\n */\nexport default class Schema {\n fields: Field[];\n // TODO - Arrow just allows Map<string, string>\n metadata: SchemaMetadata;\n\n constructor(fields: Field[], metadata?: SchemaMetadata) {\n assert(Array.isArray(fields));\n checkNames(fields);\n // For kepler fields, create arrow compatible `Fields` that have kepler fields as `metadata`\n this.fields = fields;\n this.metadata = metadata || new Map();\n }\n\n // TODO - arrow only seems to compare fields, not metadata\n compareTo(other: Schema): boolean {\n if (this.metadata !== other.metadata) {\n return false;\n }\n if (this.fields.length !== other.fields.length) {\n return false;\n }\n for (let i = 0; i < this.fields.length; ++i) {\n if (!this.fields[i].compareTo(other.fields[i])) {\n return false;\n }\n }\n return true;\n }\n\n select(...columnNames: string[]): Schema {\n // Ensure column names reference valid fields\n const nameMap = Object.create(null);\n for (const name of columnNames) {\n nameMap[name] = true;\n }\n const selectedFields = this.fields.filter((field) => nameMap[field.name]);\n return new Schema(selectedFields, this.metadata);\n }\n\n selectAt(...columnIndices: number[]): Schema {\n // Ensure column indices reference valid fields\n const selectedFields = columnIndices.map((index) => this.fields[index]).filter(Boolean);\n return new Schema(selectedFields, this.metadata);\n }\n\n assign(schemaOrFields: Schema | Field[]): Schema {\n let fields: Field[];\n let metadata: SchemaMetadata = this.metadata;\n\n if (schemaOrFields instanceof Schema) {\n const otherSchema = schemaOrFields;\n fields = otherSchema.fields;\n metadata = mergeMaps(mergeMaps(new Map(), this.metadata), otherSchema.metadata);\n } else {\n fields = schemaOrFields;\n }\n\n // Create a merged list of fields, overwrite fields in place, new fields at end\n const fieldMap: {[key: string]: Field} = Object.create(null);\n\n for (const field of this.fields) {\n fieldMap[field.name] = field;\n }\n\n for (const field of fields) {\n fieldMap[field.name] = field;\n }\n\n const mergedFields = Object.values(fieldMap);\n\n return new Schema(mergedFields, metadata);\n }\n}\n\n// Warn if any duplicated field names\nfunction checkNames(fields) {\n const usedNames = {};\n for (const field of fields) {\n if (usedNames[field.name]) {\n // eslint-disable-next-line\n console.warn('Schema: duplicated field name', field.name, field);\n }\n usedNames[field.name] = true;\n }\n}\n\nfunction mergeMaps<T>(m1: T, m2: T): T {\n // @ts-ignore\n return new Map([...(m1 || new Map()), ...(m2 || new Map())]);\n}\n","// Replacement for the external assert method to reduce bundle size\n// Note: We don't use the second \"message\" argument in calling code,\n// so no need to support it here\nexport function assert(condition: boolean, message?: string) {\n if (!condition) {\n throw new Error(message || 'loader assertion failed.');\n }\n}\n","// This code is adapted from ArrowJS https://github.com/apache/arrow\n// under Apache license http://www.apache.org/licenses/LICENSE-2.0\n\n/**\n * Main data type enumeration.\n *\n * Data types in this library are all *logical*. They can be expressed as\n * either a primitive physical type (bytes or bits of some fixed size), a\n * nested type consisting of other data types, or another data type (e.g. a\n * timestamp encoded as an int64).\n *\n * **Note**: Only enum values 0-17 (NONE through Map) are written to an Arrow\n * IPC payload.\n *\n * The rest of the values are specified here so TypeScript can narrow the type\n * signatures further beyond the base Arrow Types. The Arrow DataTypes include\n * metadata like `bitWidth` that impact the type signatures of the values we\n * accept and return.\n *\n * For example, the `Int8Vector` reads 1-byte numbers from an `Int8Array`, an\n * `Int32Vector` reads a 4-byte number from an `Int32Array`, and an `Int64Vector`\n * reads a pair of 4-byte lo, hi 32-bit integers as a zero-copy slice from the\n * underlying `Int32Array`.\n *\n * Library consumers benefit by knowing the narrowest type, since we can ensure\n * the types across all public methods are propagated, and never bail to `any`.\n * These values are _never_ used at runtime, and they will _never_ be written\n * to the flatbuffers metadata of serialized Arrow IPC payloads.\n */\nexport enum Type {\n /** The default placeholder type */\n NONE = 0,\n /** A NULL type having no physical storage */\n Null = 1,\n /** Signed or unsigned 8, 16, 32, or 64-bit little-endian integer */\n Int = 2,\n /** 2, 4, or 8-byte floating point value */\n Float = 3,\n /** Variable-length bytes (no guarantee of UTF8-ness) */\n Binary = 4,\n /** UTF8 variable-length string as List<Char> */\n Utf8 = 5,\n /** Boolean as 1 bit, LSB bit-packed ordering */\n Bool = 6,\n /** Precision-and-scale-based decimal type. Storage type depends on the parameters. */\n Decimal = 7,\n /** int32_t days or int64_t milliseconds since the UNIX epoch */\n Date = 8,\n /** Time as signed 32 or 64-bit integer, representing either seconds, milliseconds, microseconds, or nanoseconds since midnight since midnight */\n Time = 9,\n /** Exact timestamp encoded with int64 since UNIX epoch (Default unit millisecond) */\n Timestamp = 10,\n /** YEAR_MONTH or DAY_TIME interval in SQL style */\n Interval = 11,\n /** A list of some logical data type */\n List = 12,\n /** Struct of logical types */\n Struct = 13,\n /** Union of logical types */\n Union = 14,\n /** Fixed-size binary. Each value occupies the same number of bytes */\n FixedSizeBinary = 15,\n /** Fixed-size list. Each value occupies the same number of bytes */\n FixedSizeList = 16,\n /** Map of named logical types */\n Map = 17,\n\n /** Dictionary aka Category type */\n Dictionary = -1,\n Int8 = -2,\n Int16 = -3,\n Int32 = -4,\n Int64 = -5,\n Uint8 = -6,\n Uint16 = -7,\n Uint32 = -8,\n Uint64 = -9,\n Float16 = -10,\n Float32 = -11,\n Float64 = -12,\n DateDay = -13,\n DateMillisecond = -14,\n TimestampSecond = -15,\n TimestampMillisecond = -16,\n TimestampMicrosecond = -17,\n TimestampNanosecond = -18,\n TimeSecond = -19,\n TimeMillisecond = -20,\n TimeMicrosecond = -21,\n TimeNanosecond = -22,\n DenseUnion = -23,\n SparseUnion = -24,\n IntervalDayTime = -25,\n IntervalYearMonth = -26\n}\n","// This code is adapted from ArrowJS https://github.com/apache/arrow\n// under Apache license http://www.apache.org/licenses/LICENSE-2.0\n\nimport {Type} from './enum';\n\nimport Field from './field';\n\nexport {Type} from './enum';\n\nexport type TypedIntArray =\n | Int8Array\n | Uint8Array\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Int32Array\n | Uint32Array\n | Uint8ClampedArray;\n\nexport type TypedFloatArray = Float32Array | Float64Array;\n\nexport type TypedArray = TypedIntArray | TypedFloatArray;\n\nexport type AnyArrayType = Array<any> | TypedIntArray | TypedFloatArray;\n\nexport class DataType {\n static isNull(x: any): boolean {\n return x && x.typeId === Type.Null;\n }\n static isInt(x: any): boolean {\n return x && x.typeId === Type.Int;\n }\n static isFloat(x: any): boolean {\n return x && x.typeId === Type.Float;\n }\n static isBinary(x: any): boolean {\n return x && x.typeId === Type.Binary;\n }\n static isUtf8(x: any): boolean {\n return x && x.typeId === Type.Utf8;\n }\n static isBool(x: any): boolean {\n return x && x.typeId === Type.Bool;\n }\n static isDecimal(x: any): boolean {\n return x && x.typeId === Type.Decimal;\n }\n static isDate(x: any): boolean {\n return x && x.typeId === Type.Date;\n }\n static isTime(x: any): boolean {\n return x && x.typeId === Type.Time;\n }\n static isTimestamp(x: any): boolean {\n return x && x.typeId === Type.Timestamp;\n }\n static isInterval(x: any): boolean {\n return x && x.typeId === Type.Interval;\n }\n static isList(x: any): boolean {\n return x && x.typeId === Type.List;\n }\n static isStruct(x: any): boolean {\n return x && x.typeId === Type.Struct;\n }\n static isUnion(x: any): boolean {\n return x && x.typeId === Type.Union;\n }\n static isFixedSizeBinary(x: any): boolean {\n return x && x.typeId === Type.FixedSizeBinary;\n }\n static isFixedSizeList(x: any): boolean {\n return x && x.typeId === Type.FixedSizeList;\n }\n static isMap(x: any): boolean {\n return x && x.typeId === Type.Map;\n }\n static isDictionary(x: any): boolean {\n return x && x.typeId === Type.Dictionary;\n }\n\n get typeId(): Type {\n return Type.NONE;\n }\n\n // get ArrayType(): AnyArrayType {\n // return Int8Array;\n // }\n\n // get ArrayType() { return Array; }\n compareTo(other: DataType): boolean {\n // TODO\n return this === other; // comparer.visit(this, other);\n }\n}\n\n// NULL\n\nexport class Null extends DataType {\n get typeId(): Type {\n return Type.Null;\n }\n get [Symbol.toStringTag](): string {\n return 'Null';\n }\n toString(): string {\n return 'Null';\n }\n}\n\n// BOOLEANS\n\nexport class Bool extends DataType {\n get typeId(): Type {\n return Type.Bool;\n }\n // get ArrayType() {\n // return Uint8Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Bool';\n }\n toString(): string {\n return 'Bool';\n }\n}\n\n// INTS\n\nexport class Int extends DataType {\n readonly isSigned: boolean;\n readonly bitWidth: number;\n constructor(isSigned, bitWidth) {\n super();\n this.isSigned = isSigned;\n this.bitWidth = bitWidth;\n }\n get typeId(): Type {\n return Type.Int;\n }\n // get ArrayType() {\n // switch (this.bitWidth) {\n // case 8:\n // return this.isSigned ? Int8Array : Uint8Array;\n // case 16:\n // return this.isSigned ? Int16Array : Uint16Array;\n // case 32:\n // return this.isSigned ? Int32Array : Uint32Array;\n // case 64:\n // return this.isSigned ? Int32Array : Uint32Array;\n // default:\n // throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);\n // }\n // }\n get [Symbol.toStringTag](): string {\n return 'Int';\n }\n toString(): string {\n return `${this.isSigned ? 'I' : 'Ui'}nt${this.bitWidth}`;\n }\n}\n\nexport class Int8 extends Int {\n constructor() {\n super(true, 8);\n }\n}\nexport class Int16 extends Int {\n constructor() {\n super(true, 16);\n }\n}\nexport class Int32 extends Int {\n constructor() {\n super(true, 32);\n }\n}\nexport class Int64 extends Int {\n constructor() {\n super(true, 64);\n }\n}\nexport class Uint8 extends Int {\n constructor() {\n super(false, 8);\n }\n}\nexport class Uint16 extends Int {\n constructor() {\n super(false, 16);\n }\n}\nexport class Uint32 extends Int {\n constructor() {\n super(false, 32);\n }\n}\nexport class Uint64 extends Int {\n constructor() {\n super(false, 64);\n }\n}\n\n// FLOATS\n\nconst Precision = {\n HALF: 16,\n SINGLE: 32,\n DOUBLE: 64\n};\n\nexport class Float extends DataType {\n readonly precision: number;\n constructor(precision) {\n super();\n this.precision = precision;\n }\n get typeId(): Type {\n return Type.Float;\n }\n // get ArrayType() {\n // switch (this.precision) {\n // case Precision.HALF:\n // return Uint16Array;\n // case Precision.SINGLE:\n // return Float32Array;\n // case Precision.DOUBLE:\n // return Float64Array;\n // default:\n // throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);\n // }\n // }\n get [Symbol.toStringTag](): string {\n return 'Float';\n }\n toString(): string {\n return `Float${this.precision}`;\n }\n}\n\nexport class Float16 extends Float {\n constructor() {\n super(Precision.HALF);\n }\n}\nexport class Float32 extends Float {\n constructor() {\n super(Precision.SINGLE);\n }\n}\nexport class Float64 extends Float {\n constructor() {\n super(Precision.DOUBLE);\n }\n}\n\nexport class Binary extends DataType {\n constructor() {\n super();\n }\n get typeId() {\n return Type.Binary;\n }\n toString() {\n return 'Binary';\n }\n get [Symbol.toStringTag]() {\n return 'Binary';\n }\n}\n\n// STRINGS\n\nexport class Utf8 extends DataType {\n get typeId(): Type {\n return Type.Utf8;\n }\n // get ArrayType() {\n // return Uint8Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Utf8';\n }\n toString(): string {\n return 'Utf8';\n }\n}\n\n// DATES, TIMES AND INTERVALS\n\nconst DateUnit = {\n DAY: 0,\n MILLISECOND: 1\n};\n\nexport class Date extends DataType {\n readonly unit: number;\n constructor(unit) {\n super();\n this.unit = unit;\n }\n get typeId(): Type {\n return Type.Date;\n }\n // get ArrayType() {\n // return Int32Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Date';\n }\n toString(): string {\n return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;\n }\n}\n\nexport class DateDay extends Date {\n constructor() {\n super(DateUnit.DAY);\n }\n}\nexport class DateMillisecond extends Date {\n constructor() {\n super(DateUnit.MILLISECOND);\n }\n}\n\nconst TimeUnit = {\n SECOND: 1,\n MILLISECOND: 1e3,\n MICROSECOND: 1e6,\n NANOSECOND: 1e9\n};\n\nexport class Time extends DataType {\n readonly unit: number;\n readonly bitWidth: number;\n\n constructor(unit, bitWidth) {\n super();\n this.unit = unit;\n this.bitWidth = bitWidth;\n }\n get typeId(): Type {\n return Type.Time;\n }\n toString(): string {\n return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;\n }\n get [Symbol.toStringTag](): string {\n return 'Time';\n }\n // get ArrayType() {\n // return Int32Array;\n // }\n}\n\nexport class TimeSecond extends Time {\n constructor() {\n super(TimeUnit.SECOND, 32);\n }\n}\nexport class TimeMillisecond extends Time {\n constructor() {\n super(TimeUnit.MILLISECOND, 32);\n }\n}\n// export class TimeMicrosecond extends Time { constructor() { super(TimeUnit.MICROSECOND, 64); } }\n// export class TimeNanosecond extends Time { constructor() { super(TimeUnit.NANOSECOND, 64); } }\n\nexport class Timestamp extends DataType {\n readonly unit: any;\n readonly timezone: any;\n\n constructor(unit: any, timezone = null) {\n super();\n this.unit = unit;\n this.timezone = timezone;\n }\n get typeId(): Type {\n return Type.Timestamp;\n }\n // get ArrayType() {\n // return Int32Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Timestamp';\n }\n toString(): string {\n return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ''}>`;\n }\n}\n\nexport class TimestampSecond extends Timestamp {\n constructor(timezone = null) {\n super(TimeUnit.SECOND, timezone);\n }\n}\nexport class TimestampMillisecond extends Timestamp {\n constructor(timezone = null) {\n super(TimeUnit.MILLISECOND, timezone);\n }\n}\nexport class TimestampMicrosecond extends Timestamp {\n constructor(timezone = null) {\n super(TimeUnit.MICROSECOND, timezone);\n }\n}\nexport class TimestampNanosecond extends Timestamp {\n constructor(timezone = null) {\n super(TimeUnit.NANOSECOND, timezone);\n }\n}\n\nconst IntervalUnit = {\n DAY_TIME: 0,\n YEAR_MONTH: 1\n};\n\nexport class Interval extends DataType {\n readonly unit: number;\n constructor(unit: number) {\n super();\n this.unit = unit;\n }\n get typeId(): Type {\n return Type.Interval;\n }\n // get ArrayType() {\n // return Int32Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Interval';\n }\n toString(): string {\n return `Interval<${IntervalUnit[this.unit]}>`;\n }\n}\n\nexport class IntervalDayTime extends Interval {\n constructor() {\n super(IntervalUnit.DAY_TIME);\n }\n}\nexport class IntervalYearMonth extends Interval {\n constructor() {\n super(IntervalUnit.YEAR_MONTH);\n }\n}\n\nexport class FixedSizeList extends DataType {\n readonly listSize: number;\n readonly children: Field[];\n\n constructor(listSize: number, child: Field) {\n super();\n this.listSize = listSize;\n this.children = [child];\n }\n get typeId(): Type {\n return Type.FixedSizeList;\n }\n get valueType() {\n return this.children[0].type;\n }\n get valueField() {\n return this.children[0];\n }\n // get ArrayType() {\n // return this.valueType.ArrayType;\n // }\n get [Symbol.toStringTag](): string {\n return 'FixedSizeList';\n }\n toString(): string {\n return `FixedSizeList[${this.listSize}]<${this.valueType}>`;\n }\n}\n\nexport class Struct extends DataType {\n public readonly children: Field[];\n\n constructor(children: Field[]) {\n super();\n this.children = children;\n }\n\n public get typeId() {\n return Type.Struct;\n }\n public toString() {\n return `Struct<{${this.children.map((f) => `${f.name}:${f.type}`).join(', ')}}>`;\n }\n get [Symbol.toStringTag](): string {\n return 'Struct';\n }\n}\n","import {DataType} from './type';\n\n/**\n * ArrowJS `Field` API-compatible class for row-based tables\n * https://loaders.gl/arrowjs/docs/api-reference/field\n * A field holds name, nullable, and metadata information about a table \"column\"\n * A Schema is essentially a list of fields\n */\nexport default class Field {\n name: string;\n type: DataType;\n nullable: boolean;\n metadata: Map<string, string>;\n\n constructor(\n name: string,\n type: DataType,\n nullable = false,\n metadata: Map<string, string> = new Map()\n ) {\n this.name = name;\n this.type = type;\n this.nullable = nullable;\n this.metadata = metadata;\n }\n\n get typeId(): number {\n return this.type && this.type.typeId;\n }\n\n clone(): Field {\n return new Field(this.name, this.type, this.nullable, this.metadata);\n }\n\n compareTo(other: this): boolean {\n return (\n this.name === other.name &&\n this.type === other.type &&\n this.nullable === other.nullable &&\n this.metadata === other.metadata\n );\n }\n\n toString(): string {\n return `${this.type}${this.nullable ? ', nullable' : ''}${\n this.metadata ? `, metadata: ${this.metadata}` : ''\n }`;\n }\n}\n","import {Schema, Field, FixedSizeList, getArrowTypeFromTypedArray} from '@loaders.gl/schema';\n\nexport function getOBJSchema(attributes, metadata = {}) {\n let metadataMap;\n for (const key in metadata) {\n metadataMap = metadataMap || new Map();\n if (key !== 'value') {\n metadataMap.set(key, JSON.stringify(metadata[key]));\n }\n }\n\n const fields: Field[] = [];\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const field = getArrowFieldFromAttribute(attributeName, attribute);\n fields.push(field);\n }\n return new Schema(fields, metadataMap);\n}\n\nfunction getArrowFieldFromAttribute(attributeName, attribute) {\n const metadataMap = new Map();\n for (const key in attribute) {\n if (key !== 'value') {\n metadataMap.set(key, JSON.stringify(attribute[key]));\n }\n }\n\n const type = getArrowTypeFromTypedArray(attribute.value);\n const isSingleValue = !('size' in attribute) || attribute.size === 1;\n return isSingleValue\n ? new Field(attributeName, type, false, metadataMap)\n : new Field(\n attributeName,\n new FixedSizeList(attribute.size, new Field('value', type)),\n false,\n metadataMap\n );\n}\n","import type {TypedArray} from '../../types';\nimport {DataType, Float32, Float64, Int16, Int32, Int8, Uint16, Uint32, Uint8} from '../schema';\n\nexport function getArrowTypeFromTypedArray(array: TypedArray): DataType {\n switch (array.constructor) {\n case Int8Array:\n return new Int8();\n case Uint8Array:\n return new Uint8();\n case Int16Array:\n return new Int16();\n case Uint16Array:\n return new Uint16();\n case Int32Array:\n return new Int32();\n case Uint32Array:\n return new Uint32();\n case Float32Array:\n return new Float32();\n case Float64Array:\n return new Float64();\n default:\n throw new Error('array type not supported');\n }\n}\n","import type {MeshAttributes} from '@loaders.gl/schema';\nimport {getMeshBoundingBox} from '@loaders.gl/schema';\nimport parseOBJ from './parse-obj';\nimport {getOBJSchema} from './get-obj-schema';\n\nexport default function loadOBJ(text, options) {\n const {meshes} = parseOBJ(text);\n\n // @ts-expect-error\n const vertexCount = meshes.reduce((s, mesh) => s + mesh.header.vertexCount, 0);\n // TODO - render objects separately\n const attributes = mergeAttributes(meshes, vertexCount);\n\n const header = {\n vertexCount,\n // @ts-ignore Need to export Attributes type\n boundingBox: getMeshBoundingBox(attributes)\n };\n\n const schema = getOBJSchema(attributes, {\n mode: 4,\n boundingBox: header.boundingBox\n });\n\n return {\n // Data return by this loader implementation\n loaderData: {\n header: {}\n },\n\n // Normalised data\n schema,\n header,\n mode: 4, // TRIANGLES\n\n attributes\n };\n}\n\n// eslint-disable-next-line max-statements\nfunction mergeAttributes(meshes, vertexCount) {\n const positions = new Float32Array(vertexCount * 3);\n let normals;\n let colors;\n let uvs;\n let i = 0;\n\n for (const mesh of meshes) {\n const {POSITION, NORMAL, COLOR_0, TEXCOORD_0} = mesh.attributes;\n\n positions.set(POSITION.value, i * 3);\n\n if (NORMAL) {\n normals = normals || new Float32Array(vertexCount * 3);\n normals.set(NORMAL.value, i * 3);\n }\n if (COLOR_0) {\n colors = colors || new Float32Array(vertexCount * 3);\n colors.set(COLOR_0.value, i * 3);\n }\n if (TEXCOORD_0) {\n uvs = uvs || new Float32Array(vertexCount * 2);\n uvs.set(TEXCOORD_0.value, i * 2);\n }\n\n i += POSITION.value.length / 3;\n }\n\n const attributes: MeshAttributes = {};\n attributes.POSITION = {value: positions, size: 3};\n\n if (normals) {\n attributes.NORMAL = {value: normals, size: 3};\n }\n if (colors) {\n attributes.COLOR_0 = {value: colors, size: 3};\n }\n if (uvs) {\n attributes.TEXCOORD_0 = {value: uvs, size: 2};\n }\n\n return attributes;\n}\n","import type {Loader} from '@loaders.gl/loader-utils';\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\n/**\n * Worker loader for the OBJ geometry format\n */\nexport const OBJLoader = {\n name: 'OBJ',\n id: 'obj',\n module: 'obj',\n version: VERSION,\n worker: true,\n extensions: ['obj'],\n mimeTypes: ['text/plain'],\n testText: testOBJFile,\n options: {\n obj: {}\n }\n};\n\nfunction testOBJFile(text) {\n // TODO - There could be comment line first\n return text[0] === 'v';\n}\n\nexport const _typecheckOBJLoader: Loader = OBJLoader;\n","import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport loadOBJ from './lib/load-obj';\nimport {OBJLoader as OBJWorkerLoader} from './obj-loader';\n\n// OBJLoader\n\nexport {OBJWorkerLoader};\n\n/**\n * Loader for the OBJ geometry format\n */\nexport const OBJLoader = {\n ...OBJWorkerLoader,\n parse: async (arrayBuffer, options) => loadOBJ(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync: loadOBJ\n};\n\nexport const _typecheckOBJLoader: LoaderWithParser = OBJLoader;\n"],"sourceRoot":""}
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- var moduleExports = require('./index');
4
-
5
- globalThis.loaders = globalThis.loaders || {};
6
- module.exports = Object.assign(globalThis.loaders, moduleExports);
7
- //# sourceMappingURL=bundle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,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/es5/index.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- Object.defineProperty(exports, "OBJWorkerLoader", {
9
- enumerable: true,
10
- get: function get() {
11
- return _objLoader.OBJLoader;
12
- }
13
- });
14
- exports._typecheckOBJLoader = exports.OBJLoader = void 0;
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
-
22
- var _loadObj = _interopRequireDefault(require("./lib/load-obj"));
23
-
24
- var _objLoader = require("./obj-loader");
25
-
26
- 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; }
27
-
28
- 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; }
29
-
30
- var OBJLoader = _objectSpread(_objectSpread({}, _objLoader.OBJLoader), {}, {
31
- parse: function () {
32
- var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
33
- return _regenerator.default.wrap(function _callee$(_context) {
34
- while (1) {
35
- switch (_context.prev = _context.next) {
36
- case 0:
37
- return _context.abrupt("return", (0, _loadObj.default)(new TextDecoder().decode(arrayBuffer), options));
38
-
39
- case 1:
40
- case "end":
41
- return _context.stop();
42
- }
43
- }
44
- }, _callee);
45
- }));
46
-
47
- function parse(_x, _x2) {
48
- return _parse.apply(this, arguments);
49
- }
50
-
51
- return parse;
52
- }(),
53
- parseTextSync: _loadObj.default
54
- });
55
-
56
- exports.OBJLoader = OBJLoader;
57
- var _typecheckOBJLoader = OBJLoader;
58
- exports._typecheckOBJLoader = _typecheckOBJLoader;
59
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":["OBJLoader","OBJWorkerLoader","parse","arrayBuffer","options","TextDecoder","decode","parseTextSync","loadOBJ","_typecheckOBJLoader"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;;;;;AASO,IAAMA,SAAS,mCACjBC,oBADiB;AAEpBC,EAAAA,KAAK;AAAA,2EAAE,iBAAOC,WAAP,EAAoBC,OAApB;AAAA;AAAA;AAAA;AAAA;AAAA,+CAAgC,sBAAQ,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBH,WAAzB,CAAR,EAA+CC,OAA/C,CAAhC;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAF;;AAAA;AAAA;AAAA;;AAAA;AAAA,KAFe;AAGpBG,EAAAA,aAAa,EAAEC;AAHK,EAAf;;;AAMA,IAAMC,mBAAqC,GAAGT,SAA9C","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport loadOBJ from './lib/load-obj';\nimport {OBJLoader as OBJWorkerLoader} from './obj-loader';\n\n// OBJLoader\n\nexport {OBJWorkerLoader};\n\n/**\n * Loader for the OBJ geometry format\n */\nexport const OBJLoader = {\n ...OBJWorkerLoader,\n parse: async (arrayBuffer, options) => loadOBJ(new TextDecoder().decode(arrayBuffer), options),\n parseTextSync: loadOBJ\n};\n\nexport const _typecheckOBJLoader: LoaderWithParser = OBJLoader;\n"],"file":"index.js"}
@@ -1,46 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getOBJSchema = getOBJSchema;
7
-
8
- var _schema = require("@loaders.gl/schema");
9
-
10
- function getOBJSchema(attributes) {
11
- var metadata = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12
- var metadataMap;
13
-
14
- for (var key in metadata) {
15
- metadataMap = metadataMap || new Map();
16
-
17
- if (key !== 'value') {
18
- metadataMap.set(key, JSON.stringify(metadata[key]));
19
- }
20
- }
21
-
22
- var fields = [];
23
-
24
- for (var attributeName in attributes) {
25
- var attribute = attributes[attributeName];
26
- var field = getArrowFieldFromAttribute(attributeName, attribute);
27
- fields.push(field);
28
- }
29
-
30
- return new _schema.Schema(fields, metadataMap);
31
- }
32
-
33
- function getArrowFieldFromAttribute(attributeName, attribute) {
34
- var metadataMap = new Map();
35
-
36
- for (var key in attribute) {
37
- if (key !== 'value') {
38
- metadataMap.set(key, JSON.stringify(attribute[key]));
39
- }
40
- }
41
-
42
- var type = (0, _schema.getArrowTypeFromTypedArray)(attribute.value);
43
- var isSingleValue = !('size' in attribute) || attribute.size === 1;
44
- return isSingleValue ? new _schema.Field(attributeName, type, false, metadataMap) : new _schema.Field(attributeName, new _schema.FixedSizeList(attribute.size, new _schema.Field('value', type)), false, metadataMap);
45
- }
46
- //# sourceMappingURL=get-obj-schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/get-obj-schema.ts"],"names":["getOBJSchema","attributes","metadata","metadataMap","key","Map","set","JSON","stringify","fields","attributeName","attribute","field","getArrowFieldFromAttribute","push","Schema","type","value","isSingleValue","size","Field","FixedSizeList"],"mappings":";;;;;;;AAAA;;AAEO,SAASA,YAAT,CAAsBC,UAAtB,EAAiD;AAAA,MAAfC,QAAe,uEAAJ,EAAI;AACtD,MAAIC,WAAJ;;AACA,OAAK,IAAMC,GAAX,IAAkBF,QAAlB,EAA4B;AAC1BC,IAAAA,WAAW,GAAGA,WAAW,IAAI,IAAIE,GAAJ,EAA7B;;AACA,QAAID,GAAG,KAAK,OAAZ,EAAqB;AACnBD,MAAAA,WAAW,CAACG,GAAZ,CAAgBF,GAAhB,EAAqBG,IAAI,CAACC,SAAL,CAAeN,QAAQ,CAACE,GAAD,CAAvB,CAArB;AACD;AACF;;AAED,MAAMK,MAAe,GAAG,EAAxB;;AACA,OAAK,IAAMC,aAAX,IAA4BT,UAA5B,EAAwC;AACtC,QAAMU,SAAS,GAAGV,UAAU,CAACS,aAAD,CAA5B;AACA,QAAME,KAAK,GAAGC,0BAA0B,CAACH,aAAD,EAAgBC,SAAhB,CAAxC;AACAF,IAAAA,MAAM,CAACK,IAAP,CAAYF,KAAZ;AACD;;AACD,SAAO,IAAIG,cAAJ,CAAWN,MAAX,EAAmBN,WAAnB,CAAP;AACD;;AAED,SAASU,0BAAT,CAAoCH,aAApC,EAAmDC,SAAnD,EAA8D;AAC5D,MAAMR,WAAW,GAAG,IAAIE,GAAJ,EAApB;;AACA,OAAK,IAAMD,GAAX,IAAkBO,SAAlB,EAA6B;AAC3B,QAAIP,GAAG,KAAK,OAAZ,EAAqB;AACnBD,MAAAA,WAAW,CAACG,GAAZ,CAAgBF,GAAhB,EAAqBG,IAAI,CAACC,SAAL,CAAeG,SAAS,CAACP,GAAD,CAAxB,CAArB;AACD;AACF;;AAED,MAAMY,IAAI,GAAG,wCAA2BL,SAAS,CAACM,KAArC,CAAb;AACA,MAAMC,aAAa,GAAG,EAAE,UAAUP,SAAZ,KAA0BA,SAAS,CAACQ,IAAV,KAAmB,CAAnE;AACA,SAAOD,aAAa,GAChB,IAAIE,aAAJ,CAAUV,aAAV,EAAyBM,IAAzB,EAA+B,KAA/B,EAAsCb,WAAtC,CADgB,GAEhB,IAAIiB,aAAJ,CACAV,aADA,EAEA,IAAIW,qBAAJ,CAAkBV,SAAS,CAACQ,IAA5B,EAAkC,IAAIC,aAAJ,CAAU,OAAV,EAAmBJ,IAAnB,CAAlC,CAFA,EAGA,KAHA,EAIAb,WAJA,CAFJ;AAQD","sourcesContent":["import {Schema, Field, FixedSizeList, getArrowTypeFromTypedArray} from '@loaders.gl/schema';\n\nexport function getOBJSchema(attributes, metadata = {}) {\n let metadataMap;\n for (const key in metadata) {\n metadataMap = metadataMap || new Map();\n if (key !== 'value') {\n metadataMap.set(key, JSON.stringify(metadata[key]));\n }\n }\n\n const fields: Field[] = [];\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const field = getArrowFieldFromAttribute(attributeName, attribute);\n fields.push(field);\n }\n return new Schema(fields, metadataMap);\n}\n\nfunction getArrowFieldFromAttribute(attributeName, attribute) {\n const metadataMap = new Map();\n for (const key in attribute) {\n if (key !== 'value') {\n metadataMap.set(key, JSON.stringify(attribute[key]));\n }\n }\n\n const type = getArrowTypeFromTypedArray(attribute.value);\n const isSingleValue = !('size' in attribute) || attribute.size === 1;\n return isSingleValue\n ? new Field(attributeName, type, false, metadataMap)\n : new Field(\n attributeName,\n new FixedSizeList(attribute.size, new Field('value', type)),\n false,\n metadataMap\n );\n}\n"],"file":"get-obj-schema.js"}
@@ -1,121 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = loadOBJ;
9
-
10
- var _schema = require("@loaders.gl/schema");
11
-
12
- var _parseObj = _interopRequireDefault(require("./parse-obj"));
13
-
14
- var _getObjSchema = require("./get-obj-schema");
15
-
16
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
17
-
18
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
19
-
20
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
21
-
22
- function loadOBJ(text, options) {
23
- var _parseOBJ = (0, _parseObj.default)(text),
24
- meshes = _parseOBJ.meshes;
25
-
26
- var vertexCount = meshes.reduce(function (s, mesh) {
27
- return s + mesh.header.vertexCount;
28
- }, 0);
29
- var attributes = mergeAttributes(meshes, vertexCount);
30
- var header = {
31
- vertexCount: vertexCount,
32
- boundingBox: (0, _schema.getMeshBoundingBox)(attributes)
33
- };
34
- var schema = (0, _getObjSchema.getOBJSchema)(attributes, {
35
- mode: 4,
36
- boundingBox: header.boundingBox
37
- });
38
- return {
39
- loaderData: {
40
- header: {}
41
- },
42
- schema: schema,
43
- header: header,
44
- mode: 4,
45
- attributes: attributes
46
- };
47
- }
48
-
49
- function mergeAttributes(meshes, vertexCount) {
50
- var positions = new Float32Array(vertexCount * 3);
51
- var normals;
52
- var colors;
53
- var uvs;
54
- var i = 0;
55
-
56
- var _iterator = _createForOfIteratorHelper(meshes),
57
- _step;
58
-
59
- try {
60
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
61
- var mesh = _step.value;
62
- var _mesh$attributes = mesh.attributes,
63
- POSITION = _mesh$attributes.POSITION,
64
- NORMAL = _mesh$attributes.NORMAL,
65
- COLOR_0 = _mesh$attributes.COLOR_0,
66
- TEXCOORD_0 = _mesh$attributes.TEXCOORD_0;
67
- positions.set(POSITION.value, i * 3);
68
-
69
- if (NORMAL) {
70
- normals = normals || new Float32Array(vertexCount * 3);
71
- normals.set(NORMAL.value, i * 3);
72
- }
73
-
74
- if (COLOR_0) {
75
- colors = colors || new Float32Array(vertexCount * 3);
76
- colors.set(COLOR_0.value, i * 3);
77
- }
78
-
79
- if (TEXCOORD_0) {
80
- uvs = uvs || new Float32Array(vertexCount * 2);
81
- uvs.set(TEXCOORD_0.value, i * 2);
82
- }
83
-
84
- i += POSITION.value.length / 3;
85
- }
86
- } catch (err) {
87
- _iterator.e(err);
88
- } finally {
89
- _iterator.f();
90
- }
91
-
92
- var attributes = {};
93
- attributes.POSITION = {
94
- value: positions,
95
- size: 3
96
- };
97
-
98
- if (normals) {
99
- attributes.NORMAL = {
100
- value: normals,
101
- size: 3
102
- };
103
- }
104
-
105
- if (colors) {
106
- attributes.COLOR_0 = {
107
- value: colors,
108
- size: 3
109
- };
110
- }
111
-
112
- if (uvs) {
113
- attributes.TEXCOORD_0 = {
114
- value: uvs,
115
- size: 2
116
- };
117
- }
118
-
119
- return attributes;
120
- }
121
- //# sourceMappingURL=load-obj.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/load-obj.ts"],"names":["loadOBJ","text","options","meshes","vertexCount","reduce","s","mesh","header","attributes","mergeAttributes","boundingBox","schema","mode","loaderData","positions","Float32Array","normals","colors","uvs","i","POSITION","NORMAL","COLOR_0","TEXCOORD_0","set","value","length","size"],"mappings":";;;;;;;;;AACA;;AACA;;AACA;;;;;;;;AAEe,SAASA,OAAT,CAAiBC,IAAjB,EAAuBC,OAAvB,EAAgC;AAC7C,kBAAiB,uBAASD,IAAT,CAAjB;AAAA,MAAOE,MAAP,aAAOA,MAAP;;AAGA,MAAMC,WAAW,GAAGD,MAAM,CAACE,MAAP,CAAc,UAACC,CAAD,EAAIC,IAAJ;AAAA,WAAaD,CAAC,GAAGC,IAAI,CAACC,MAAL,CAAYJ,WAA7B;AAAA,GAAd,EAAwD,CAAxD,CAApB;AAEA,MAAMK,UAAU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port {getMeshBoundingBox} from '@loaders.gl/schema';\nimport parseOBJ from './parse-obj';\nimport {getOBJSchema} from './get-obj-schema';\n\nexport default function loadOBJ(text, options) {\n const {meshes} = parseOBJ(text);\n\n // @ts-expect-error\n const vertexCount = meshes.reduce((s, mesh) => s + mesh.header.vertexCount, 0);\n // TODO - render objects separately\n const attributes = mergeAttributes(meshes, vertexCount);\n\n const header = {\n vertexCount,\n // @ts-ignore Need to export Attributes type\n boundingBox: getMeshBoundingBox(attributes)\n };\n\n const schema = getOBJSchema(attributes, {\n mode: 4,\n boundingBox: header.boundingBox\n });\n\n return {\n // Data return by this loader implementation\n loaderData: {\n header: {}\n },\n\n // Normalised data\n schema,\n header,\n mode: 4, // TRIANGLES\n\n attributes\n };\n}\n\n// eslint-disable-next-line max-statements\nfunction mergeAttributes(meshes, vertexCount) {\n const positions = new Float32Array(vertexCount * 3);\n let normals;\n let colors;\n let uvs;\n let i = 0;\n\n for (const mesh of meshes) {\n const {POSITION, NORMAL, COLOR_0, TEXCOORD_0} = mesh.attributes;\n\n positions.set(POSITION.value, i * 3);\n\n if (NORMAL) {\n normals = normals || new Float32Array(vertexCount * 3);\n normals.set(NORMAL.value, i * 3);\n }\n if (COLOR_0) {\n colors = colors || new Float32Array(vertexCount * 3);\n colors.set(COLOR_0.value, i * 3);\n }\n if (TEXCOORD_0) {\n uvs = uvs || new Float32Array(vertexCount * 2);\n uvs.set(TEXCOORD_0.value, i * 2);\n }\n\n i += POSITION.value.length / 3;\n }\n\n const attributes: MeshAttributes = {};\n attributes.POSITION = {value: positions, size: 3};\n\n if (normals) {\n attributes.NORMAL = {value: normals, size: 3};\n }\n if (colors) {\n attributes.COLOR_0 = {value: colors, size: 3};\n }\n if (uvs) {\n attributes.TEXCOORD_0 = {value: uvs, size: 2};\n }\n\n return attributes;\n}\n"],"file":"load-obj.js"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=obj-types.js.map