polygonjs-engine
Version:
node-based webgl 3D engine https://polygonjs.com
2 lines • 4.84 kB
JavaScript
(window.webpackJsonpPOLY=window.webpackJsonpPOLY||[]).push([[2],{206:function(e,r,t){"use strict";t.d(r,"a",(function(){return s}));var a=t(0),i=t(42),n=t(25),o=t(19);function s(e){o.a.call(this,e)}s.prototype=Object.assign(Object.create(o.a.prototype),{constructor:s,load:function(e,r,t,o){const s=this,p=new n.a,c=new i.a(this.manager);return c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(s.withCredentials),c.load(e,(function(e){const t=s.parse(e);t&&(void 0!==t.image?p.image=t.image:void 0!==t.data&&(p.image.width=t.width,p.image.height=t.height,p.image.data=t.data),p.wrapS=void 0!==t.wrapS?t.wrapS:a.n,p.wrapT=void 0!==t.wrapT?t.wrapT:a.n,p.magFilter=void 0!==t.magFilter?t.magFilter:a.V,p.minFilter=void 0!==t.minFilter?t.minFilter:a.V,p.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(p.format=t.format),void 0!==t.type&&(p.type=t.type),void 0!==t.mipmaps&&(p.mipmaps=t.mipmaps,p.minFilter=a.Y),1===t.mipmapCount&&(p.minFilter=a.V),p.needsUpdate=!0,r&&r(p,t))}),t,o),p}})},218:function(e,r,t){"use strict";t.r(r),t.d(r,"RGBELoader",(function(){return o}));var a=t(206),i=t(107),n=t(0),o=function(e){a.a.call(this,e),this.type=n.Zc};o.prototype=Object.assign(Object.create(a.a.prototype),{constructor:o,parse:function(e){var r=function(e,r){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(r||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(r||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(r||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(r||""))}return-1},t=function(e,r,t){r=r||1024;for(var a=e.pos,i=-1,n=0,o="",s=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));0>(i=s.indexOf("\n"))&&n<r&&a<e.byteLength;)o+=s,n+=s.length,a+=128,s+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));return-1<i&&(!1!==t&&(e.pos+=n+i+1),o+s.slice(0,i))},a=function(e,r,t,a){var n=e[r+3],o=Math.pow(2,n-128)/255;t[a+0]=i.a.toHalfFloat(e[r+0]*o),t[a+1]=i.a.toHalfFloat(e[r+1]*o),t[a+2]=i.a.toHalfFloat(e[r+2]*o)},o=new Uint8Array(e);o.pos=0;var s,p,c,d,l,f,u=function(e){var a,i,n=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,p=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,c={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(a=t(e)))return r(1,"no header found");if(!(i=a.match(/^#\?(\S+)/)))return r(3,"bad initial token");for(c.valid|=1,c.programtype=i[1],c.string+=a+"\n";!1!==(a=t(e));)if(c.string+=a+"\n","#"!==a.charAt(0)){if((i=a.match(n))&&(c.gamma=parseFloat(i[1],10)),(i=a.match(o))&&(c.exposure=parseFloat(i[1],10)),(i=a.match(s))&&(c.valid|=2,c.format=i[1]),(i=a.match(p))&&(c.valid|=4,c.height=parseInt(i[1],10),c.width=parseInt(i[2],10)),2&c.valid&&4&c.valid)break}else c.comments+=a+"\n";return 2&c.valid?4&c.valid?c:r(3,"missing image size specifier"):r(3,"missing format specifier")}(o);if(-1!==u){var m=u.width,h=u.height,g=function(e,t,a){var i,n,o,s,p,c,d,l,f,u,m,h,g,y=t,w=a;if(y<8||y>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(y!==(e[2]<<8|e[3]))return r(3,"wrong scanline width");if(!(i=new Uint8Array(4*t*a)).length)return r(4,"unable to allocate buffer space");for(n=0,o=0,l=4*y,g=new Uint8Array(4),c=new Uint8Array(l);w>0&&o<e.byteLength;){if(o+4>e.byteLength)return r(1);if(g[0]=e[o++],g[1]=e[o++],g[2]=e[o++],g[3]=e[o++],2!=g[0]||2!=g[1]||(g[2]<<8|g[3])!=y)return r(3,"bad rgbe scanline format");for(d=0;d<l&&o<e.byteLength;){if((h=(s=e[o++])>128)&&(s-=128),0===s||d+s>l)return r(3,"bad scanline data");if(h)for(p=e[o++],f=0;f<s;f++)c[d++]=p;else c.set(e.subarray(o,o+s),d),d+=s,o+=s}for(u=y,f=0;f<u;f++)m=0,i[n]=c[f+m],m+=y,i[n+1]=c[f+m],m+=y,i[n+2]=c[f+m],m+=y,i[n+3]=c[f+m],n+=4;w--}return i}(o.subarray(o.pos),m,h);if(-1!==g){switch(this.type){case n.Zc:var y=g,w=n.hc,b=n.Zc;break;case n.G:for(var v=g.length/4*3,E=new Float32Array(v),F=0;F<v;F++)c=E,d=3*F,l=void 0,f=void 0,l=(s=g)[(p=4*F)+3],f=Math.pow(2,l-128)/255,c[d+0]=s[p+0]*f,c[d+1]=s[p+1]*f,c[d+2]=s[p+2]*f;y=E,w=n.ic,b=n.G;break;case n.M:v=g.length/4*3;var R=new Uint16Array(v);for(F=0;F<v;F++)a(g,4*F,R,3*F);y=R,w=n.ic,b=n.M;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:m,height:h,data:y,header:u.string,gamma:u.gamma,exposure:u.exposure,format:w,type:b}}}return null},setDataType:function(e){return this.type=e,this},load:function(e,r,t,i){return a.a.prototype.load.call(this,e,(function(e,t){switch(e.type){case n.Zc:e.encoding=n.gc,e.minFilter=n.ob,e.magFilter=n.ob,e.generateMipmaps=!1,e.flipY=!0;break;case n.G:case n.M:e.encoding=n.U,e.minFilter=n.V,e.magFilter=n.V,e.generateMipmaps=!1,e.flipY=!0}r&&r(e,t)}),t,i)}})}}]);
//# sourceMappingURL=2.js.map