hdrpng.js
/** Convert an RGBE buffer to a Float buffer.
    * @param {Uint8Array} buffer The input buffer in RGBE format. (as returned from loadHDR)
    * @param {Float32Array} [res] Optional result buffer containing 3 floats per pixel.
    * @returns {Float32Array} A floating point buffer with 96 bits per pixel (32 per channel, 3 channels).
    */
Convert an RGBE buffer to a Float buffer.
@param {Uint8Array} buffer The input buffer in RGBE format. (as returned from loadHDR)
@param {Float32Array} [res] Optional result buffer containing 3 floats per pixel.
@returns {Float32Array} A floating point buffer with 96 bits per pixel (32 per channel, 3 channels).
Convert an RGBE buffer to a Float buffer . @param { Uint8Array } buffer The input buffer in RGBE format . ( as returned from loadHDR ) @param { Float32Array } [ res ] Optional result buffer containing 3 floats per pixel . @returns { Float32Array } A floating point buffer with 96 bits per pixel ( 32 per channel 3 channels ) .
function rgbeToFloat(buffer,res) {
    var s,l=buffer.byteLength>>2, res=res||new Float32Array(l*3);
    for (var i=0;i<l;i++) {
      s = Math.pow(2,buffer[i*4+3]-(128+8));
      res[i*3]=buffer[i*4]*s;
      res[i*3+1]=buffer[i*4+1]*s;
      res[i*3+2]=buffer[i*4+2]*s;
    }
    return res;
  }
function rgbeToFloat ( buffer , res ) { var s , l = buffer . byteLength >> 2 , res = res || new Float32Array ( l * 3 ) ; for ( var i = 0 ; i < l ; i ++ ) { s = Math . pow ( 2 , buffer [ i * 4 + 3 ] - ( 128 + 8 ) ) ; res [ i * 3 ] = buffer [ i * 4 ] * s ; res [ i * 3 + 1 ] = buffer [ i * 4 + 1 ] * s ; res [ i * 3 + 2 ] = buffer [ i * 4 + 2 ] * s ; } return res ; }
Convert an RGBE buffer to a Float buffer.
Convert an RGBE buffer to a Float buffer .