Fix 2D normals for transposed texture

This commit is contained in:
kleonc 2024-01-15 17:32:26 +01:00
parent 26b1fd0d84
commit 0fe7eead02
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;
}