diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2017-02-04 22:02:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-04 22:02:48 +0100 |
commit | 97e06b0a0daccd3347ae1bcaf294093b5af32e85 (patch) | |
tree | 59e1997c90558f58f7368d6974c355e1f20d8f32 /src/video_core/rasterizer.h | |
parent | Merge pull request #2414 from yuriks/texture-decode (diff) | |
parent | VideoCore: Make PrimitiveAssembler const-correct (diff) | |
download | yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.tar yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.tar.gz yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.tar.bz2 yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.tar.lz yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.tar.xz yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.tar.zst yuzu-97e06b0a0daccd3347ae1bcaf294093b5af32e85.zip |
Diffstat (limited to 'src/video_core/rasterizer.h')
-rw-r--r-- | src/video_core/rasterizer.h | 40 |
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 @@ #pragma once -namespace Pica { +#include "video_core/shader/shader.h" -namespace Shader { -struct OutputVertex; -} +namespace Pica { namespace Rasterizer { -void ProcessTriangle(const Shader::OutputVertex& v0, const Shader::OutputVertex& v1, - const Shader::OutputVertex& v2); +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 |