hdrpng.js
/** Convert an RGB9_E5 buffer to a Float buffer.
    * @param {Uint32Array} Buffer in RGB9_E5 format. (Uint32 buffer).
    * @param {Float32Array} [res] Optional float output buffer.
    * @returns {Float32Array} A Float32Array.
    */
Convert an RGB9_E5 buffer to a Float buffer.
Convert an RGB9_E5 buffer to a Float buffer .
function rgb9_e5ToFloat(buffer,res) {
    var v,s,l=buffer.byteLength>>2, res=res||new Float32Array(l*3);
    for (var i=0;i<l;i++) {
      v = buffer[i]; s = Math.pow(2,(v&31)-24);
      res[i*3]   =  (v>>>23)*s;
      res[i*3+1] = ((v>>>14)&511)*s;
      res[i*3+2] = ((v>>>5)&511)*s;
    }
    return res;
  }
function rgb9_e5ToFloat ( buffer , res ) { var v , s , l = buffer . byteLength >> 2 , res = res || new Float32Array ( l * 3 ) ; for ( var i = 0 ; i < l ; i ++ ) { v = buffer [ i ] ; s = Math . pow ( 2 , ( v & 31 ) - 24 ) ; res [ i * 3 ] = ( v >>> 23 ) * s ; res [ i * 3 + 1 ] = ( ( v >>> 14 ) & 511 ) * s ; res [ i * 3 + 2 ] = ( ( v >>> 5 ) & 511 ) * s ; } return res ; }
Convert an RGB9_E5 buffer to a Float buffer.
Convert an RGB9_E5 buffer to a Float buffer .