Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
ccameron-chromium committed Jul 24, 2024
1 parent 87ce612 commit 0469cbc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
Binary file removed Webkit-logo-P3.png
Binary file not shown.
25 changes: 11 additions & 14 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
}
gl.drawingBufferToneMapping({ mode:toneMappingMode });


gl.useProgram(gl_program);

let vertices = gl.createBuffer();
Expand Down Expand Up @@ -48,19 +47,17 @@
}

// Update the pixel value displays.
PixelValue.innerHTML = Number(PixelValueSlider.value).toFixed(2);
{
let parametricEval = function(x, a, b, c, d, e, f, g) {
const absX = Math.abs(x);
const sgnX = Math.sign(x);
return sgnX * (absX <= d) ? c*absX + f : Math.pow(a*absX + b, g) + e;
}
let srgbToLinear = function(x) {
return parametricEval(
x, 1/1.055, 0.055/1.055, 1/12.92, 0.04045, 0, 0, 2.4);
}
PixelValueLinear.innerHTML = srgbToLinear(PixelValueSlider.value).toFixed(2);
let parametricEval = function(x, a, b, c, d, e, f, g) {
const absX = Math.abs(x);
const sgnX = Math.sign(x);
return sgnX * (absX <= d) ? c*absX + f : Math.pow(a*absX + b, g) + e;
}
let srgbToLinear = function(x) {
return parametricEval(
x, 1/1.055, 0.055/1.055, 1/12.92, 0.04045, 0, 0, 2.4);
}
PixelValue.innerHTML = Number(PixelValueSlider.value).toFixed(2);
PixelValueLinear.innerHTML = srgbToLinear(PixelValueSlider.value).toFixed(2);

drawGLCanvas();
}
Expand Down Expand Up @@ -138,7 +135,6 @@ <h1>Rendering settings</h1>
<tt id="PixelValue"></tt> (sRGB-encoded), <tt id="PixelValueLinear">?</tt> (linear-encoded)
</p>


<p>
Tone map mode:
<input type="radio" name="ToneMapMode" id="ToneMapModeStandard" onchange="update();" checked="true">
Expand All @@ -150,4 +146,5 @@ <h1>Rendering settings</h1>
<h1>Canvas</h1>
<canvas id="GLCanvas" style="width:32px; height:32px; border:1px solid black;"></canvas>

</body>
</html>

0 comments on commit 0469cbc

Please sign in to comment.