summaryrefslogtreecommitdiff
path: root/src/video_core/swrasterizer/clipper.cpp
diff options
context:
space:
mode:
authorGravatar Weiyi Wang2017-08-09 18:54:29 +0300
committerGravatar GitHub2017-08-09 18:54:29 +0300
commit792dee47a7b520cb2a8d7cf43cc184c17394708f (patch)
tree35b14f184d95834bed51d3fda5c9662355e8b7f7 /src/video_core/swrasterizer/clipper.cpp
parentMerge pull request #2856 from wwylele/shader-share (diff)
parentSwRasterizer/Lighting: shorten file name (diff)
downloadyuzu-792dee47a7b520cb2a8d7cf43cc184c17394708f.tar.gz
yuzu-792dee47a7b520cb2a8d7cf43cc184c17394708f.tar.xz
yuzu-792dee47a7b520cb2a8d7cf43cc184c17394708f.zip
Merge pull request #2822 from wwylele/sw_lighting-2
Implement fragment lighting in the sw renderer (take 2)
Diffstat (limited to 'src/video_core/swrasterizer/clipper.cpp')
-rw-r--r--src/video_core/swrasterizer/clipper.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/video_core/swrasterizer/clipper.cpp b/src/video_core/swrasterizer/clipper.cpp
index 6fb923756..7537689b7 100644
--- a/src/video_core/swrasterizer/clipper.cpp
+++ b/src/video_core/swrasterizer/clipper.cpp
@@ -95,6 +95,17 @@ void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const Outpu
95 static const size_t MAX_VERTICES = 9; 95 static const size_t MAX_VERTICES = 9;
96 static_vector<Vertex, MAX_VERTICES> buffer_a = {v0, v1, v2}; 96 static_vector<Vertex, MAX_VERTICES> buffer_a = {v0, v1, v2};
97 static_vector<Vertex, MAX_VERTICES> buffer_b; 97 static_vector<Vertex, MAX_VERTICES> buffer_b;
98
99 auto FlipQuaternionIfOpposite = [](auto& a, const auto& b) {
100 if (Math::Dot(a, b) < float24::Zero())
101 a = -a;
102 };
103
104 // Flip the quaternions if they are opposite to prevent interpolating them over the wrong
105 // direction.
106 FlipQuaternionIfOpposite(buffer_a[1].quat, buffer_a[0].quat);
107 FlipQuaternionIfOpposite(buffer_a[2].quat, buffer_a[0].quat);
108
98 auto* output_list = &buffer_a; 109 auto* output_list = &buffer_a;
99 auto* input_list = &buffer_b; 110 auto* input_list = &buffer_b;
100 111