mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-27 12:04:16 +01:00
SwRasterizer/Clipper: flip the sign convention to match PICA and OpenGL
This commit is contained in:
parent
addbcd5784
commit
417cb45e3f
@ -31,7 +31,7 @@ public:
|
|||||||
: coeffs(coeffs), bias(bias) {}
|
: coeffs(coeffs), bias(bias) {}
|
||||||
|
|
||||||
bool IsInside(const Vertex& vertex) const {
|
bool IsInside(const Vertex& vertex) const {
|
||||||
return Math::Dot(vertex.pos + bias, coeffs) <= float24::FromFloat32(0);
|
return Math::Dot(vertex.pos + bias, coeffs) >= float24::FromFloat32(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsOutSide(const Vertex& vertex) const {
|
bool IsOutSide(const Vertex& vertex) const {
|
||||||
@ -116,13 +116,13 @@ void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const Outpu
|
|||||||
static const float24 f0 = float24::FromFloat32(0.0);
|
static const float24 f0 = float24::FromFloat32(0.0);
|
||||||
static const float24 f1 = float24::FromFloat32(1.0);
|
static const float24 f1 = float24::FromFloat32(1.0);
|
||||||
static const std::array<ClippingEdge, 7> clipping_edges = {{
|
static const std::array<ClippingEdge, 7> clipping_edges = {{
|
||||||
{Math::MakeVec(f1, f0, f0, -f1)}, // x = +w
|
{Math::MakeVec(-f1, f0, f0, f1)}, // x = +w
|
||||||
{Math::MakeVec(-f1, f0, f0, -f1)}, // x = -w
|
{Math::MakeVec(f1, f0, f0, f1)}, // x = -w
|
||||||
{Math::MakeVec(f0, f1, f0, -f1)}, // y = +w
|
{Math::MakeVec(f0, -f1, f0, f1)}, // y = +w
|
||||||
{Math::MakeVec(f0, -f1, f0, -f1)}, // y = -w
|
{Math::MakeVec(f0, f1, f0, f1)}, // y = -w
|
||||||
{Math::MakeVec(f0, f0, f1, f0)}, // z = 0
|
{Math::MakeVec(f0, f0, -f1, f0)}, // z = 0
|
||||||
{Math::MakeVec(f0, f0, -f1, -f1)}, // z = -w
|
{Math::MakeVec(f0, f0, f1, f1)}, // z = -w
|
||||||
{Math::MakeVec(f0, f0, f0, -f1), Math::Vec4<float24>(f0, f0, f0, EPSILON)}, // w = EPSILON
|
{Math::MakeVec(f0, f0, f0, f1), Math::Vec4<float24>(f0, f0, f0, EPSILON)}, // w = EPSILON
|
||||||
}};
|
}};
|
||||||
|
|
||||||
// Simple implementation of the Sutherland-Hodgman clipping algorithm.
|
// Simple implementation of the Sutherland-Hodgman clipping algorithm.
|
||||||
@ -157,7 +157,7 @@ void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const Outpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_state.regs.rasterizer.clip_enable) {
|
if (g_state.regs.rasterizer.clip_enable) {
|
||||||
ClippingEdge custom_edge{-g_state.regs.rasterizer.GetClipCoef()};
|
ClippingEdge custom_edge{g_state.regs.rasterizer.GetClipCoef()};
|
||||||
Clip(custom_edge);
|
Clip(custom_edge);
|
||||||
|
|
||||||
if (output_list->size() < 3)
|
if (output_list->size() < 3)
|
||||||
|
Loading…
Reference in New Issue
Block a user