summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2017-05-28 01:24:06 -0700
committerGravatar GitHub2017-05-28 01:24:06 -0700
commit3df85a103a39c4d304da8734a862315a3e619a90 (patch)
tree36d8cb23c8d54cef77dc09c10d7dd97e81669341
parentMerge pull request #2733 from yuriks/cmake-cleanup (diff)
parentOpenGL: Improve accuracy of quaternion interpolation (diff)
downloadyuzu-3df85a103a39c4d304da8734a862315a3e619a90.tar.gz
yuzu-3df85a103a39c4d304da8734a862315a3e619a90.tar.xz
yuzu-3df85a103a39c4d304da8734a862315a3e619a90.zip
Merge pull request #2729 from yuriks/quaternion-fix
OpenGL: Improve accuracy of quaternion interpolation
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp
index d4a99f79f..ffe419863 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp
@@ -535,8 +535,8 @@ static void WriteLighting(std::string& out, const PicaShaderConfig& config) {
535 } 535 }
536 536
537 // Rotate the surface-local normal by the interpolated normal quaternion to convert it to 537 // Rotate the surface-local normal by the interpolated normal quaternion to convert it to
538 // eyespace 538 // eyespace.
539 out += "vec3 normal = normalize(quaternion_rotate(normquat, surface_normal));\n"; 539 out += "vec3 normal = quaternion_rotate(normalize(normquat), surface_normal);\n";
540 540
541 // Gets the index into the specified lookup table for specular lighting 541 // Gets the index into the specified lookup table for specular lighting
542 auto GetLutIndex = [&lighting](unsigned light_num, LightingRegs::LightingLutInput input, 542 auto GetLutIndex = [&lighting](unsigned light_num, LightingRegs::LightingLutInput input,
@@ -1002,7 +1002,9 @@ uniform sampler1D proctex_diff_lut;
1002// Rotate the vector v by the quaternion q 1002// Rotate the vector v by the quaternion q
1003vec3 quaternion_rotate(vec4 q, vec3 v) { 1003vec3 quaternion_rotate(vec4 q, vec3 v) {
1004 return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); 1004 return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v);
1005})"; 1005}
1006
1007)";
1006 1008
1007 if (config.state.proctex.enable) 1009 if (config.state.proctex.enable)
1008 AppendProcTexSampler(out, config); 1010 AppendProcTexSampler(out, config);