summaryrefslogtreecommitdiffstats
path: root/src/video_core/swrasterizer/clipper.cpp
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2017-06-11 18:55:35 +0200
committerwwylele <wwylele@gmail.com>2017-07-11 18:39:15 +0200
commit73566ff7a990cdfe8d8f023997b57942dc785fc4 (patch)
treeba42cbed66eeb4cd08012181f774a8633b9c2120 /src/video_core/swrasterizer/clipper.cpp
parentSwRasterizer: Corrected the light LUT lookups. (diff)
downloadyuzu-73566ff7a990cdfe8d8f023997b57942dc785fc4.tar
yuzu-73566ff7a990cdfe8d8f023997b57942dc785fc4.tar.gz
yuzu-73566ff7a990cdfe8d8f023997b57942dc785fc4.tar.bz2
yuzu-73566ff7a990cdfe8d8f023997b57942dc785fc4.tar.lz
yuzu-73566ff7a990cdfe8d8f023997b57942dc785fc4.tar.xz
yuzu-73566ff7a990cdfe8d8f023997b57942dc785fc4.tar.zst
yuzu-73566ff7a990cdfe8d8f023997b57942dc785fc4.zip
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
static const size_t MAX_VERTICES = 9;
static_vector<Vertex, MAX_VERTICES> buffer_a = {v0, v1, v2};
static_vector<Vertex, MAX_VERTICES> buffer_b;
+
+ auto FlipQuaternionIfOpposite = [](auto& a, const auto& b) {
+ if (Math::Dot(a, b) < float24::Zero())
+ a = -a;
+ };
+
+ // Flip the quaternions if they are opposite to prevent interpolating them over the wrong
+ // direction.
+ FlipQuaternionIfOpposite(buffer_a[1].quat, buffer_a[0].quat);
+ FlipQuaternionIfOpposite(buffer_a[2].quat, buffer_a[0].quat);
+
auto* output_list = &buffer_a;
auto* input_list = &buffer_b;