allow lightmap coords to be modified by SetupMaterial

This commit is contained in:
Ricardo Luís Vaz Silva 2025-01-09 16:38:18 -03:00 committed by Magnus Norddahl
commit 3ae7bf3911
2 changed files with 4 additions and 1 deletions

View file

@ -63,7 +63,7 @@ vec4 getLightColor(Material material)
//
if (vLightmap.z >= 0.0)
{
color.rgb += texture(LightMap, vLightmap).rgb;
color.rgb += texture(LightMap, vec3(material.LightmapCoord.xy, vLightmap.z)).rgb;
}
//

View file

@ -14,6 +14,7 @@ struct Material
float Metallic;
float Roughness;
float AO;
vec2 LightmapCoord;
};
vec4 Process(vec4 color);
@ -51,6 +52,8 @@ void SetMaterialProps(inout Material material, vec2 texCoord)
material.Base = getTexel(texCoord.st);
material.Normal = ApplyNormalMap(texCoord.st);
material.LightmapCoord = vLightmap.xy;
// OpenGL doesn't care, but Vulkan pukes all over the place if these texture samplings are included in no-texture shaders, even though never called.
#ifndef NO_LAYERS
#if defined(TEXF_Brightmap)