!function(e){var t=function(){function t(){this.materials=[],this.parseMTL=function(t,s,r){for(var a,n,i=s.split("\n"),o=/\s+/,l=0;l=0?u.substring(0,p):u;h=h.toLowerCase();var f=p>=0?u.substring(p+1):"";f=f.trim(),"newmtl"===h?(n&&this.materials.push(n),n=new e.StandardMaterial(f,t)):"kd"===h?(a=f.split(o,3),n.diffuseColor=e.Color3.FromArray(a)):"ka"===h?(a=f.split(o,3),n.ambientColor=e.Color3.FromArray(a)):"ks"===h?(a=f.split(o,3),n.specularColor=e.Color3.FromArray(a)):"ns"===h?n.specularPower=f:"d"===h?n.alpha=f:"map_ka"===h?n.ambientTexture=new e.Texture(r+f,t):"map_kd"===h?n.diffuseTexture=new e.Texture(r+f,t):"map_ks"===h?n.specularTexture=new e.Texture(r+f,t):"map_ns"===h||("map_bump"===h?n.bumpTexture=new e.Texture(r+f,t):"map_d"===h&&(n.opacityTexture=new e.Texture(r+f,t)))}}this.materials.push(n)}}return t}();e.MTLFileLoader=t;var s=function(){function s(){this.extensions=".obj",this.obj=/^o/,this.group=/^g/,this.mtllib=/^mtllib /,this.usemtl=/^usemtl /,this.smooth=/^s /,this.vertexPattern=/v( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/,this.normalPattern=/vn( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/,this.uvPattern=/vt( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/,this.facePattern1=/f\s(([\d]{1,}[\s]?){3,})+/,this.facePattern2=/f\s((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,this.facePattern3=/f\s((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,this.facePattern4=/f\s((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/}return s.prototype._loadMTL=function(t,s,r){var a=new XMLHttpRequest,n=e.Tools.BaseUrl+s+t;a.open("GET",n,!1),a.onreadystatechange=function(){4===a.readyState&&(200===a.status||e.Tools.ValidateXHRData(a,1)?r(a.responseText):console.warn("Error status: "+a.status+" - Unable to load "+n))},a.send(null)},s.prototype.importMesh=function(e,t,s,r,a){var n=this._parseSolid(e,t,s,r);return a&&n.forEach(function(e){a.push(e)}),!0},s.prototype.load=function(e,t,s){return this.importMesh(null,e,t,s,null,null,null)},s.prototype._parseSolid=function(s,r,a,n){for(var i,o=[],l=[],u=[],p=[],h=[],f=[],c=[],m=[],v=[],d=!1,x=[],g=[],w=[],T=[],y="",b="",P=new t,F=function(e,t){for(var s=-1,r=0;r0&&(i=p[p.length-1],E(),h.reverse(),i.indices=h.slice(),i.positions=x.slice(),i.normals=g.slice(),i.uvs=w.slice(),h=[],x=[],g=[],w=[]),p.push(U),d=!0}else if(this.usemtl.test(B)){if(y=B.substring(7).trim(),d){var z=p.length;p[z-1].materialName=y}}else this.mtllib.test(B)?b=B.substring(7).trim():this.smooth.test(B)||console.log("Unhandled expression at line : "+B)}if(d&&(i=p[p.length-1],h.reverse(),E(),i.indices=h,i.positions=x,i.normals=g,i.uvs=w),!d){var D=e.Geometry.RandomId();h.reverse(),E(),p.push({name:D,indices:h,positions:x,normals:g,uvs:w,materialName:y})}for(var G=new e.VertexData,H=[],X=[],Y=0;Y