From e8c75e759928fee4dfed355504622c70c5e18d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Garc=C3=ADa=20Li=C3=B1=C3=A1n?= Date: Fri, 19 Jan 2024 17:51:20 +0100 Subject: [PATCH] HDR: Fix texture animations --- Shaders/HDR/model_combined.vert | 3 ++- Shaders/HDR/model_default.vert | 3 ++- Shaders/HDR/model_pbr.vert | 3 ++- Shaders/HDR/model_pbr_transparent.vert | 3 ++- Shaders/HDR/model_transparent.vert | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Shaders/HDR/model_combined.vert b/Shaders/HDR/model_combined.vert index 4a0b538db..4e7979198 100644 --- a/Shaders/HDR/model_combined.vert +++ b/Shaders/HDR/model_combined.vert @@ -15,11 +15,12 @@ uniform int normalmap_enabled; uniform mat4 osg_ModelViewMatrix; uniform mat4 osg_ModelViewProjectionMatrix; uniform mat3 osg_NormalMatrix; +uniform mat4 fg_TextureMatrix; void main() { gl_Position = osg_ModelViewProjectionMatrix * pos; - vs_out.texcoord = multitexcoord0.st; + vs_out.texcoord = vec2(fg_TextureMatrix * multitexcoord0); vs_out.vertex_normal = osg_NormalMatrix * normal; vs_out.view_vector = (osg_ModelViewMatrix * pos).xyz; } diff --git a/Shaders/HDR/model_default.vert b/Shaders/HDR/model_default.vert index 367d8fef8..ca43babdc 100644 --- a/Shaders/HDR/model_default.vert +++ b/Shaders/HDR/model_default.vert @@ -20,11 +20,12 @@ uniform vec4 material_diffuse; uniform mat4 osg_ModelViewProjectionMatrix; uniform mat3 osg_NormalMatrix; +uniform mat4 fg_TextureMatrix; void main() { gl_Position = osg_ModelViewProjectionMatrix * pos; - vs_out.texcoord = multitexcoord0.st; + vs_out.texcoord = vec2(fg_TextureMatrix * multitexcoord0); vs_out.vertex_normal = osg_NormalMatrix * normal; // Legacy material handling diff --git a/Shaders/HDR/model_pbr.vert b/Shaders/HDR/model_pbr.vert index 900ca6592..cd9c15007 100644 --- a/Shaders/HDR/model_pbr.vert +++ b/Shaders/HDR/model_pbr.vert @@ -15,11 +15,12 @@ uniform bool flip_vertically; uniform mat4 osg_ModelViewMatrix; uniform mat4 osg_ModelViewProjectionMatrix; uniform mat3 osg_NormalMatrix; +uniform mat4 fg_TextureMatrix; void main() { gl_Position = osg_ModelViewProjectionMatrix * pos; - vs_out.texcoord = multitexcoord0.st; + vs_out.texcoord = vec2(fg_TextureMatrix * multitexcoord0); if (flip_vertically) vs_out.texcoord.y = 1.0 - vs_out.texcoord.y; diff --git a/Shaders/HDR/model_pbr_transparent.vert b/Shaders/HDR/model_pbr_transparent.vert index a92fc04a6..6d9546be1 100644 --- a/Shaders/HDR/model_pbr_transparent.vert +++ b/Shaders/HDR/model_pbr_transparent.vert @@ -16,6 +16,7 @@ uniform bool flip_vertically; uniform mat4 osg_ModelViewMatrix; uniform mat4 osg_ModelViewProjectionMatrix; uniform mat3 osg_NormalMatrix; +uniform mat4 fg_TextureMatrix; // aerial_perspective.glsl vec4 get_aerial_perspective(vec2 coord, float depth); @@ -23,7 +24,7 @@ vec4 get_aerial_perspective(vec2 coord, float depth); void main() { gl_Position = osg_ModelViewProjectionMatrix * pos; - vs_out.texcoord = multitexcoord0.st; + vs_out.texcoord = vec2(fg_TextureMatrix * multitexcoord0); if (flip_vertically) vs_out.texcoord.y = 1.0 - vs_out.texcoord.y; diff --git a/Shaders/HDR/model_transparent.vert b/Shaders/HDR/model_transparent.vert index 081919b70..dec5e6032 100644 --- a/Shaders/HDR/model_transparent.vert +++ b/Shaders/HDR/model_transparent.vert @@ -21,6 +21,7 @@ uniform vec4 material_diffuse; uniform mat4 osg_ModelViewMatrix; uniform mat4 osg_ModelViewProjectionMatrix; uniform mat3 osg_NormalMatrix; +uniform mat4 fg_TextureMatrix; // aerial_perspective.glsl vec4 get_aerial_perspective(vec2 coord, float depth); @@ -30,7 +31,7 @@ void main() gl_Position = osg_ModelViewProjectionMatrix * pos; vN = osg_NormalMatrix * normal; vP = (osg_ModelViewMatrix * pos).xyz; - texcoord = multitexcoord0.st; + texcoord = vec2(fg_TextureMatrix * multitexcoord0); // Legacy material handling if (color_mode == MODE_DIFFUSE)