text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-serializers",["babylonjs"],t):"object"==typeof exports?exports["babylonjs-serializers"]=t(require("babylonjs")):e.SERIALIZERS=t(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(function(e){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=15)}({0:function(t,r){t.exports=e},12:function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},15:function(e,t,r){"use strict";r.r(t),function(e){var o=r(6);r.d(t,"OBJExport",(function(){return o.OBJExport}));var n=void 0!==e?e:"undefined"!=typeof window?window:void 0;if(void 0!==n)for(var i in o)n.BABYLON[i]=o[i]}.call(this,r(12))},6:function(e,t,r){"use strict";r.r(t),r.d(t,"OBJExport",(function(){return n}));var o=r(0),n=function(){function e(){}return e.OBJ=function(e,t,r,n){var i=[],u=1,s=1;t&&(r||(r="mat"),i.push("mtllib "+r+".mtl"));for(var a=0;a<e.length;a++){i.push("g object"+a),i.push("o object_"+a);var l=null;if(n){var f=e[a].computeWorldMatrix(!0);l=new o.Matrix,f.invertToRef(l),e[a].bakeTransformIntoVertices(f)}if(t){var p=e[a].material;p&&i.push("usemtl "+p.id)}var c=e[a].geometry;if(c){var d=c.getVerticesData("position"),m=c.getVerticesData("normal"),b=c.getVerticesData("uv"),h=c.getIndices(),x=0,v=0;if(d&&h){for(var g=0;g<d.length;g+=3)e[0].getScene().useRightHandedSystem?i.push("v "+d[g]+" "+d[g+1]+" "+d[g+2]):i.push("v "+d[g]+" "+d[g+1]+" "+-d[g+2]),x++;if(null!=m)for(g=0;g<m.length;g+=3)i.push("vn "+m[g]+" "+m[g+1]+" "+m[g+2]);if(null!=b)for(g=0;g<b.length;g+=2)i.push("vt "+b[g]+" "+b[g+1]),v++;for(g=0;g<h.length;g+=3){var y=[String(h[g+2]+u),String(h[g+1]+u),String(h[g]+u)],T=[String(h[g+2]+s),String(h[g+1]+s),String(h[g]+s)],j=["","",""],F=y,S=null!=b?T:j,w=null!=m?y:j;i.push("f "+F[0]+"/"+S[0]+"/"+w[0]+" "+F[1]+"/"+S[1]+"/"+w[1]+" "+F[2]+"/"+S[2]+"/"+w[2])}n&&l&&e[a].bakeTransformIntoVertices(l),u+=x,s+=v}else o.Tools.Warn("There are no position vertices or indices on the mesh!")}else o.Tools.Warn("No geometry is present on the mesh")}return i.join("\n")},e.MTL=function(e){var t=[],r=e.material;t.push("newmtl mat1"),t.push("  Ns "+r.specularPower.toFixed(4)),t.push("  Ni 1.5000"),t.push("  d "+r.alpha.toFixed(4)),t.push("  Tr 0.0000"),t.push("  Tf 1.0000 1.0000 1.0000"),t.push("  illum 2"),t.push("  Ka "+r.ambientColor.r.toFixed(4)+" "+r.ambientColor.g.toFixed(4)+" "+r.ambientColor.b.toFixed(4)),t.push("  Kd "+r.diffuseColor.r.toFixed(4)+" "+r.diffuseColor.g.toFixed(4)+" "+r.diffuseColor.b.toFixed(4)),t.push("  Ks "+r.specularColor.r.toFixed(4)+" "+r.specularColor.g.toFixed(4)+" "+r.specularColor.b.toFixed(4)),t.push("  Ke "+r.emissiveColor.r.toFixed(4)+" "+r.emissiveColor.g.toFixed(4)+" "+r.emissiveColor.b.toFixed(4));return r.ambientTexture&&t.push("  map_Ka "+r.ambientTexture.name),r.diffuseTexture&&t.push("  map_Kd "+r.diffuseTexture.name),r.specularTexture&&t.push("  map_Ks "+r.specularTexture.name),r.bumpTexture&&t.push("  map_bump -imfchan z "+r.bumpTexture.name),r.opacityTexture&&t.push("  map_d "+r.opacityTexture.name),t.join("\n")},e}()}})}));