Merge pull request #87225 from kleonc/transposed-texture-fix-2d-normals

Fix 2D normals for transposed texture
This commit is contained in:
Yuri Sizov 2024-01-22 20:39:04 +01:00
commit bf94131e41
2 changed files with 6 additions and 0 deletions

View file

@ -587,6 +587,9 @@ void main() {
if (normal_used || (using_light && bool(read_draw_data_flags & FLAGS_DEFAULT_NORMAL_MAP_USED))) {
normal.xy = texture(normal_texture, uv).xy * vec2(2.0, -2.0) - vec2(1.0, -1.0);
if (bool(read_draw_data_flags & FLAGS_TRANSPOSE_RECT)) {
normal.xy = normal.yx;
}
if (bool(read_draw_data_flags & FLAGS_FLIP_H)) {
normal.x = -normal.x;
}

View file

@ -516,6 +516,9 @@ void main() {
if (normal_used || (using_light && bool(draw_data.flags & FLAGS_DEFAULT_NORMAL_MAP_USED))) {
normal.xy = texture(sampler2D(normal_texture, texture_sampler), uv).xy * vec2(2.0, -2.0) - vec2(1.0, -1.0);
if (bool(draw_data.flags & FLAGS_TRANSPOSE_RECT)) {
normal.xy = normal.yx;
}
if (bool(draw_data.flags & FLAGS_FLIP_H)) {
normal.x = -normal.x;
}