Draco is an open-source library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics.
*`draco_decoder.js` — Emscripten-compiled decoder, compatible with any modern browser.
*`draco_decoder.wasm` — WebAssembly decoder, compatible with newer browsers and devices.
*`draco_wasm_wrapper.js` — JavaScript wrapper for the WASM decoder.
Each file is provided in two variations:
***Default:** Latest stable builds, tracking the project's [master branch](https://github.com/google/draco).
***glTF:** Builds targeted by the [glTF mesh compression extension](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression), tracking the [corresponding Draco branch](https://github.com/google/draco/tree/gltf_2.0_draco_extension).
Either variation may be used with `THREE.DRACOLoader`:
```js
vardracoLoader=newTHREE.DRACOLoader();
dracoLoader.setDecoderPath('path/to/decoders/');
dracoLoader.setDecoderConfig({type:'js'});// (Optional) Override detection of WASM support.
```
Further [documentation on GitHub](https://github.com/google/draco/tree/master/javascript/example#static-loading-javascript-decoder).
a.HEAPF32=newFloat32Array(k);a.HEAPF64=newFloat64Array(k)}functionS(k){for(;0<k.length;){varc=k.shift();if("function"==typeofc)c();else{varb=c.func;"number"===typeofb?void0===c.arg?a.dynCall_v(b):a.dynCall_vi(b,c.arg):b(void0===c.arg?null:c.arg)}}}functionz(k){if(a.onAbort)a.onAbort(k);k+="";ya(k);Y(k);za=!0;thrownewWebAssembly.RuntimeError("abort("+k+"). Build with -s ASSERTIONS=1 for more info.");}functionva(a){returnString.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):
0===a.indexOf("data:application/octet-stream;base64,")}functionwa(){try{if(da)returnnewUint8Array(da);if(la)returnla(U);throw"both async and sync fetching of the wasm failed";}catch(k){z(k)}}functionMa(){returnda||!ea&&!Z||"function"!==typeoffetch?newPromise(function(a,c){a(wa())}):fetch(U,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+U+"'";returna.arrayBuffer()}).catch(function(){returnwa()})}functionba(){if(!ba.strings){vara={USER:"web_user",
e&63}}c[b]=0}a=n.alloc(c,T);n.copy(c,T,a)}returna}functionx(){throw"cannot construct a Status, no constructor in IDL";}functionA(){this.ptr=Oa();u(A)[this.ptr]=this}functionB(){this.ptr=Pa();u(B)[this.ptr]=this}functionC(){this.ptr=Qa();u(C)[this.ptr]=this}functionD(){this.ptr=Ra();u(D)[this.ptr]=this}functionE(){this.ptr=Sa();u(E)[this.ptr]=this}functionq(){this.ptr=Ta();u(q)[this.ptr]=this}functionJ(){this.ptr=Ua();u(J)[this.ptr]=this}functionw(){this.ptr=Va();u(w)[this.ptr]=this}functionF(){this.ptr=
Wa();u(F)[this.ptr]=this}functionr(){this.ptr=Xa();u(r)[this.ptr]=this}functionG(){this.ptr=Ya();u(G)[this.ptr]=this}functionH(){this.ptr=Za();u(H)[this.ptr]=this}functionO(){this.ptr=$a();u(O)[this.ptr]=this}functionK(){this.ptr=ab();u(K)[this.ptr]=this}functiong(){this.ptr=bb();u(g)[this.ptr]=this}functiony(){this.ptr=cb();u(y)[this.ptr]=this}functionQ(){throw"cannot construct a VoidPtr, no constructor in IDL";}functionI(){this.ptr=db();u(I)[this.ptr]=this}functionL(){this.ptr=eb();u(L)[this.ptr]=
Y=a.printErr||console.warn.bind(console);for(Winha)ha.hasOwnProperty(W)&&(a[W]=ha[W]);ha=null;a.thisProgram&&(na=a.thisProgram);varda;a.wasmBinary&&(da=a.wasmBinary);"object"!==typeofWebAssembly&&Y("no native wasm support detected");varia,gb=newWebAssembly.Table({initial:381,maximum:381,element:"anyfunc"}),za=!1,xa="undefined"!==typeofTextDecoder?newTextDecoder("utf8"):void0;"undefined"!==typeofTextDecoder&&newTextDecoder("utf-16le");varT,ca,P,Ja=a.TOTAL_MEMORY||16777216;if(ia=a.wasmMemory?
functionb(a){returnMa().then(function(a){returnWebAssembly.instantiate(a,d)}).then(a,function(a){Y("failed to asynchronously prepare wasm: "+a);z(a)})}vard={env:Ka,wasi_unstable:Ka};aa++;a.monitorRunDependencies&&a.monitorRunDependencies(aa);if(a.instantiateWasm)try{returna.instantiateWasm(d,e)}catch(Na){returnY("Module.instantiateWasm callback failed with error: "+Na),!1}(function(){if(da||"function"!==typeofWebAssembly.instantiateStreaming||va(U)||"function"!==typeoffetch)returnb(c);fetch(U,
{credentials:"same-origin"}).then(function(a){returnWebAssembly.instantiateStreaming(a,d).then(c,function(a){Y("wasm streaming compile failed: "+a);Y("falling back to ArrayBuffer instantiation");b(c)})})})();return{}}();a.asm=La;varhb=a.___wasm_call_ctors=function(){returna.asm.__wasm_call_ctors.apply(null,arguments)},jb=a._emscripten_bind_Status_code_0=function(){returna.asm.emscripten_bind_Status_code_0.apply(null,arguments)},kb=a._emscripten_bind_Status_ok_0=function(){returna.asm.emscripten_bind_Status_ok_0.apply(null,
else{varc=a.onRuntimeInitialized;a.onRuntimeInitialized=function(){c&&c();e(a)}}returna};ja=functionc(){fa||ma();fa||(ja=c)};a.run=ma;if(a.preInit)for("function"==typeofa.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();ma();p.prototype=Object.create(p.prototype);p.prototype.constructor=p;p.prototype.__class__=p;p.__cache__={};a.WrapperObject=p;a.getCache=u;a.wrapPointer=N;a.castObject=function(a,b){returnN(a.ptr,b)};a.NULL=N(0);a.destroy=function(a){if(!a.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";
a.HEAPF32=newFloat32Array(k);a.HEAPF64=newFloat64Array(k)}functionS(k){for(;0<k.length;){varc=k.shift();if("function"==typeofc)c();else{varb=c.func;"number"===typeofb?void0===c.arg?a.dynCall_v(b):a.dynCall_vi(b,c.arg):b(void0===c.arg?null:c.arg)}}}functionz(k){if(a.onAbort)a.onAbort(k);k+="";ya(k);Y(k);za=!0;thrownewWebAssembly.RuntimeError("abort("+k+"). Build with -s ASSERTIONS=1 for more info.");}functionva(a){returnString.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):
0===a.indexOf("data:application/octet-stream;base64,")}functionwa(){try{if(da)returnnewUint8Array(da);if(la)returnla(U);throw"both async and sync fetching of the wasm failed";}catch(k){z(k)}}functionMa(){returnda||!ea&&!Z||"function"!==typeoffetch?newPromise(function(a,c){a(wa())}):fetch(U,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+U+"'";returna.arrayBuffer()}).catch(function(){returnwa()})}functionba(){if(!ba.strings){vara={USER:"web_user",
e&63}}c[b]=0}a=n.alloc(c,T);n.copy(c,T,a)}returna}functionx(){throw"cannot construct a Status, no constructor in IDL";}functionA(){this.ptr=Oa();u(A)[this.ptr]=this}functionB(){this.ptr=Pa();u(B)[this.ptr]=this}functionC(){this.ptr=Qa();u(C)[this.ptr]=this}functionD(){this.ptr=Ra();u(D)[this.ptr]=this}functionE(){this.ptr=Sa();u(E)[this.ptr]=this}functionq(){this.ptr=Ta();u(q)[this.ptr]=this}functionJ(){this.ptr=Ua();u(J)[this.ptr]=this}functionw(){this.ptr=Va();u(w)[this.ptr]=this}functionF(){this.ptr=
Wa();u(F)[this.ptr]=this}functionr(){this.ptr=Xa();u(r)[this.ptr]=this}functionG(){this.ptr=Ya();u(G)[this.ptr]=this}functionH(){this.ptr=Za();u(H)[this.ptr]=this}functionO(){this.ptr=$a();u(O)[this.ptr]=this}functionK(){this.ptr=ab();u(K)[this.ptr]=this}functiong(){this.ptr=bb();u(g)[this.ptr]=this}functiony(){this.ptr=cb();u(y)[this.ptr]=this}functionQ(){throw"cannot construct a VoidPtr, no constructor in IDL";}functionI(){this.ptr=db();u(I)[this.ptr]=this}functionL(){this.ptr=eb();u(L)[this.ptr]=
Y=a.printErr||console.warn.bind(console);for(Winha)ha.hasOwnProperty(W)&&(a[W]=ha[W]);ha=null;a.thisProgram&&(na=a.thisProgram);varda;a.wasmBinary&&(da=a.wasmBinary);"object"!==typeofWebAssembly&&Y("no native wasm support detected");varia,gb=newWebAssembly.Table({initial:293,maximum:293,element:"anyfunc"}),za=!1,xa="undefined"!==typeofTextDecoder?newTextDecoder("utf8"):void0;"undefined"!==typeofTextDecoder&&newTextDecoder("utf-16le");varT,ca,P,Ja=a.TOTAL_MEMORY||16777216;if(ia=a.wasmMemory?
functionb(a){returnMa().then(function(a){returnWebAssembly.instantiate(a,d)}).then(a,function(a){Y("failed to asynchronously prepare wasm: "+a);z(a)})}vard={env:Ka,wasi_unstable:Ka};aa++;a.monitorRunDependencies&&a.monitorRunDependencies(aa);if(a.instantiateWasm)try{returna.instantiateWasm(d,e)}catch(Na){returnY("Module.instantiateWasm callback failed with error: "+Na),!1}(function(){if(da||"function"!==typeofWebAssembly.instantiateStreaming||va(U)||"function"!==typeoffetch)returnb(c);fetch(U,
{credentials:"same-origin"}).then(function(a){returnWebAssembly.instantiateStreaming(a,d).then(c,function(a){Y("wasm streaming compile failed: "+a);Y("falling back to ArrayBuffer instantiation");b(c)})})})();return{}}();a.asm=La;varhb=a.___wasm_call_ctors=function(){returna.asm.__wasm_call_ctors.apply(null,arguments)},jb=a._emscripten_bind_Status_code_0=function(){returna.asm.emscripten_bind_Status_code_0.apply(null,arguments)},kb=a._emscripten_bind_Status_ok_0=function(){returna.asm.emscripten_bind_Status_ok_0.apply(null,
else{varc=a.onRuntimeInitialized;a.onRuntimeInitialized=function(){c&&c();e(a)}}returna};ja=functionc(){fa||ma();fa||(ja=c)};a.run=ma;if(a.preInit)for("function"==typeofa.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();ma();p.prototype=Object.create(p.prototype);p.prototype.constructor=p;p.prototype.__class__=p;p.__cache__={};a.WrapperObject=p;a.getCache=u;a.wrapPointer=N;a.castObject=function(a,b){returnN(a.ptr,b)};a.NULL=N(0);a.destroy=function(a){if(!a.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";