PageSourceSearch

https://balloon99-kj7qgchv.manus.space/assets/hdrTextureLoader-BGQvgh0h.js

js balloon99-kj7qgchv.manus.space collected 2026-10-03 05:00:25 UTC 2,391 bytes, 2 lines download raw bytes

1function D(t,e){return e>1023?t*Math.pow(2,1023)*Math.pow(2,e-1023):e<-1074?t*Math.pow(2,-1074)*Math.pow(2,e+1074):t*Math.pow(2,e)}function B(t,e,s,r,i,n){i>0?(i=D(1,i-136),t[n+0]=e*i,t[n+1]=s*i,t[n+2]=r*i):(t[n+0]=0,t[n+1]=0,t[n+2]=0)}function g(t,e){let s="",r;for(let i=e;i<t.length-e&&(r=String.fromCharCode(t[i]),r!=`
2`);i++)s+=r;return s}function b(t){let e=g(t,0);if(e[0]!="#"||e[1]!="?")throw"Bad HDR Format.";let s=!1,r=!1,i=0;do i+=e.length+1,e=g(t,i),e=="FORMAT=32-bit_rle_rgbe"?r=!0:e.length==0&&(s=!0);while(!s);if(!r)throw"HDR Bad header format, unsupported FORMAT";i+=e.length+1,e=g(t,i);const o=/^-Y (.*) \+X (.*)$/g.exec(e);if(!o||o.length<3)throw"HDR Bad header format, no size";const h=parseInt(o[2]),l=parseInt(o[1]);if(h<8||h>32767)throw"HDR Bad header format, unsupported size";return i+=e.length+1,{height:l,width:h,dataPosition:i}}function m(t,e){return H(t,e)}function H(t,e){let s=e.height;const r=e.width;let i,n,o,h,l,a=e.dataPosition,f,d,c;const p=new ArrayBuffer(r*4),w=new Uint8Array(p),A=new ArrayBuffer(e.width*e.height*4*3),u=new Float32Array(A);for(;s>0;){if(i=t[a++],n=t[a++],o=t[a++],h=t[a++],i!=2||n!=2||o&128||e.width<8||e.width>32767)return F(t,e);if((o<<8|h)!=r)throw"HDR Bad header format, wrong scan line width";for(f=0,c=0;c<4;c++)for(d=(c+1)*r;f<d;)if(i=t[a++],n=t[a++],i>128){if(l=i-128,l==0||l>d-f)throw"HDR Bad Format, bad scanline data (run)";for(;l-- >0;)w[f++]=n}else{if(l=i,l==0||l>d-f)throw"HDR Bad Format, bad scanline data (non-run)";if(w[f++]=n,--l>0)for(let R=0;R<l;R++)w[f++]=t[a++]}for(c=0;c<r;c++)i=w[c],n=w[c+r],o=w[c+2*r],h=w[c+3*r],B(u,i,n,o,h,(e.height-s)*r*3+c*3);s--}return u}function F(t,e){let s=e.height;const r=e.width;let i,n,o,h,l,a=e.dataPosition;const f=new ArrayBuffer(e.width*e.height*4*3),d=new Float32Array(f);for(;s>0;){for(l=0;l<e.width;l++)i=t[a++],n=t[a++],o=t[a++],h=t[a++],B(d,i,n,o,h,(e.height-s)*r*3+l*3);s--}return d}class M{constructor(){this.supportCascades=!1}loadCubeData(){throw".hdr not supported in Cube."}loadData(e,s,r){const i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=b(i),o=m(i,n),h=n.width*n.height,l=new Float32Array(h*4);for(let a=0;a<h;a+=1)l[a*4]=o[a*3],l[a*4+1]=o[a*3+1],l[a*4+2]=o[a*3+2],l[a*4+3]=1;r(n.width,n.height,s.generateMipMaps,!1,()=>{const a=s.getEngine();s.type=1,s.format=5,s._gammaSpace=!1,a._uploadDataToTextureDirectly(s,l)})}}export{M as _HDRTextureLoader};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.