summaryrefslogtreecommitdiffstats
path: root/src/video_core/swrasterizer/rasterizer.h
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-02-13 21:04:17 +0100
committerGitHub <noreply@github.com>2017-02-13 21:04:17 +0100
commit1bf449d752f8e68c41321be68b3add7abc7f698f (patch)
tree5fbe02315127869eabd13c25b59c03f70e5759b8 /src/video_core/swrasterizer/rasterizer.h
parentCore: add cryptopp library (#2412) (diff)
parentSWRasterizer: Move more framebuffer functions to file (diff)
downloadyuzu-1bf449d752f8e68c41321be68b3add7abc7f698f.tar
yuzu-1bf449d752f8e68c41321be68b3add7abc7f698f.tar.gz
yuzu-1bf449d752f8e68c41321be68b3add7abc7f698f.tar.bz2
yuzu-1bf449d752f8e68c41321be68b3add7abc7f698f.tar.lz
yuzu-1bf449d752f8e68c41321be68b3add7abc7f698f.tar.xz
yuzu-1bf449d752f8e68c41321be68b3add7abc7f698f.tar.zst
yuzu-1bf449d752f8e68c41321be68b3add7abc7f698f.zip
Diffstat (limited to 'src/video_core/swrasterizer/rasterizer.h')
-rw-r--r--src/video_core/swrasterizer/rasterizer.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/video_core/swrasterizer/rasterizer.h b/src/video_core/swrasterizer/rasterizer.h
new file mode 100644
index 000000000..3a72ac343
--- /dev/null
+++ b/src/video_core/swrasterizer/rasterizer.h
@@ -0,0 +1,48 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "video_core/shader/shader.h"
+
+namespace Pica {
+
+namespace Rasterizer {
+
+struct Vertex : Shader::OutputVertex {
+ Vertex(const OutputVertex& v) : OutputVertex(v) {}
+
+ // Attributes used to store intermediate results
+ // position after perspective divide
+ Math::Vec3<float24> screenpos;
+
+ // Linear interpolation
+ // factor: 0=this, 1=vtx
+ void Lerp(float24 factor, const Vertex& vtx) {
+ pos = pos * factor + vtx.pos * (float24::FromFloat32(1) - factor);
+
+ // TODO: Should perform perspective correct interpolation here...
+ tc0 = tc0 * factor + vtx.tc0 * (float24::FromFloat32(1) - factor);
+ tc1 = tc1 * factor + vtx.tc1 * (float24::FromFloat32(1) - factor);
+ tc2 = tc2 * factor + vtx.tc2 * (float24::FromFloat32(1) - factor);
+
+ screenpos = screenpos * factor + vtx.screenpos * (float24::FromFloat32(1) - factor);
+
+ color = color * factor + vtx.color * (float24::FromFloat32(1) - factor);
+ }
+
+ // Linear interpolation
+ // factor: 0=v0, 1=v1
+ static Vertex Lerp(float24 factor, const Vertex& v0, const Vertex& v1) {
+ Vertex ret = v0;
+ ret.Lerp(factor, v1);
+ return ret;
+ }
+};
+
+void ProcessTriangle(const Vertex& v0, const Vertex& v1, const Vertex& v2);
+
+} // namespace Rasterizer
+
+} // namespace Pica