diff --git a/VoxelSpace.html b/VoxelSpace.html index d3a8951..a18e779 100755 --- a/VoxelSpace.html +++ b/VoxelSpace.html @@ -80,6 +80,9 @@ + + + Github project page @@ -371,7 +374,37 @@ } // --------------------------------------------- -// The main render routine +// Interpolate between two RGB colors. + +function ColorInterp(a, b, t) +{ + var a0 = (a >> 16) & 0xFF; + var a1 = (a >> 8) & 0xFF; + var a2 = a & 0xFF; + + var b0 = (b >> 16) & 0xFF; + var b1 = (b >> 8) & 0xFF; + var b2 = b & 0xFF; + + var invt = 1.0 - t; + return 0xFF000000 | + Math.floor(a0*invt + b0*t) << 16 | + Math.floor(a1*invt + b1*t) << 8 | + Math.floor(a2*invt + b2*t); +} + +// --------------------------------------------- +// Interpolate between two numbers. +// The output is a float. + +function NumberInterp(a, b, t) +{ + var invt = 1.0 - t; + return (a * invt) + (b * t); +} + +// --------------------------------------------- +// The mbin render routine function Render() { @@ -388,6 +421,8 @@ var deltaz = 1.; + var bilinear = document.getElementById('bilinear').checked; + // Draw from front to back for(var z=1; z