Skip to content

Instantly share code, notes, and snippets.

View spenceryonce's full-sized avatar
☢️
Radioactive

spenceryonce

☢️
Radioactive
View GitHub Profile
@spenceryonce
spenceryonce / cwebp2png.bat
Created April 29, 2024 07:08
WEBP to PNG/PPM Batch Script (dwebp)
@echo off
setlocal
REM Determine the directory from which the script is executed
set "current_dir=%cd%"
REM Check if dwebp.exe is available
if not exist "%current_dir%\dwebp.exe" (
echo dwebp.exe not found in the current directory.
exit /b
@spenceryonce
spenceryonce / reference-library.frag
Created August 8, 2023 17:24
GLSL Reference Library
//----------------------CONSTANTS------------------------------------------
#define PI 3.141592653589793238462643383
//----------------------COLORSPACE CONVERSION------------------------------
vec3 encodeSRGB(vec3 linearRGB)
{
vec3 a = 12.92 * linearRGB;
vec3 b = 1.055 * pow(linearRGB, vec3(1.0 / 2.4)) - 0.055;
@spenceryonce
spenceryonce / readme.md
Created August 6, 2023 17:44
calculateEyeRayTransformationMatrix Decoded

Eye Ray Transformation Matrix Decoded (GLSL)

Inigo Quillez has a function that calculates the eye ray transformation matrix for shaders and it looks like this:

mat3 calculateEyeRayTransformationMatrix( in vec3 ro, in vec3 ta, in float roll )
{
    vec3 ww = normalize( ta - ro );
    vec3 uu = normalize( cross(ww,vec3(sin(roll),cos(roll),0.0) ) );
    vec3 vv = normalize( cross(uu,ww));
 return mat3( uu, vv, ww );