opengl.shaders: Use unified lighting and texturing 'snippets' for fragment shaders.

This commit is contained in:
Rod Kay
2024-02-23 22:35:12 +11:00
parent d1f702aab5
commit 68c1ff4764
17 changed files with 439 additions and 568 deletions

View File

@@ -0,0 +1,27 @@
uniform int texture_Count;
uniform sampler2D Textures [32];
uniform float Fade [32];
vec4
apply_Texturing (vec2 Coords)
{
vec4 Color = vec4 (0);
for (int i = 0; i < texture_Count; ++i)
{
Color.rgb += texture (Textures [i], Coords).rgb
* texture (Textures [i], Coords).a
* (1.0 - Fade [i]);
// Color.a += texture (Textures [i], Coords).a * (1.0 - Fade[1]);
Color.a = max (Color.a,
texture (Textures [i],Coords).a * (1.0 - Fade[i]));
// Color.a = max (Color.a,
// texture (Textures [i],Coords).a);
}
return Color;
}