Added texture flags to shader

This commit is contained in:
Emile Belanger 2021-03-07 18:27:18 +00:00
parent 2adc7fa247
commit fa140c18cc
2 changed files with 21 additions and 1 deletions

View file

@ -673,6 +673,7 @@ bool FShader::Bind(int textureMode, int texFlags, int blendFlags, bool twoDFog,
{
FString variantConfig = "\n";
variantConfig.AppendFormat("#define DEF_TEXTURE_MODE %d\n", textureMode);
variantConfig.AppendFormat("#define DEF_TEXTURE_FLAGS %d\n", texFlags);
variantConfig.AppendFormat("#define DEF_BLEND_FLAGS %d\n", blendFlags);
variantConfig.AppendFormat("#define DEF_FOG_2D %d\n", twoDFog);
variantConfig.AppendFormat("#define DEF_FOG_ENABLED %d\n", fogEnabled);

View file

@ -269,7 +269,26 @@ float spotLightAttenuation(vec4 lightpos, vec3 spotdir, float lightCosInnerAngle
void SetMaterialProps(inout Material material, vec2 texCoord)
{
material.Base = getTexel(texCoord.st);
material.Base = getTexel(texCoord.st);
#if (DEF_TEXTURE_FLAGS & 0x1)
material.Bright = texture(brighttexture, texCoord.st);
#endif
#if (DEF_TEXTURE_FLAGS & 0x2)
{
vec4 Detail = texture(detailtexture, texCoord.st * uDetailParms.xy) * uDetailParms.z;
material.Base *= Detail;
}
#endif
#if (DEF_TEXTURE_FLAGS & 0x4)
{
material.Glow = texture(glowtexture, texCoord.st);
}
#endif
}
//===========================================================================