opengl.texturing: Update shader 'frag.snippet' to allow models with multiple textures to selectively apply/unapply individual textures.
This commit is contained in:
@@ -1,13 +1,18 @@
|
|||||||
uniform int texture_Count;
|
uniform int texture_Count;
|
||||||
uniform sampler2D Textures [16];
|
uniform sampler2D Textures [16];
|
||||||
uniform float Fade [16];
|
uniform float Fade [16];
|
||||||
|
uniform bool texture_Applies [16];
|
||||||
|
|
||||||
|
|
||||||
vec4
|
vec4
|
||||||
apply_Texturing (vec2 Coords)
|
apply_Texturing (vec2 Coords)
|
||||||
{
|
{
|
||||||
vec4 Color = vec4 (0);
|
vec4 Color = vec4 (0);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < texture_Count; ++i)
|
for (int i = 0; i < texture_Count; ++i)
|
||||||
|
{
|
||||||
|
if (texture_Applies [i])
|
||||||
{
|
{
|
||||||
Color.rgb += texture (Textures [i], Coords).rgb
|
Color.rgb += texture (Textures [i], Coords).rgb
|
||||||
* texture (Textures [i], Coords).a
|
* texture (Textures [i], Coords).a
|
||||||
@@ -21,6 +26,8 @@ apply_Texturing (vec2 Coords)
|
|||||||
// Color.a = max (Color.a,
|
// Color.a = max (Color.a,
|
||||||
// texture (Textures [i],Coords).a);
|
// texture (Textures [i],Coords).a);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return Color;
|
return Color;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user