summaryrefslogtreecommitdiff
path: root/src/video_core/rasterizer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/rasterizer.h')
-rw-r--r--src/video_core/rasterizer.h40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/video_core/rasterizer.h b/src/video_core/rasterizer.h
index 6cbda3067..3a72ac343 100644
--- a/src/video_core/rasterizer.h
+++ b/src/video_core/rasterizer.h
@@ -4,16 +4,44 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Pica { 7#include "video_core/shader/shader.h"
8 8
9namespace Shader { 9namespace Pica {
10struct OutputVertex;
11}
12 10
13namespace Rasterizer { 11namespace Rasterizer {
14 12
15void ProcessTriangle(const Shader::OutputVertex& v0, const Shader::OutputVertex& v1, 13struct Vertex : Shader::OutputVertex {
16 const Shader::OutputVertex& v2); 14 Vertex(const OutputVertex& v) : OutputVertex(v) {}
15
16 // Attributes used to store intermediate results
17 // position after perspective divide
18 Math::Vec3<float24> screenpos;
19
20 // Linear interpolation
21 // factor: 0=this, 1=vtx
22 void Lerp(float24 factor, const Vertex& vtx) {
23 pos = pos * factor + vtx.pos * (float24::FromFloat32(1) - factor);
24
25 // TODO: Should perform perspective correct interpolation here...
26 tc0 = tc0 * factor + vtx.tc0 * (float24::FromFloat32(1) - factor);
27 tc1 = tc1 * factor + vtx.tc1 * (float24::FromFloat32(1) - factor);
28 tc2 = tc2 * factor + vtx.tc2 * (float24::FromFloat32(1) - factor);
29
30 screenpos = screenpos * factor + vtx.screenpos * (float24::FromFloat32(1) - factor);
31
32 color = color * factor + vtx.color * (float24::FromFloat32(1) - factor);
33 }
34
35 // Linear interpolation
36 // factor: 0=v0, 1=v1
37 static Vertex Lerp(float24 factor, const Vertex& v0, const Vertex& v1) {
38 Vertex ret = v0;
39 ret.Lerp(factor, v1);
40 return ret;
41 }
42};
43
44void ProcessTriangle(const Vertex& v0, const Vertex& v1, const Vertex& v2);
17 45
18} // namespace Rasterizer 46} // namespace Rasterizer
19 47