@loaders.gl/draco 3.3.0-alpha.5 → 3.3.0-alpha.7
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/draco-nodejs-worker.js +70 -69
- package/dist/draco-nodejs-worker.js.map +3 -3
- package/dist/draco-worker.js +1 -1
- package/dist/draco-writer-nodejs-worker.js +61 -60
- package/dist/draco-writer-nodejs-worker.js.map +3 -3
- package/dist/draco-writer-worker.js +2 -2
- package/dist/es5/bundle.js +0 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/draco-loader.js +1 -4
- package/dist/es5/draco-loader.js.map +1 -1
- package/dist/es5/draco-writer-nodejs.js +0 -2
- package/dist/es5/draco-writer-nodejs.js.map +1 -1
- package/dist/es5/draco-writer.js +5 -17
- package/dist/es5/draco-writer.js.map +1 -1
- package/dist/es5/draco3d/draco3d-types.js +1 -8
- package/dist/es5/draco3d/draco3d-types.js.map +1 -1
- package/dist/es5/index.js +5 -25
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/draco-builder.js +40 -96
- package/dist/es5/lib/draco-builder.js.map +1 -1
- package/dist/es5/lib/draco-module-loader.js +2 -41
- package/dist/es5/lib/draco-module-loader.js.map +1 -1
- package/dist/es5/lib/draco-parser.js +63 -111
- package/dist/es5/lib/draco-parser.js.map +1 -1
- package/dist/es5/lib/draco-types.js.map +1 -1
- package/dist/es5/lib/utils/get-draco-schema.js +0 -12
- package/dist/es5/lib/utils/get-draco-schema.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/es5/lib/utils/version.js.map +1 -1
- package/dist/es5/workers/draco-nodejs-worker.js +0 -3
- package/dist/es5/workers/draco-nodejs-worker.js.map +1 -1
- package/dist/es5/workers/draco-worker.js +0 -2
- package/dist/es5/workers/draco-worker.js.map +1 -1
- package/dist/es5/workers/draco-writer-nodejs-worker.js +0 -15
- package/dist/es5/workers/draco-writer-nodejs-worker.js.map +1 -1
- package/dist/es5/workers/draco-writer-worker.js +0 -15
- package/dist/es5/workers/draco-writer-worker.js.map +1 -1
- package/dist/esm/bundle.js +1 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/draco-loader.js +1 -0
- package/dist/esm/draco-loader.js.map +1 -1
- package/dist/esm/draco-writer-nodejs.js +1 -0
- package/dist/esm/draco-writer-nodejs.js.map +1 -1
- package/dist/esm/draco-writer.js +3 -3
- package/dist/esm/draco-writer.js.map +1 -1
- package/dist/esm/draco3d/draco3d-types.js +2 -3
- package/dist/esm/draco3d/draco3d-types.js.map +1 -1
- package/dist/esm/index.js +6 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/draco-builder.js +6 -75
- package/dist/esm/lib/draco-builder.js.map +1 -1
- package/dist/esm/lib/draco-module-loader.js +4 -9
- package/dist/esm/lib/draco-module-loader.js.map +1 -1
- package/dist/esm/lib/draco-parser.js +5 -66
- package/dist/esm/lib/draco-parser.js.map +1 -1
- package/dist/esm/lib/draco-types.js.map +1 -1
- package/dist/esm/lib/utils/get-draco-schema.js +0 -10
- package/dist/esm/lib/utils/get-draco-schema.js.map +1 -1
- package/dist/esm/lib/utils/version.js +2 -1
- package/dist/esm/lib/utils/version.js.map +1 -1
- package/dist/esm/workers/draco-nodejs-worker.js.map +1 -1
- package/dist/esm/workers/draco-worker.js.map +1 -1
- package/dist/esm/workers/draco-writer-nodejs-worker.js +0 -4
- package/dist/esm/workers/draco-writer-nodejs-worker.js.map +1 -1
- package/dist/esm/workers/draco-writer-worker.js +0 -4
- package/dist/esm/workers/draco-writer-worker.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var N=Object.create;var b=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var $=t=>b(t,"__esModule",{value:!0});var q=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var j=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!V.call(t,o)&&o!=="default"&&b(t,o,{get:()=>e[o],enumerable:!(r=C(e,o))||r.enumerable});return t},U=t=>j($(b(t!=null?N(F(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var W=q(()=>{});var M="3.3.0-alpha.
|
|
1
|
+
(()=>{var N=Object.create;var b=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var $=t=>b(t,"__esModule",{value:!0});var q=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var j=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!V.call(t,o)&&o!=="default"&&b(t,o,{get:()=>e[o],enumerable:!(r=C(e,o))||r.enumerable});return t},U=t=>j($(b(t!=null?N(F(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var W=q(()=>{});var M="3.3.0-alpha.7";function D(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var c={self:typeof self!="undefined"&&self,window:typeof window!="undefined"&&window,global:typeof global!="undefined"&&global,document:typeof document!="undefined"&&document},se=c.self||c.window||c.global||{},ne=c.window||c.self||c.global||{},k=c.global||c.self||c.window||{},ie=c.document||{};var h=typeof process!="object"||String(process)!=="[object process]"||process.browser,g=typeof importScripts=="function",de=typeof window!="undefined"&&typeof window.orientation!="undefined",P=typeof process!="undefined"&&process.version&&/v([0-9]*)/.exec(process.version),ce=P&&parseFloat(P[1])||0;function _(t,e=!0,r){let o=r||new Set;if(t){if(T(t))o.add(t);else if(T(t.buffer))o.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let a in t)_(t[a],e,o)}}return r===void 0?Array.from(o):[]}function T(t){return t?t instanceof ArrayBuffer||typeof MessagePort!="undefined"&&t instanceof MessagePort||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||typeof OffscreenCanvas!="undefined"&&t instanceof OffscreenCanvas:!1}function f(){let parentPort;try{eval("globalThis.parentPort = require('worker_threads').parentPort"),parentPort=globalThis.parentPort}catch{}return parentPort}var A=new Map,u=class{static inWorkerThread(){return typeof self!="undefined"||Boolean(f())}static set onmessage(e){function r(a){let s=f(),{type:i,payload:n}=s?a:a.data;e(i,n)}let o=f();o?(o.on("message",r),o.on("exit",()=>console.debug("Node worker closing"))):globalThis.onmessage=r}static addEventListener(e){let r=A.get(e);r||(r=a=>{if(!z(a))return;let s=f(),{type:i,payload:n}=s?a:a.data;e(i,n)}),f()?console.error("not implemented"):globalThis.addEventListener("message",r)}static removeEventListener(e){let r=A.get(e);A.delete(e),f()?console.error("not implemented"):globalThis.removeEventListener("message",r)}static postMessage(e,r){let o={source:"loaders.gl",type:e,payload:r},a=_(r),s=f();s?s.postMessage(o,a):globalThis.postMessage(o,a)}};function z(t){let{type:e,data:r}=t;return e==="message"&&r&&typeof r.source=="string"&&r.source.startsWith("loaders.gl")}var p=U(W());var G="beta",Q=typeof M!="undefined"?M:G,O={};async function E(t,e=null,r={}){return e&&(t=B(t,e,r)),O[t]=O[t]||X(t),await O[t]}function B(t,e,r){if(t.startsWith("http"))return t;let o=r.modules||{};return o[t]?o[t]:h?r.CDN?(D(r.CDN.startsWith("http")),`${r.CDN}/${e}@${Q}/dist/libs/${t}`):g?`../src/libs/${t}`:`modules/${e}/src/libs/${t}`:`modules/${e}/dist/libs/${t}`}async function X(t){if(t.endsWith("wasm"))return await(await fetch(t)).arrayBuffer();if(!h)try{return p&&p.requireFromFile&&await p.requireFromFile(t)}catch{return null}if(g)return importScripts(t);let r=await(await fetch(t)).text();return J(r,t)}function J(t,e){if(!h)return p.requireFromString&&p.requireFromString(t,e);if(g)return eval.call(k,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}var I={POSITION:"POSITION",NORMAL:"NORMAL",COLOR_0:"COLOR",TEXCOORD_0:"TEX_COORD"},H=()=>{},m=class{constructor(e){this.draco=e,this.dracoEncoder=new this.draco.Encoder,this.dracoMeshBuilder=new this.draco.MeshBuilder,this.dracoMetadataBuilder=new this.draco.MetadataBuilder}destroy(){this.destroyEncodedObject(this.dracoMeshBuilder),this.destroyEncodedObject(this.dracoEncoder),this.destroyEncodedObject(this.dracoMetadataBuilder),this.dracoMeshBuilder=null,this.dracoEncoder=null,this.draco=null}destroyEncodedObject(e){e&&this.draco.destroy(e)}encodeSync(e,r={}){return this.log=H,this._setOptions(r),r.pointcloud?this._encodePointCloud(e,r):this._encodeMesh(e,r)}_getAttributesFromMesh(e){let r={...e,...e.attributes};return e.indices&&(r.indices=e.indices),r}_encodePointCloud(e,r){let o=new this.draco.PointCloud;r.metadata&&this._addGeometryMetadata(o,r.metadata);let a=this._getAttributesFromMesh(e);this._createDracoPointCloud(o,a,r);let s=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodePointCloudToDracoBuffer(o,!1,s);if(!(i>0))throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points
|
|
2
2
|
with ${o.num_attributes()} attributes into ${i} bytes`),R(s)}finally{this.destroyEncodedObject(s),this.destroyEncodedObject(o)}}_encodeMesh(e,r){let o=new this.draco.Mesh;r.metadata&&this._addGeometryMetadata(o,r.metadata);let a=this._getAttributesFromMesh(e);this._createDracoMesh(o,a,r);let s=new this.draco.DracoInt8Array;try{let i=this.dracoEncoder.EncodeMeshToDracoBuffer(o,s);if(i<=0)throw new Error("Draco encoding failed.");return this.log(`DRACO encoded ${o.num_points()} points
|
|
3
|
-
with ${o.num_attributes()} attributes into ${i} bytes`),R(s)}finally{this.destroyEncodedObject(s),this.destroyEncodedObject(o)}}_setOptions(e){if("speed"in e&&this.dracoEncoder.SetSpeedOptions(...e.speed),"method"in e){let r=this.draco[e.method||"MESH_SEQUENTIAL_ENCODING"];this.dracoEncoder.SetEncodingMethod(r)}if("quantization"in e)for(let r in e.quantization){let o=e.quantization[r],a=this.draco[r];this.dracoEncoder.SetAttributeQuantization(a,o)}}_createDracoMesh(e,r,o){let a=o.attributesMetadata||{};try{let s=this._getPositionAttribute(r);if(!s)throw new Error("positions");let i=s.length/3;for(let n in r){let d=r[n];n=I[n]||n;let l=this._addAttributeToMesh(e,n,d,i);l!==-1&&this._addAttributeMetadata(e,l,{name:n,...a[n]||{}})}}catch(s){throw this.destroyEncodedObject(e),s}return e}_createDracoPointCloud(e,r,o){let a=o.attributesMetadata||{};try{let s=this._getPositionAttribute(r);if(!s)throw new Error("positions");let i=s.length/3;for(let n in r){let d=r[n];n=I[n]||n;let l=this._addAttributeToMesh(e,n,d,i);l!==-1&&this._addAttributeMetadata(e,l,{name:n,...a[n]||{}})}}catch(s){throw this.destroyEncodedObject(e),s}return e}_addAttributeToMesh(e,r,o,a){if(!ArrayBuffer.isView(o))return-1;let s=this._getDracoAttributeType(r),i=o.length/a;if(s==="indices"){let l=o.length/3;return this.log(`Adding attribute ${r}, size ${l}`),this.dracoMeshBuilder.AddFacesToMesh(e,l,o),-1}this.log(`Adding attribute ${r}, size ${i}`);let n=this.dracoMeshBuilder,{buffer:d}=o;switch(o.constructor){case Int8Array:return n.AddInt8Attribute(e,s,a,i,new Int8Array(d));case Int16Array:return n.AddInt16Attribute(e,s,a,i,new Int16Array(d));case Int32Array:return n.AddInt32Attribute(e,s,a,i,new Int32Array(d));case Uint8Array:case Uint8ClampedArray:return n.AddUInt8Attribute(e,s,a,i,new Uint8Array(d));case Uint16Array:return n.AddUInt16Attribute(e,s,a,i,new Uint16Array(d));case Uint32Array:return n.AddUInt32Attribute(e,s,a,i,new Uint32Array(d));case Float32Array:default:return n.AddFloatAttribute(e,s,a,i,new Float32Array(d))}}_getDracoAttributeType(e){switch(e.toLowerCase()){case"indices":return"indices";case"position":case"positions":case"vertices":return this.draco.POSITION;case"normal":case"normals":return this.draco.NORMAL;case"color":case"colors":return this.draco.COLOR;case"texcoord":case"texcoords":return this.draco.TEX_COORD;default:return this.draco.GENERIC}}_getPositionAttribute(e){for(let r in e){let o=e[r];if(this._getDracoAttributeType(r)===this.draco.POSITION)return o}return null}_addGeometryMetadata(e,r){let o=new this.draco.Metadata;this._populateDracoMetadata(o,r),this.dracoMeshBuilder.AddMetadata(e,o)}_addAttributeMetadata(e,r,o){let a=new this.draco.Metadata;this._populateDracoMetadata(a,o),this.dracoMeshBuilder.SetMetadataForAttribute(e,r,a)}_populateDracoMetadata(e,r){for(let[o,a]of K(r))switch(typeof a){case"number":Math.trunc(a)===a?this.dracoMetadataBuilder.AddIntEntry(e,o,a):this.dracoMetadataBuilder.AddDoubleEntry(e,o,a);break;case"object":a instanceof Int32Array&&this.dracoMetadataBuilder.AddIntEntryArray(e,o,a,a.length);break;case"string":default:this.dracoMetadataBuilder.AddStringEntry(e,o,a)}}};function R(t){let e=t.size(),r=new ArrayBuffer(e),o=new Int8Array(r);for(let a=0;a<e;++a)o[a]=t.GetValue(a);return r}function K(t){return t.entries&&!t.hasOwnProperty("entries")?t.entries():Object.entries(t)}var w="1.4.1",De=`https://www.gstatic.com/draco/versioned/decoders/${w}/draco_decoder.js`,ke=`https://www.gstatic.com/draco/versioned/decoders/${w}/draco_wasm_wrapper.js`,Pe=`https://www.gstatic.com/draco/versioned/decoders/${w}/draco_decoder.wasm`,Y=`https://raw.githubusercontent.com/google/draco/${w}/javascript/draco_encoder.js`;var y;async function S(t){let e=t.modules||{};return e.draco3d?y=y||e.draco3d.createEncoderModule({}).then(r=>({draco:r})):y=y||Z(t),await y}async function Z(t){let e=await E(Y,"draco",t);return e=e||globalThis.DracoEncoderModule,new Promise(r=>{e({onModuleLoaded:o=>r({draco:o})})})}var x="3.3.0-alpha.
|
|
3
|
+
with ${o.num_attributes()} attributes into ${i} bytes`),R(s)}finally{this.destroyEncodedObject(s),this.destroyEncodedObject(o)}}_setOptions(e){if("speed"in e&&this.dracoEncoder.SetSpeedOptions(...e.speed),"method"in e){let r=this.draco[e.method||"MESH_SEQUENTIAL_ENCODING"];this.dracoEncoder.SetEncodingMethod(r)}if("quantization"in e)for(let r in e.quantization){let o=e.quantization[r],a=this.draco[r];this.dracoEncoder.SetAttributeQuantization(a,o)}}_createDracoMesh(e,r,o){let a=o.attributesMetadata||{};try{let s=this._getPositionAttribute(r);if(!s)throw new Error("positions");let i=s.length/3;for(let n in r){let d=r[n];n=I[n]||n;let l=this._addAttributeToMesh(e,n,d,i);l!==-1&&this._addAttributeMetadata(e,l,{name:n,...a[n]||{}})}}catch(s){throw this.destroyEncodedObject(e),s}return e}_createDracoPointCloud(e,r,o){let a=o.attributesMetadata||{};try{let s=this._getPositionAttribute(r);if(!s)throw new Error("positions");let i=s.length/3;for(let n in r){let d=r[n];n=I[n]||n;let l=this._addAttributeToMesh(e,n,d,i);l!==-1&&this._addAttributeMetadata(e,l,{name:n,...a[n]||{}})}}catch(s){throw this.destroyEncodedObject(e),s}return e}_addAttributeToMesh(e,r,o,a){if(!ArrayBuffer.isView(o))return-1;let s=this._getDracoAttributeType(r),i=o.length/a;if(s==="indices"){let l=o.length/3;return this.log(`Adding attribute ${r}, size ${l}`),this.dracoMeshBuilder.AddFacesToMesh(e,l,o),-1}this.log(`Adding attribute ${r}, size ${i}`);let n=this.dracoMeshBuilder,{buffer:d}=o;switch(o.constructor){case Int8Array:return n.AddInt8Attribute(e,s,a,i,new Int8Array(d));case Int16Array:return n.AddInt16Attribute(e,s,a,i,new Int16Array(d));case Int32Array:return n.AddInt32Attribute(e,s,a,i,new Int32Array(d));case Uint8Array:case Uint8ClampedArray:return n.AddUInt8Attribute(e,s,a,i,new Uint8Array(d));case Uint16Array:return n.AddUInt16Attribute(e,s,a,i,new Uint16Array(d));case Uint32Array:return n.AddUInt32Attribute(e,s,a,i,new Uint32Array(d));case Float32Array:default:return n.AddFloatAttribute(e,s,a,i,new Float32Array(d))}}_getDracoAttributeType(e){switch(e.toLowerCase()){case"indices":return"indices";case"position":case"positions":case"vertices":return this.draco.POSITION;case"normal":case"normals":return this.draco.NORMAL;case"color":case"colors":return this.draco.COLOR;case"texcoord":case"texcoords":return this.draco.TEX_COORD;default:return this.draco.GENERIC}}_getPositionAttribute(e){for(let r in e){let o=e[r];if(this._getDracoAttributeType(r)===this.draco.POSITION)return o}return null}_addGeometryMetadata(e,r){let o=new this.draco.Metadata;this._populateDracoMetadata(o,r),this.dracoMeshBuilder.AddMetadata(e,o)}_addAttributeMetadata(e,r,o){let a=new this.draco.Metadata;this._populateDracoMetadata(a,o),this.dracoMeshBuilder.SetMetadataForAttribute(e,r,a)}_populateDracoMetadata(e,r){for(let[o,a]of K(r))switch(typeof a){case"number":Math.trunc(a)===a?this.dracoMetadataBuilder.AddIntEntry(e,o,a):this.dracoMetadataBuilder.AddDoubleEntry(e,o,a);break;case"object":a instanceof Int32Array&&this.dracoMetadataBuilder.AddIntEntryArray(e,o,a,a.length);break;case"string":default:this.dracoMetadataBuilder.AddStringEntry(e,o,a)}}};function R(t){let e=t.size(),r=new ArrayBuffer(e),o=new Int8Array(r);for(let a=0;a<e;++a)o[a]=t.GetValue(a);return r}function K(t){return t.entries&&!t.hasOwnProperty("entries")?t.entries():Object.entries(t)}var w="1.4.1",De=`https://www.gstatic.com/draco/versioned/decoders/${w}/draco_decoder.js`,ke=`https://www.gstatic.com/draco/versioned/decoders/${w}/draco_wasm_wrapper.js`,Pe=`https://www.gstatic.com/draco/versioned/decoders/${w}/draco_decoder.wasm`,Y=`https://raw.githubusercontent.com/google/draco/${w}/javascript/draco_encoder.js`;var y;async function S(t){let e=t.modules||{};return e.draco3d?y=y||e.draco3d.createEncoderModule({}).then(r=>({draco:r})):y=y||Z(t),await y}async function Z(t){let e=await E(Y,"draco",t);return e=e||globalThis.DracoEncoderModule,new Promise(r=>{e({onModuleLoaded:o=>r({draco:o})})})}var x="3.3.0-alpha.7";var ee={pointcloud:!1,attributeNameEntry:"name"},L={name:"DRACO",id:"draco",module:"draco",version:x,extensions:["drc"],encode:re,options:{draco:ee}};async function re(t,e={}){let{draco:r}=await S(e),o=new m(r);try{return o.encodeSync(t,e.draco)}finally{o.destroy()}}(()=>{!u.inWorkerThread()||(u.onmessage=async(t,e)=>{switch(t){case"process":try{let{input:r,options:o}=e,a=await L.encode(r,o);u.postMessage("done",{result:a})}catch(r){let o=r instanceof Error?r.message:"";u.postMessage("error",{error:o})}break;default:}})})();})();
|
|
4
4
|
//# sourceMappingURL=draco-writer-worker.js.map
|
package/dist/es5/bundle.js
CHANGED
package/dist/es5/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
|
package/dist/es5/draco-loader.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports._TypecheckDracoLoader = exports.DracoLoader = void 0;
|
|
9
|
-
|
|
10
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
-
|
|
12
9
|
var _workerUtils = require("@loaders.gl/worker-utils");
|
|
13
|
-
|
|
14
10
|
var _version = require("./lib/utils/version");
|
|
15
11
|
|
|
16
12
|
var DEFAULT_DRACO_OPTIONS = {
|
|
@@ -21,6 +17,7 @@ var DEFAULT_DRACO_OPTIONS = {
|
|
|
21
17
|
attributeNameEntry: undefined
|
|
22
18
|
}
|
|
23
19
|
};
|
|
20
|
+
|
|
24
21
|
var DracoLoader = {
|
|
25
22
|
name: 'Draco',
|
|
26
23
|
id: _workerUtils.isBrowser ? 'draco' : 'draco-nodejs',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"draco-loader.js","names":["DEFAULT_DRACO_OPTIONS","draco","decoderType","WebAssembly","libraryPath","extraAttributes","attributeNameEntry","undefined","DracoLoader","name","id","isBrowser","module","shapes","version","VERSION","worker","extensions","mimeTypes","binary","tests","options","_TypecheckDracoLoader"],"sources":["../../src/draco-loader.ts"],"sourcesContent":["import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {isBrowser} from '@loaders.gl/worker-utils';\nimport type {DracoParseOptions} from './lib/draco-parser';\n// import type {DracoMeshData} from './types';\nimport {VERSION} from './lib/utils/version';\n\nexport type DracoLoaderOptions = LoaderOptions & {\n draco?: DracoParseOptions & {\n decoderType?: 'wasm' | 'js';\n libraryPath?: string;\n extraAttributes?;\n attributeNameEntry?: string;\n workerUrl?: string;\n };\n};\n\nconst DEFAULT_DRACO_OPTIONS: DracoLoaderOptions = {\n draco: {\n decoderType: typeof WebAssembly === 'object' ? 'wasm' : 'js', // 'js' for IE11\n libraryPath: 'libs/',\n extraAttributes: {},\n attributeNameEntry: undefined\n }\n};\n\n/**\n * Worker loader for Draco3D compressed geometries\n */\nexport const DracoLoader = {\n name: 'Draco',\n id: isBrowser ? 'draco' : 'draco-nodejs',\n module: 'draco',\n shapes: ['mesh'],\n version: VERSION,\n worker: true,\n extensions: ['drc'],\n mimeTypes: ['application/octet-stream'],\n binary: true,\n tests: ['DRACO'],\n options: DEFAULT_DRACO_OPTIONS\n};\n\nexport const _TypecheckDracoLoader: Loader = DracoLoader;\n"],"mappings":";;;;;;;;AACA;AAGA;;AAYA,IAAMA,qBAAyC,GAAG;EAChDC,KAAK,EAAE;IACLC,WAAW,EAAE,QAAOC,WAAW,uDAAXA,WAAW,OAAK,QAAQ,GAAG,MAAM,GAAG,IAAI;IAC5DC,WAAW,EAAE,OAAO;IACpBC,eAAe,EAAE,CAAC,CAAC;IACnBC,kBAAkB,EAAEC;EACtB;AACF,CAAC;;AAKM,IAAMC,WAAW,GAAG;EACzBC,IAAI,EAAE,OAAO;EACbC,EAAE,EAAEC,sBAAS,GAAG,OAAO,GAAG,cAAc;EACxCC,MAAM,EAAE,OAAO;EACfC,MAAM,EAAE,CAAC,MAAM,CAAC;EAChBC,OAAO,EAAEC,gBAAO;EAChBC,MAAM,EAAE,IAAI;EACZC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,CAAC,OAAO,CAAC;EAChBC,OAAO,EAAErB;AACX,CAAC;AAAC;AAEK,IAAMsB,qBAA6B,GAAGd,WAAW;AAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"draco-writer-nodejs.js","names":[],"sources":["../../src/draco-writer-nodejs.ts"],"sourcesContent":["// Polyfills increases the bundle size significantly. Use it for NodeJS worker only\nimport '@loaders.gl/polyfills';\n\nexport {DracoWriter as DracoWriterNodeJS} from './draco-writer';\n"],"mappings":";;;;;;;;;;;AACA;AAEA"}
|
package/dist/es5/draco-writer.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.DracoWriter = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _dracoBuilder = _interopRequireDefault(require("./lib/draco-builder"));
|
|
15
|
-
|
|
16
11
|
var _dracoModuleLoader = require("./lib/draco-module-loader");
|
|
17
|
-
|
|
18
12
|
var _version = require("./lib/utils/version");
|
|
19
|
-
|
|
20
13
|
var DEFAULT_DRACO_OPTIONS = {
|
|
21
14
|
pointcloud: false,
|
|
22
15
|
attributeNameEntry: 'name'
|
|
23
16
|
};
|
|
17
|
+
|
|
24
18
|
var DracoWriter = {
|
|
25
19
|
name: 'DRACO',
|
|
26
20
|
id: 'draco',
|
|
@@ -33,19 +27,16 @@ var DracoWriter = {
|
|
|
33
27
|
}
|
|
34
28
|
};
|
|
35
29
|
exports.DracoWriter = DracoWriter;
|
|
36
|
-
|
|
37
30
|
function encode(_x) {
|
|
38
31
|
return _encode.apply(this, arguments);
|
|
39
32
|
}
|
|
40
|
-
|
|
41
33
|
function _encode() {
|
|
42
34
|
_encode = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data) {
|
|
43
35
|
var options,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
_yield$loadDracoEncod,
|
|
37
|
+
draco,
|
|
38
|
+
dracoBuilder,
|
|
39
|
+
_args = arguments;
|
|
49
40
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
50
41
|
while (1) {
|
|
51
42
|
switch (_context.prev = _context.next) {
|
|
@@ -53,19 +44,16 @@ function _encode() {
|
|
|
53
44
|
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
54
45
|
_context.next = 3;
|
|
55
46
|
return (0, _dracoModuleLoader.loadDracoEncoderModule)(options);
|
|
56
|
-
|
|
57
47
|
case 3:
|
|
58
48
|
_yield$loadDracoEncod = _context.sent;
|
|
59
49
|
draco = _yield$loadDracoEncod.draco;
|
|
60
50
|
dracoBuilder = new _dracoBuilder.default(draco);
|
|
61
51
|
_context.prev = 6;
|
|
62
52
|
return _context.abrupt("return", dracoBuilder.encodeSync(data, options.draco));
|
|
63
|
-
|
|
64
53
|
case 8:
|
|
65
54
|
_context.prev = 8;
|
|
66
55
|
dracoBuilder.destroy();
|
|
67
56
|
return _context.finish(8);
|
|
68
|
-
|
|
69
57
|
case 11:
|
|
70
58
|
case "end":
|
|
71
59
|
return _context.stop();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"draco-writer.js","names":["DEFAULT_DRACO_OPTIONS","pointcloud","attributeNameEntry","DracoWriter","name","id","module","version","VERSION","extensions","encode","options","draco","data","loadDracoEncoderModule","dracoBuilder","DRACOBuilder","encodeSync","destroy"],"sources":["../../src/draco-writer.ts"],"sourcesContent":["import type {Writer, WriterOptions} from '@loaders.gl/loader-utils';\nimport type {DracoMesh} from './lib/draco-types';\nimport type {DracoBuildOptions} from './lib/draco-builder';\nimport DRACOBuilder from './lib/draco-builder';\nimport {loadDracoEncoderModule} from './lib/draco-module-loader';\nimport {VERSION} from './lib/utils/version';\n\nexport type DracoWriterOptions = WriterOptions & {\n draco?: DracoBuildOptions & {\n attributeNameEntry: string;\n };\n};\n\nconst DEFAULT_DRACO_OPTIONS = {\n pointcloud: false, // Set to true if pointcloud (mode: 0, no indices)\n attributeNameEntry: 'name'\n // Draco Compression Parameters\n // method: 'MESH_EDGEBREAKER_ENCODING',\n // speed: [5, 5],\n // quantization: {\n // POSITION: 10\n // }\n};\n\n/**\n * Exporter for Draco3D compressed geometries\n */\nexport const DracoWriter: Writer = {\n name: 'DRACO',\n id: 'draco',\n module: 'draco',\n version: VERSION,\n extensions: ['drc'],\n encode,\n options: {\n draco: DEFAULT_DRACO_OPTIONS\n }\n};\n\nasync function encode(data: DracoMesh, options: DracoWriterOptions = {}): Promise<ArrayBuffer> {\n // Dynamically load draco\n const {draco} = await loadDracoEncoderModule(options);\n const dracoBuilder = new DRACOBuilder(draco);\n\n try {\n return dracoBuilder.encodeSync(data, options.draco);\n } finally {\n dracoBuilder.destroy();\n }\n}\n"],"mappings":";;;;;;;;;AAGA;AACA;AACA;AAQA,IAAMA,qBAAqB,GAAG;EAC5BC,UAAU,EAAE,KAAK;EACjBC,kBAAkB,EAAE;AAOtB,CAAC;;AAKM,IAAMC,WAAmB,GAAG;EACjCC,IAAI,EAAE,OAAO;EACbC,EAAE,EAAE,OAAO;EACXC,MAAM,EAAE,OAAO;EACfC,OAAO,EAAEC,gBAAO;EAChBC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,MAAM,EAANA,MAAM;EACNC,OAAO,EAAE;IACPC,KAAK,EAAEZ;EACT;AACF,CAAC;AAAC;AAAA,SAEaU,MAAM;EAAA;AAAA;AAAA;EAAA,oEAArB,iBAAsBG,IAAe;IAAA;MAAA;MAAA;MAAA;MAAA;IAAA;MAAA;QAAA;UAAA;YAAEF,OAA2B,2DAAG,CAAC,CAAC;YAAA;YAAA,OAE/C,IAAAG,yCAAsB,EAACH,OAAO,CAAC;UAAA;YAAA;YAA9CC,KAAK,yBAALA,KAAK;YACNG,YAAY,GAAG,IAAIC,qBAAY,CAACJ,KAAK,CAAC;YAAA;YAAA,iCAGnCG,YAAY,CAACE,UAAU,CAACJ,IAAI,EAAEF,OAAO,CAACC,KAAK,CAAC;UAAA;YAAA;YAEnDG,YAAY,CAACG,OAAO,EAAE;YAAC;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAE1B;EAAA;AAAA"}
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.draco_StatusCode = exports.
|
|
6
|
+
exports.draco_StatusCode = exports.draco_GeometryAttribute_Type = exports.draco_EncodedGeometryType = exports.draco_DataType = void 0;
|
|
7
7
|
var draco_GeometryAttribute_Type;
|
|
8
8
|
exports.draco_GeometryAttribute_Type = draco_GeometryAttribute_Type;
|
|
9
|
-
|
|
10
9
|
(function (draco_GeometryAttribute_Type) {
|
|
11
10
|
draco_GeometryAttribute_Type[draco_GeometryAttribute_Type["draco_GeometryAttribute::INVALID"] = 0] = "draco_GeometryAttribute::INVALID";
|
|
12
11
|
draco_GeometryAttribute_Type[draco_GeometryAttribute_Type["draco_GeometryAttribute::POSITION"] = 1] = "draco_GeometryAttribute::POSITION";
|
|
@@ -15,19 +14,15 @@ exports.draco_GeometryAttribute_Type = draco_GeometryAttribute_Type;
|
|
|
15
14
|
draco_GeometryAttribute_Type[draco_GeometryAttribute_Type["draco_GeometryAttribute::TEX_COORD"] = 4] = "draco_GeometryAttribute::TEX_COORD";
|
|
16
15
|
draco_GeometryAttribute_Type[draco_GeometryAttribute_Type["draco_GeometryAttribute::GENERIC"] = 5] = "draco_GeometryAttribute::GENERIC";
|
|
17
16
|
})(draco_GeometryAttribute_Type || (exports.draco_GeometryAttribute_Type = draco_GeometryAttribute_Type = {}));
|
|
18
|
-
|
|
19
17
|
var draco_EncodedGeometryType;
|
|
20
18
|
exports.draco_EncodedGeometryType = draco_EncodedGeometryType;
|
|
21
|
-
|
|
22
19
|
(function (draco_EncodedGeometryType) {
|
|
23
20
|
draco_EncodedGeometryType[draco_EncodedGeometryType["draco::INVALID_GEOMETRY_TYPE"] = 0] = "draco::INVALID_GEOMETRY_TYPE";
|
|
24
21
|
draco_EncodedGeometryType[draco_EncodedGeometryType["draco::POINT_CLOUD"] = 1] = "draco::POINT_CLOUD";
|
|
25
22
|
draco_EncodedGeometryType[draco_EncodedGeometryType["draco::TRIANGULAR_MESH"] = 2] = "draco::TRIANGULAR_MESH";
|
|
26
23
|
})(draco_EncodedGeometryType || (exports.draco_EncodedGeometryType = draco_EncodedGeometryType = {}));
|
|
27
|
-
|
|
28
24
|
var draco_DataType;
|
|
29
25
|
exports.draco_DataType = draco_DataType;
|
|
30
|
-
|
|
31
26
|
(function (draco_DataType) {
|
|
32
27
|
draco_DataType[draco_DataType["draco::DT_INVALID"] = 0] = "draco::DT_INVALID";
|
|
33
28
|
draco_DataType[draco_DataType["draco::DT_INT8"] = 1] = "draco::DT_INT8";
|
|
@@ -43,10 +38,8 @@ exports.draco_DataType = draco_DataType;
|
|
|
43
38
|
draco_DataType[draco_DataType["draco::DT_BOOL"] = 11] = "draco::DT_BOOL";
|
|
44
39
|
draco_DataType[draco_DataType["draco::DT_TYPES_COUNT"] = 12] = "draco::DT_TYPES_COUNT";
|
|
45
40
|
})(draco_DataType || (exports.draco_DataType = draco_DataType = {}));
|
|
46
|
-
|
|
47
41
|
var draco_StatusCode;
|
|
48
42
|
exports.draco_StatusCode = draco_StatusCode;
|
|
49
|
-
|
|
50
43
|
(function (draco_StatusCode) {
|
|
51
44
|
draco_StatusCode[draco_StatusCode["draco_Status::OK"] = 0] = "draco_Status::OK";
|
|
52
45
|
draco_StatusCode[draco_StatusCode["draco_Status::DRACO_ERROR"] = 1] = "draco_Status::DRACO_ERROR";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/draco3d/draco3d-types.ts"],"names":["draco_GeometryAttribute_Type","draco_EncodedGeometryType","draco_DataType","draco_StatusCode"],"mappings":";;;;;;IAiBYA,4B;;;WAAAA,4B;AAAAA,EAAAA,4B,CAAAA,4B;AAAAA,EAAAA,4B,CAAAA,4B;AAAAA,EAAAA,4B,CAAAA,4B;AAAAA,EAAAA,4B,CAAAA,4B;AAAAA,EAAAA,4B,CAAAA,4B;AAAAA,EAAAA,4B,CAAAA,4B;GAAAA,4B,4CAAAA,4B;;IAUAC,yB;;;WAAAA,yB;AAAAA,EAAAA,yB,CAAAA,yB;AAAAA,EAAAA,yB,CAAAA,yB;AAAAA,EAAAA,yB,CAAAA,yB;GAAAA,yB,yCAAAA,yB;;IAOAC,c;;;WAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;GAAAA,c,8BAAAA,c;;IAiBAC,gB;;;WAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;GAAAA,gB,gCAAAA,gB","sourcesContent":["// A set of typescript types manually adapted from the Draco web IDL\n// Draco JS is a bit tricky to work with due to the C++ emscripten code base\n// sparse documentation, so these types provide an extra safety net.\n\n// Typescript defs adapted from draco3d emscripten IDL\n// https://raw.githubusercontent.com/google/draco/master/src/draco/javascript/emscripten/draco_web_decoder.idl\n// Interface exposed to emscripten's WebIDL Binder.\n// http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/WebIDL-Binder.html\n\n/* eslint-disable camelcase */\n\n/** Draco3D untyped memory pointer */\ntype VoidPtr = any;\n\n// DRACO WEB DECODER IDL\n\n/** Draco3D geometry attribute type */\nexport enum draco_GeometryAttribute_Type {\n 'draco_GeometryAttribute::INVALID',\n 'draco_GeometryAttribute::POSITION',\n 'draco_GeometryAttribute::NORMAL',\n 'draco_GeometryAttribute::COLOR',\n 'draco_GeometryAttribute::TEX_COORD',\n 'draco_GeometryAttribute::GENERIC'\n}\n\n/** Draco3D encoded geometry type */\nexport enum draco_EncodedGeometryType {\n 'draco::INVALID_GEOMETRY_TYPE',\n 'draco::POINT_CLOUD',\n 'draco::TRIANGULAR_MESH'\n}\n\n/** Draco3D data type */\nexport enum draco_DataType {\n 'draco::DT_INVALID',\n 'draco::DT_INT8',\n 'draco::DT_UINT8',\n 'draco::DT_INT16',\n 'draco::DT_UINT16',\n 'draco::DT_INT32',\n 'draco::DT_UINT32',\n 'draco::DT_INT64',\n 'draco::DT_UINT64',\n 'draco::DT_FLOAT32',\n 'draco::DT_FLOAT64',\n 'draco::DT_BOOL',\n 'draco::DT_TYPES_COUNT'\n}\n\n/** Draco3D status code */\nexport enum draco_StatusCode {\n 'draco_Status::OK',\n 'draco_Status::DRACO_ERROR',\n 'draco_Status::IO_ERROR',\n 'draco_Status::INVALID_PARAMETER',\n 'draco_Status::UNSUPPORTED_VERSION',\n 'draco_Status::UNKNOWN_VERSION'\n}\n\n/** Draco3D decoder buffer allocated on emscripten heap */\nexport declare class DecoderBuffer {\n constructor();\n Init(data: Int8Array, data_size: number): void;\n}\n\n/** Draco3D attribute transform data */\nexport declare class AttributeTransformData {\n constructor();\n transform_type(): number;\n}\n\n/** Draco3D geometry attribute */\nexport declare class GeometryAttribute {\n constructor();\n}\n\n/** Draco3D point attribute */\nexport declare class PointAttribute {\n ptr: VoidPtr;\n\n constructor();\n size(): number;\n GetAttributeTransformData(): AttributeTransformData;\n\n // From GeometryAttribute\n attribute_type(): number;\n data_type(): number;\n num_components(): number;\n normalized(): boolean;\n byte_stride(): number;\n byte_offset(): number;\n unique_id(): number;\n}\n\n/** Draco3D attribute transform */\nexport declare class AttributeQuantizationTransform {\n constructor();\n InitFromAttribute(att: PointAttribute): boolean;\n quantization_bits(): number;\n min_value(axis: number): number;\n range(): number;\n}\n\n/** Draco3D attribute transform */\nexport declare class AttributeOctahedronTransform {\n constructor();\n InitFromAttribute(att: PointAttribute): boolean;\n quantization_bits(): number;\n}\n\n/** Draco3D point cloud */\nexport declare class PointCloud {\n ptr: VoidPtr;\n\n constructor();\n num_attributes(): number;\n num_points(): number;\n}\n\n/** Draco3D mesh */\nexport declare class Mesh extends PointCloud {\n constructor();\n num_faces(): number;\n}\n\n/** Draco3D metadata */\nexport declare class Metadata {\n ptr: VoidPtr;\n\n constructor();\n}\n\n/** Draco3D status */\nexport declare class Status {\n constructor();\n code(): draco_StatusCode;\n ok(): boolean;\n error_msg(): string;\n}\n\n/** Draco3D Float32Array allocated on the emscripten heap */\nexport declare class DracoFloat32Array {\n constructor();\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D Int8Array allocated on the emscripten heap */\nexport declare class DracoInt8Array {\n constructor();\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D Uint8Array allocated on the emscripten heap */\nexport declare class DracoUInt8Array {\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D Int16Array allocated on the emscripten heap */\nexport declare class DracoInt16Array {\n constructor();\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D Uint16Array allocated on the emscripten heap */\nexport declare class DracoUInt16Array {\n constructor();\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D Int32Array allocated on the emscripten heap */\nexport declare class DracoInt32Array {\n constructor();\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D Uint32Array allocated on the emscripten heap */\nexport declare class DracoUInt32Array {\n constructor();\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D metadata querier */\nexport declare class MetadataQuerier {\n constructor();\n\n HasEntry(metadata: Metadata, entry_name: string): string;\n GetIntEntry(metadata: Metadata, entry_name: string);\n GetIntEntryArray(metadata: Metadata, entry_name: string, out_values: DracoInt32Array);\n GetDoubleEntry(metadata: Metadata, entry_name: string): number;\n GetStringEntry(metadata: Metadata, entry_name: string): string;\n\n NumEntries(metadata: Metadata): number;\n GetEntryName(metadata: Metadata, entry_id: number): string;\n}\n\n/**\n * Draco3D Decoder class\n */\nexport declare class Decoder {\n constructor();\n\n GetEncodedGeometryType(in_buffer: DecoderBuffer): draco_EncodedGeometryType;\n\n DecodeBufferToPointCloud(in_buffer: DecoderBuffer, out_point_cloud: PointCloud): Status;\n DecodeBufferToMesh(in_buffer: DecoderBuffer, out_mesh: Mesh): Status;\n\n GetAttributeId(pc: PointCloud, type: draco_GeometryAttribute_Type): number;\n GetAttributeIdByName(pc: PointCloud, name: string): number;\n GetAttributeIdByMetadataEntry(pc: PointCloud, name: string, value: string): number;\n\n GetAttribute(pc: PointCloud, att_id: number): PointAttribute;\n GetAttributeByUniqueId(pc: PointCloud, unique_id: number): PointAttribute;\n\n GetMetadata(pc: PointCloud): Metadata;\n GetAttributeMetadata(pc: PointCloud, att_id: number): Metadata;\n\n GetFaceFromMesh(m: Mesh, face_id: number, out_values: DracoInt32Array): boolean;\n GetTriangleStripsFromMesh(m: Mesh, strip_values: DracoInt32Array);\n\n GetTrianglesUInt16Array(m: Mesh, out_size: number, out_values: VoidPtr): boolean;\n GetTrianglesUInt32Array(m: Mesh, out_size: number, out_values: VoidPtr): boolean;\n\n GetAttributeFloat(pa: PointAttribute, att_index: number, out_values: DracoFloat32Array): boolean;\n\n GetAttributeFloatForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoFloat32Array\n ): boolean;\n\n // Deprecated, use GetAttributeInt32ForAllPoints instead.\n GetAttributeIntForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoInt32Array\n ): boolean;\n\n GetAttributeInt8ForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoInt8Array\n ): boolean;\n GetAttributeUInt8ForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoUInt8Array\n ): boolean;\n GetAttributeInt16ForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoInt16Array\n ): boolean;\n GetAttributeUInt16ForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoUInt16Array\n ): boolean;\n GetAttributeInt32ForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoInt32Array\n ): boolean;\n GetAttributeUInt32ForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoUInt32Array\n ): boolean;\n\n GetAttributeDataArrayForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n data_type: draco_DataType,\n out_size: number,\n out_values: VoidPtr\n ): boolean;\n\n SkipAttributeTransform(att_type: draco_GeometryAttribute_Type): void;\n}\n\n// DRACO WEB ENCODER IDL\n\n/** Draco3D metadata builder */\nexport declare class MetadataBuilder {\n constructor();\n AddStringEntry(metadata: Metadata, entry_name: string, entry_value: string);\n AddIntEntry(metadata: Metadata, entry_name: string, entry_value: number);\n AddDoubleEntry(metadata: Metadata, entry_name: string, entry_value: number);\n AddIntEntryArray(\n metadata: Metadata,\n entry_name: string,\n entry_value: Int32Array,\n num_values: number\n );\n}\n\n/** Draco3D point cloud builder */\n\nexport declare class PointCloudBuilder {\n constructor();\n PointCloudBuilder(): void;\n AddFloatAttribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Float32Array\n );\n AddInt8Attribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Int8Array\n );\n AddUInt8Attribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Uint8Array\n );\n AddInt16Attribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Int16Array\n );\n AddUInt16Attribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Uint16Array\n );\n AddInt32Attribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Int32Array\n );\n AddUInt32Attribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Uint32Array\n );\n\n AddMetadata(pc: PointCloud, metadata: Metadata): boolean;\n SetMetadataForAttribute(pc: PointCloud, attribute_id: number, metadata: Metadata);\n}\n\n/** Draco3D mesh builder */\nexport declare class MeshBuilder extends PointCloudBuilder {\n constructor();\n AddFacesToMesh(mesh: Mesh, num_faces: number, faces: number[]): boolean;\n}\n\n/** Draco3D encoder */\nexport declare class Encoder {\n constructor();\n Encoder(): void;\n SetEncodingMethod(method: number): void;\n SetAttributeQuantization(type: draco_GeometryAttribute_Type, quantization_bits: number);\n SetAttributeExplicitQuantization(\n type: draco_GeometryAttribute_Type,\n quantization_bits: number,\n num_components: number,\n origin: number[],\n range: number\n );\n SetSpeedOptions(encoding_speed: number, decoding_speed: number): void;\n SetTrackEncodedProperties(flag: boolean): void;\n\n EncodeMeshToDracoBuffer(mesh: Mesh, encoded_data: DracoInt8Array);\n EncodePointCloudToDracoBuffer(\n pc: PointCloud,\n deduplicate_values: boolean,\n encoded_data: DracoInt8Array\n );\n\n // Returns the number of encoded points or faces from the last Encode\n // operation. Returns 0 if SetTrackEncodedProperties was not set to true.\n GetNumberOfEncodedPoints(): number;\n GetNumberOfEncodedFaces(): number;\n}\n\n/** Draco3D expert encoder */\nexport declare class ExpertEncoder {\n constructor();\n ExpertEncoder(pc: PointCloud): void;\n SetEncodingMethod(method: number): void;\n SetAttributeQuantization(att_id: number, quantization_bits: number);\n SetAttributeExplicitQuantization(\n att_id: number,\n quantization_bits: number,\n num_components: number,\n origin: number[],\n range: number\n );\n SetSpeedOptions(encoding_speed: number, decoding_speed: number): void;\n SetTrackEncodedProperties(flag: boolean): void;\n\n EncodeToDracoBuffer(deduplicate_values: boolean, encoded_data: DracoInt8Array);\n\n // Returns the number of encoded points or faces from the last Encode\n // operation. Returns 0 if SetTrackEncodedProperties was not set to true.\n GetNumberOfEncodedPoints(): number;\n GetNumberOfEncodedFaces(): number;\n}\n\n/** Draco3D module interface */\nexport interface Draco3D {\n // ENUMS\n\n // draco_EncodedGeometryType\n readonly INVALID_GEOMETRY_TYPE: draco_EncodedGeometryType;\n readonly POINT_CLOUD: draco_EncodedGeometryType;\n readonly TRIANGULAR_MESH: draco_EncodedGeometryType;\n\n // enum draco_GeometryAttribute_Type\n readonly INVALID: draco_GeometryAttribute_Type;\n readonly POSITION: draco_GeometryAttribute_Type;\n readonly NORMAL: draco_GeometryAttribute_Type;\n readonly COLOR: draco_GeometryAttribute_Type;\n readonly TEX_COORD: draco_GeometryAttribute_Type;\n readonly GENERIC: draco_GeometryAttribute_Type;\n\n // enum draco_DataType\n readonly DT_INVALID: draco_DataType;\n readonly DT_INT8: draco_DataType;\n readonly DT_UINT8: draco_DataType;\n readonly DT_INT16: draco_DataType;\n readonly DT_UINT16: draco_DataType;\n readonly DT_INT32: draco_DataType;\n readonly DT_UINT32: draco_DataType;\n readonly DT_INT64: draco_DataType;\n readonly DT_UINT64: draco_DataType;\n readonly DT_FLOAT32: draco_DataType;\n readonly DT_FLOAT64: draco_DataType;\n readonly DT_BOOL: draco_DataType;\n readonly DT_TYPES_COUNT: draco_DataType;\n\n readonly Mesh: typeof Mesh;\n readonly PointCloud: typeof PointCloud;\n readonly Metadata: typeof Metadata;\n\n readonly Encoder: typeof Encoder;\n readonly MeshBuilder: typeof MeshBuilder;\n readonly MetadataBuilder: typeof MetadataBuilder;\n\n readonly MetadataQuerier: typeof MetadataQuerier;\n readonly Decoder: typeof Decoder;\n readonly DecoderBuffer: typeof DecoderBuffer;\n\n readonly DracoFloat32Array: typeof DracoFloat32Array;\n readonly DracoInt8Array: typeof DracoInt8Array;\n readonly DracoUInt8Array: typeof DracoUInt8Array;\n readonly DracoInt16Array: typeof DracoInt16Array;\n readonly DracoUInt16Array: typeof DracoUInt16Array;\n readonly DracoInt32Array: typeof DracoInt32Array;\n readonly DracoUInt32Array: typeof DracoUInt32Array;\n\n readonly AttributeQuantizationTransform: typeof AttributeQuantizationTransform;\n\n // createEncoderModule(): Encoder;\n // createDecoderModule(): Decoder;\n destroy(resource: any): void;\n _malloc(byteLength: number): number;\n _free(ptr: number): void;\n\n HEAPF32: {\n buffer: ArrayBuffer;\n };\n}\n"],"file":"draco3d-types.js"}
|
|
1
|
+
{"version":3,"file":"draco3d-types.js","names":["draco_GeometryAttribute_Type","draco_EncodedGeometryType","draco_DataType","draco_StatusCode"],"sources":["../../../src/draco3d/draco3d-types.ts"],"sourcesContent":["// A set of typescript types manually adapted from the Draco web IDL\n// Draco JS is a bit tricky to work with due to the C++ emscripten code base\n// sparse documentation, so these types provide an extra safety net.\n\n// Typescript defs adapted from draco3d emscripten IDL\n// https://raw.githubusercontent.com/google/draco/master/src/draco/javascript/emscripten/draco_web_decoder.idl\n// Interface exposed to emscripten's WebIDL Binder.\n// http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/WebIDL-Binder.html\n\n/* eslint-disable camelcase */\n\n/** Draco3D untyped memory pointer */\ntype VoidPtr = any;\n\n// DRACO WEB DECODER IDL\n\n/** Draco3D geometry attribute type */\nexport enum draco_GeometryAttribute_Type {\n 'draco_GeometryAttribute::INVALID',\n 'draco_GeometryAttribute::POSITION',\n 'draco_GeometryAttribute::NORMAL',\n 'draco_GeometryAttribute::COLOR',\n 'draco_GeometryAttribute::TEX_COORD',\n 'draco_GeometryAttribute::GENERIC'\n}\n\n/** Draco3D encoded geometry type */\nexport enum draco_EncodedGeometryType {\n 'draco::INVALID_GEOMETRY_TYPE',\n 'draco::POINT_CLOUD',\n 'draco::TRIANGULAR_MESH'\n}\n\n/** Draco3D data type */\nexport enum draco_DataType {\n 'draco::DT_INVALID',\n 'draco::DT_INT8',\n 'draco::DT_UINT8',\n 'draco::DT_INT16',\n 'draco::DT_UINT16',\n 'draco::DT_INT32',\n 'draco::DT_UINT32',\n 'draco::DT_INT64',\n 'draco::DT_UINT64',\n 'draco::DT_FLOAT32',\n 'draco::DT_FLOAT64',\n 'draco::DT_BOOL',\n 'draco::DT_TYPES_COUNT'\n}\n\n/** Draco3D status code */\nexport enum draco_StatusCode {\n 'draco_Status::OK',\n 'draco_Status::DRACO_ERROR',\n 'draco_Status::IO_ERROR',\n 'draco_Status::INVALID_PARAMETER',\n 'draco_Status::UNSUPPORTED_VERSION',\n 'draco_Status::UNKNOWN_VERSION'\n}\n\n/** Draco3D decoder buffer allocated on emscripten heap */\nexport declare class DecoderBuffer {\n constructor();\n Init(data: Int8Array, data_size: number): void;\n}\n\n/** Draco3D attribute transform data */\nexport declare class AttributeTransformData {\n constructor();\n transform_type(): number;\n}\n\n/** Draco3D geometry attribute */\nexport declare class GeometryAttribute {\n constructor();\n}\n\n/** Draco3D point attribute */\nexport declare class PointAttribute {\n ptr: VoidPtr;\n\n constructor();\n size(): number;\n GetAttributeTransformData(): AttributeTransformData;\n\n // From GeometryAttribute\n attribute_type(): number;\n data_type(): number;\n num_components(): number;\n normalized(): boolean;\n byte_stride(): number;\n byte_offset(): number;\n unique_id(): number;\n}\n\n/** Draco3D attribute transform */\nexport declare class AttributeQuantizationTransform {\n constructor();\n InitFromAttribute(att: PointAttribute): boolean;\n quantization_bits(): number;\n min_value(axis: number): number;\n range(): number;\n}\n\n/** Draco3D attribute transform */\nexport declare class AttributeOctahedronTransform {\n constructor();\n InitFromAttribute(att: PointAttribute): boolean;\n quantization_bits(): number;\n}\n\n/** Draco3D point cloud */\nexport declare class PointCloud {\n ptr: VoidPtr;\n\n constructor();\n num_attributes(): number;\n num_points(): number;\n}\n\n/** Draco3D mesh */\nexport declare class Mesh extends PointCloud {\n constructor();\n num_faces(): number;\n}\n\n/** Draco3D metadata */\nexport declare class Metadata {\n ptr: VoidPtr;\n\n constructor();\n}\n\n/** Draco3D status */\nexport declare class Status {\n constructor();\n code(): draco_StatusCode;\n ok(): boolean;\n error_msg(): string;\n}\n\n/** Draco3D Float32Array allocated on the emscripten heap */\nexport declare class DracoFloat32Array {\n constructor();\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D Int8Array allocated on the emscripten heap */\nexport declare class DracoInt8Array {\n constructor();\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D Uint8Array allocated on the emscripten heap */\nexport declare class DracoUInt8Array {\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D Int16Array allocated on the emscripten heap */\nexport declare class DracoInt16Array {\n constructor();\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D Uint16Array allocated on the emscripten heap */\nexport declare class DracoUInt16Array {\n constructor();\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D Int32Array allocated on the emscripten heap */\nexport declare class DracoInt32Array {\n constructor();\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D Uint32Array allocated on the emscripten heap */\nexport declare class DracoUInt32Array {\n constructor();\n GetValue(index: number): number;\n size(): number;\n}\n\n/** Draco3D metadata querier */\nexport declare class MetadataQuerier {\n constructor();\n\n HasEntry(metadata: Metadata, entry_name: string): string;\n GetIntEntry(metadata: Metadata, entry_name: string);\n GetIntEntryArray(metadata: Metadata, entry_name: string, out_values: DracoInt32Array);\n GetDoubleEntry(metadata: Metadata, entry_name: string): number;\n GetStringEntry(metadata: Metadata, entry_name: string): string;\n\n NumEntries(metadata: Metadata): number;\n GetEntryName(metadata: Metadata, entry_id: number): string;\n}\n\n/**\n * Draco3D Decoder class\n */\nexport declare class Decoder {\n constructor();\n\n GetEncodedGeometryType(in_buffer: DecoderBuffer): draco_EncodedGeometryType;\n\n DecodeBufferToPointCloud(in_buffer: DecoderBuffer, out_point_cloud: PointCloud): Status;\n DecodeBufferToMesh(in_buffer: DecoderBuffer, out_mesh: Mesh): Status;\n\n GetAttributeId(pc: PointCloud, type: draco_GeometryAttribute_Type): number;\n GetAttributeIdByName(pc: PointCloud, name: string): number;\n GetAttributeIdByMetadataEntry(pc: PointCloud, name: string, value: string): number;\n\n GetAttribute(pc: PointCloud, att_id: number): PointAttribute;\n GetAttributeByUniqueId(pc: PointCloud, unique_id: number): PointAttribute;\n\n GetMetadata(pc: PointCloud): Metadata;\n GetAttributeMetadata(pc: PointCloud, att_id: number): Metadata;\n\n GetFaceFromMesh(m: Mesh, face_id: number, out_values: DracoInt32Array): boolean;\n GetTriangleStripsFromMesh(m: Mesh, strip_values: DracoInt32Array);\n\n GetTrianglesUInt16Array(m: Mesh, out_size: number, out_values: VoidPtr): boolean;\n GetTrianglesUInt32Array(m: Mesh, out_size: number, out_values: VoidPtr): boolean;\n\n GetAttributeFloat(pa: PointAttribute, att_index: number, out_values: DracoFloat32Array): boolean;\n\n GetAttributeFloatForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoFloat32Array\n ): boolean;\n\n // Deprecated, use GetAttributeInt32ForAllPoints instead.\n GetAttributeIntForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoInt32Array\n ): boolean;\n\n GetAttributeInt8ForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoInt8Array\n ): boolean;\n GetAttributeUInt8ForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoUInt8Array\n ): boolean;\n GetAttributeInt16ForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoInt16Array\n ): boolean;\n GetAttributeUInt16ForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoUInt16Array\n ): boolean;\n GetAttributeInt32ForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoInt32Array\n ): boolean;\n GetAttributeUInt32ForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n out_values: DracoUInt32Array\n ): boolean;\n\n GetAttributeDataArrayForAllPoints(\n pc: PointCloud,\n pa: PointAttribute,\n data_type: draco_DataType,\n out_size: number,\n out_values: VoidPtr\n ): boolean;\n\n SkipAttributeTransform(att_type: draco_GeometryAttribute_Type): void;\n}\n\n// DRACO WEB ENCODER IDL\n\n/** Draco3D metadata builder */\nexport declare class MetadataBuilder {\n constructor();\n AddStringEntry(metadata: Metadata, entry_name: string, entry_value: string);\n AddIntEntry(metadata: Metadata, entry_name: string, entry_value: number);\n AddDoubleEntry(metadata: Metadata, entry_name: string, entry_value: number);\n AddIntEntryArray(\n metadata: Metadata,\n entry_name: string,\n entry_value: Int32Array,\n num_values: number\n );\n}\n\n/** Draco3D point cloud builder */\n\nexport declare class PointCloudBuilder {\n constructor();\n PointCloudBuilder(): void;\n AddFloatAttribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Float32Array\n );\n AddInt8Attribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Int8Array\n );\n AddUInt8Attribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Uint8Array\n );\n AddInt16Attribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Int16Array\n );\n AddUInt16Attribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Uint16Array\n );\n AddInt32Attribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Int32Array\n );\n AddUInt32Attribute(\n pc: PointCloud,\n type: draco_GeometryAttribute_Type,\n num_vertices: number,\n num_components: number,\n att_values: Uint32Array\n );\n\n AddMetadata(pc: PointCloud, metadata: Metadata): boolean;\n SetMetadataForAttribute(pc: PointCloud, attribute_id: number, metadata: Metadata);\n}\n\n/** Draco3D mesh builder */\nexport declare class MeshBuilder extends PointCloudBuilder {\n constructor();\n AddFacesToMesh(mesh: Mesh, num_faces: number, faces: number[]): boolean;\n}\n\n/** Draco3D encoder */\nexport declare class Encoder {\n constructor();\n Encoder(): void;\n SetEncodingMethod(method: number): void;\n SetAttributeQuantization(type: draco_GeometryAttribute_Type, quantization_bits: number);\n SetAttributeExplicitQuantization(\n type: draco_GeometryAttribute_Type,\n quantization_bits: number,\n num_components: number,\n origin: number[],\n range: number\n );\n SetSpeedOptions(encoding_speed: number, decoding_speed: number): void;\n SetTrackEncodedProperties(flag: boolean): void;\n\n EncodeMeshToDracoBuffer(mesh: Mesh, encoded_data: DracoInt8Array);\n EncodePointCloudToDracoBuffer(\n pc: PointCloud,\n deduplicate_values: boolean,\n encoded_data: DracoInt8Array\n );\n\n // Returns the number of encoded points or faces from the last Encode\n // operation. Returns 0 if SetTrackEncodedProperties was not set to true.\n GetNumberOfEncodedPoints(): number;\n GetNumberOfEncodedFaces(): number;\n}\n\n/** Draco3D expert encoder */\nexport declare class ExpertEncoder {\n constructor();\n ExpertEncoder(pc: PointCloud): void;\n SetEncodingMethod(method: number): void;\n SetAttributeQuantization(att_id: number, quantization_bits: number);\n SetAttributeExplicitQuantization(\n att_id: number,\n quantization_bits: number,\n num_components: number,\n origin: number[],\n range: number\n );\n SetSpeedOptions(encoding_speed: number, decoding_speed: number): void;\n SetTrackEncodedProperties(flag: boolean): void;\n\n EncodeToDracoBuffer(deduplicate_values: boolean, encoded_data: DracoInt8Array);\n\n // Returns the number of encoded points or faces from the last Encode\n // operation. Returns 0 if SetTrackEncodedProperties was not set to true.\n GetNumberOfEncodedPoints(): number;\n GetNumberOfEncodedFaces(): number;\n}\n\n/** Draco3D module interface */\nexport interface Draco3D {\n // ENUMS\n\n // draco_EncodedGeometryType\n readonly INVALID_GEOMETRY_TYPE: draco_EncodedGeometryType;\n readonly POINT_CLOUD: draco_EncodedGeometryType;\n readonly TRIANGULAR_MESH: draco_EncodedGeometryType;\n\n // enum draco_GeometryAttribute_Type\n readonly INVALID: draco_GeometryAttribute_Type;\n readonly POSITION: draco_GeometryAttribute_Type;\n readonly NORMAL: draco_GeometryAttribute_Type;\n readonly COLOR: draco_GeometryAttribute_Type;\n readonly TEX_COORD: draco_GeometryAttribute_Type;\n readonly GENERIC: draco_GeometryAttribute_Type;\n\n // enum draco_DataType\n readonly DT_INVALID: draco_DataType;\n readonly DT_INT8: draco_DataType;\n readonly DT_UINT8: draco_DataType;\n readonly DT_INT16: draco_DataType;\n readonly DT_UINT16: draco_DataType;\n readonly DT_INT32: draco_DataType;\n readonly DT_UINT32: draco_DataType;\n readonly DT_INT64: draco_DataType;\n readonly DT_UINT64: draco_DataType;\n readonly DT_FLOAT32: draco_DataType;\n readonly DT_FLOAT64: draco_DataType;\n readonly DT_BOOL: draco_DataType;\n readonly DT_TYPES_COUNT: draco_DataType;\n\n readonly Mesh: typeof Mesh;\n readonly PointCloud: typeof PointCloud;\n readonly Metadata: typeof Metadata;\n\n readonly Encoder: typeof Encoder;\n readonly MeshBuilder: typeof MeshBuilder;\n readonly MetadataBuilder: typeof MetadataBuilder;\n\n readonly MetadataQuerier: typeof MetadataQuerier;\n readonly Decoder: typeof Decoder;\n readonly DecoderBuffer: typeof DecoderBuffer;\n\n readonly DracoFloat32Array: typeof DracoFloat32Array;\n readonly DracoInt8Array: typeof DracoInt8Array;\n readonly DracoUInt8Array: typeof DracoUInt8Array;\n readonly DracoInt16Array: typeof DracoInt16Array;\n readonly DracoUInt16Array: typeof DracoUInt16Array;\n readonly DracoInt32Array: typeof DracoInt32Array;\n readonly DracoUInt32Array: typeof DracoUInt32Array;\n\n readonly AttributeQuantizationTransform: typeof AttributeQuantizationTransform;\n\n // createEncoderModule(): Encoder;\n // createDecoderModule(): Decoder;\n destroy(resource: any): void;\n _malloc(byteLength: number): number;\n _free(ptr: number): void;\n\n HEAPF32: {\n buffer: ArrayBuffer;\n };\n}\n"],"mappings":";;;;;;IAiBYA,4BAA4B;AAAA;AAAA,WAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;EAA5BA,4BAA4B,CAA5BA,4BAA4B;AAAA,GAA5BA,4BAA4B,4CAA5BA,4BAA4B;AAAA,IAU5BC,yBAAyB;AAAA;AAAA,WAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;AAAA,GAAzBA,yBAAyB,yCAAzBA,yBAAyB;AAAA,IAOzBC,cAAc;AAAA;AAAA,WAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;AAAA,GAAdA,cAAc,8BAAdA,cAAc;AAAA,IAiBdC,gBAAgB;AAAA;AAAA,WAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;AAAA,GAAhBA,gBAAgB,gCAAhBA,gBAAgB"}
|
package/dist/es5/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
7
|
+
exports.DracoLoader = void 0;
|
|
8
8
|
Object.defineProperty(exports, "DracoWorkerLoader", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
get: function get() {
|
|
@@ -17,30 +17,18 @@ Object.defineProperty(exports, "DracoWriter", {
|
|
|
17
17
|
return _dracoWriter.DracoWriter;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
exports._TypecheckDracoLoader = exports.
|
|
21
|
-
|
|
20
|
+
exports._TypecheckDracoLoader = exports.DracoWriterWorker = void 0;
|
|
22
21
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
23
|
-
|
|
24
22
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
25
|
-
|
|
26
23
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
24
|
var _dracoLoader = require("./draco-loader");
|
|
29
|
-
|
|
30
25
|
var _dracoParser = _interopRequireDefault(require("./lib/draco-parser"));
|
|
31
|
-
|
|
32
26
|
var _dracoModuleLoader = require("./lib/draco-module-loader");
|
|
33
|
-
|
|
34
27
|
var _version = require("./lib/utils/version");
|
|
35
|
-
|
|
36
28
|
var _workerUtils = require("@loaders.gl/worker-utils");
|
|
37
|
-
|
|
38
29
|
var _dracoWriter = require("./draco-writer");
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
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; }
|
|
43
|
-
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
44
32
|
var DracoWriterWorker = {
|
|
45
33
|
id: _workerUtils.isBrowser ? 'draco-writer' : 'draco-writer-nodejs',
|
|
46
34
|
name: 'Draco compressed geometry writer',
|
|
@@ -52,41 +40,34 @@ var DracoWriterWorker = {
|
|
|
52
40
|
source: null
|
|
53
41
|
}
|
|
54
42
|
};
|
|
55
|
-
exports.DracoWriterWorker = DracoWriterWorker;
|
|
56
43
|
|
|
44
|
+
exports.DracoWriterWorker = DracoWriterWorker;
|
|
57
45
|
var DracoLoader = _objectSpread(_objectSpread({}, _dracoLoader.DracoLoader), {}, {
|
|
58
46
|
parse: parse
|
|
59
47
|
});
|
|
60
|
-
|
|
61
48
|
exports.DracoLoader = DracoLoader;
|
|
62
|
-
|
|
63
49
|
function parse(_x, _x2) {
|
|
64
50
|
return _parse.apply(this, arguments);
|
|
65
51
|
}
|
|
66
|
-
|
|
67
52
|
function _parse() {
|
|
68
53
|
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
|
|
69
54
|
var _yield$loadDracoDecod, draco, dracoParser;
|
|
70
|
-
|
|
71
55
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
72
56
|
while (1) {
|
|
73
57
|
switch (_context.prev = _context.next) {
|
|
74
58
|
case 0:
|
|
75
59
|
_context.next = 2;
|
|
76
60
|
return (0, _dracoModuleLoader.loadDracoDecoderModule)(options);
|
|
77
|
-
|
|
78
61
|
case 2:
|
|
79
62
|
_yield$loadDracoDecod = _context.sent;
|
|
80
63
|
draco = _yield$loadDracoDecod.draco;
|
|
81
64
|
dracoParser = new _dracoParser.default(draco);
|
|
82
65
|
_context.prev = 5;
|
|
83
66
|
return _context.abrupt("return", dracoParser.parseSync(arrayBuffer, options === null || options === void 0 ? void 0 : options.draco));
|
|
84
|
-
|
|
85
67
|
case 7:
|
|
86
68
|
_context.prev = 7;
|
|
87
69
|
dracoParser.destroy();
|
|
88
70
|
return _context.finish(7);
|
|
89
|
-
|
|
90
71
|
case 10:
|
|
91
72
|
case "end":
|
|
92
73
|
return _context.stop();
|
|
@@ -96,7 +77,6 @@ function _parse() {
|
|
|
96
77
|
}));
|
|
97
78
|
return _parse.apply(this, arguments);
|
|
98
79
|
}
|
|
99
|
-
|
|
100
80
|
var _TypecheckDracoLoader = DracoLoader;
|
|
101
81
|
exports._TypecheckDracoLoader = _TypecheckDracoLoader;
|
|
102
82
|
//# sourceMappingURL=index.js.map
|
package/dist/es5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["DracoWriterWorker","id","isBrowser","name","module","version","VERSION","worker","options","draco","source","DracoLoader","DracoWorkerLoader","parse","arrayBuffer","loadDracoDecoderModule","dracoParser","DracoParser","parseSync","destroy","_TypecheckDracoLoader"],"sources":["../../src/index.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {DracoMesh, DracoLoaderData} from './lib/draco-types';\nimport type {DracoLoaderOptions} from './draco-loader';\nimport {DracoLoader as DracoWorkerLoader} from './draco-loader';\nimport DracoParser from './lib/draco-parser';\nimport {loadDracoDecoderModule} from './lib/draco-module-loader';\nimport {VERSION} from './lib/utils/version';\nimport {isBrowser} from '@loaders.gl/worker-utils';\n\n// Draco data types\n\nexport type {DracoMesh, DracoLoaderData};\n\n// Draco Writer\n\nexport type {DracoWriterOptions} from './draco-writer';\nexport {DracoWriter} from './draco-writer';\n\n/**\n * Browser worker doesn't work because of issue during \"draco_encoder.js\" loading.\n * Refused to execute script from 'https://raw.githubusercontent.com/google/draco/1.4.1/javascript/draco_encoder.js' because its MIME type ('') is not executable.\n */\nexport const DracoWriterWorker = {\n id: isBrowser ? 'draco-writer' : 'draco-writer-nodejs',\n name: 'Draco compressed geometry writer',\n module: 'draco',\n version: VERSION,\n worker: true,\n options: {\n draco: {},\n source: null\n }\n};\n\n// Draco Loader\n\nexport type {DracoLoaderOptions};\nexport {DracoWorkerLoader};\n\n/**\n * Loader for Draco3D compressed geometries\n */\nexport const DracoLoader = {\n ...DracoWorkerLoader,\n parse\n};\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: DracoLoaderOptions): Promise<DracoMesh> {\n const {draco} = await loadDracoDecoderModule(options);\n const dracoParser = new DracoParser(draco);\n try {\n return dracoParser.parseSync(arrayBuffer, options?.draco);\n } finally {\n dracoParser.destroy();\n }\n}\n\n// TYPE TESTS - TODO find a better way than exporting junk\nexport const _TypecheckDracoLoader: LoaderWithParser = DracoLoader;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA;AACA;AACA;AACA;AACA;AASA;AAA2C;AAAA;AAMpC,IAAMA,iBAAiB,GAAG;EAC/BC,EAAE,EAAEC,sBAAS,GAAG,cAAc,GAAG,qBAAqB;EACtDC,IAAI,EAAE,kCAAkC;EACxCC,MAAM,EAAE,OAAO;EACfC,OAAO,EAAEC,gBAAO;EAChBC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAE;IACPC,KAAK,EAAE,CAAC,CAAC;IACTC,MAAM,EAAE;EACV;AACF,CAAC;;AAAC;AAUK,IAAMC,WAAW,mCACnBC,wBAAiB;EACpBC,KAAK,EAALA;AAAK,EACN;AAAC;AAAA,SAEaA,KAAK;EAAA;AAAA;AAAA;EAAA,mEAApB,iBAAqBC,WAAwB,EAAEN,OAA4B;IAAA;IAAA;MAAA;QAAA;UAAA;YAAA;YAAA,OACnD,IAAAO,yCAAsB,EAACP,OAAO,CAAC;UAAA;YAAA;YAA9CC,KAAK,yBAALA,KAAK;YACNO,WAAW,GAAG,IAAIC,oBAAW,CAACR,KAAK,CAAC;YAAA;YAAA,iCAEjCO,WAAW,CAACE,SAAS,CAACJ,WAAW,EAAEN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,CAAC;UAAA;YAAA;YAEzDO,WAAW,CAACG,OAAO,EAAE;YAAC;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAEzB;EAAA;AAAA;AAGM,IAAMC,qBAAuC,GAAGT,WAAW;AAAC"}
|