Restructured shaderlib by moving functions and renaming files

This commit is contained in:
ChaoticByte 2025-01-24 22:16:45 +01:00
parent c70eaed0c4
commit 40374bd849
No known key found for this signature in database
10 changed files with 53 additions and 49 deletions

View file

@ -3,3 +3,13 @@
float cbrt(float x) {
return pow(x, 1.0/3.0);
}
/*
Alpha Blending a over b after Bruce A. Wallace
source: https://en.wikipedia.org/wiki/Alpha_compositing
*/
vec4 alpha_blend(vec4 b, vec4 a) {
float alpha = a.a + (b.a * (1.0 - a.a));
vec3 col = ((a.rgb*a.a) + ((b.rgb*b.a) * (1.0 - a.a)) / alpha);
return vec4(col.r, col.g, col.b, alpha);
}