Merge pull request #87225 from kleonc/transposed-texture-fix-2d-normals
Fix 2D normals for transposed texture
This commit is contained in:
commit
bf94131e41
2 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue