35 lines
967 B
Plaintext
35 lines
967 B
Plaintext
uniform int texture_Count;
|
|
uniform sampler2D Textures [16];
|
|
uniform float Fade [16];
|
|
uniform bool texture_Applies [16];
|
|
uniform vec2 Tiling [16];
|
|
|
|
|
|
vec4
|
|
apply_Texturing (vec2 Coords)
|
|
{
|
|
vec4 Color = vec4 (0);
|
|
|
|
|
|
for (int i = 0; i < texture_Count; ++i)
|
|
{
|
|
if (texture_Applies [i])
|
|
{
|
|
vec2 tiled_Coords;
|
|
|
|
tiled_Coords.s = Coords.s * Tiling [i].s;
|
|
tiled_Coords.t = Coords.t * Tiling [i].t;
|
|
|
|
Color.rgb += texture (Textures [i], tiled_Coords).rgb
|
|
* texture (Textures [i], tiled_Coords).a
|
|
* (1.0 - Fade [i]);
|
|
|
|
Color.a = max (Color.a,
|
|
texture (Textures [i], tiled_Coords).a * (1.0 - Fade [i]));
|
|
}
|
|
}
|
|
|
|
|
|
return Color;
|
|
}
|