aboutsummaryrefslogtreecommitdiff
path: root/src/o3d/tri_deriv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/o3d/tri_deriv.cpp')
-rw-r--r--src/o3d/tri_deriv.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/o3d/tri_deriv.cpp b/src/o3d/tri_deriv.cpp
index b4184bc..a22067e 100644
--- a/src/o3d/tri_deriv.cpp
+++ b/src/o3d/tri_deriv.cpp
@@ -51,7 +51,7 @@ static void _perspective_crop_x(std::vector<TriangleDerived>& tris, TriangleDeri
{
x,
q2->vertex.y + fac2 * dq2.y,
- fac2_b * q1->vertex.z + (1.f - fac2_b) * q2->vertex.z,
+ (fac2_b * q1->vertex.w * q1->vertex.z + (1.f - fac2_b) * q2->vertex.w * q2->vertex.z) / r2w,
r2w
},
fac2_b * q1->b0 + (1.f - fac2_b) * q2->b0,
@@ -65,7 +65,7 @@ static void _perspective_crop_x(std::vector<TriangleDerived>& tris, TriangleDeri
{
x,
q3->vertex.y + fac3 * dq3.y,
- fac3_b * q1->vertex.z + (1.f - fac3_b) * q3->vertex.z,
+ (fac3_b * q1->vertex.w * q1->vertex.z + (1.f - fac3_b) * q3->vertex.w * q3->vertex.z) / r3w,
r3w
},
fac3_b * q1->b0 + (1.f - fac3_b) * q3->b0,
@@ -144,7 +144,7 @@ static void _perspective_crop_y(std::vector<TriangleDerived>& tris, TriangleDeri
{
q2->vertex.x + fac2 * dq2.x,
y,
- fac2_b * q1->vertex.z + (1.f - fac2_b) * q2->vertex.z,
+ (fac2_b * q1->vertex.w * q1->vertex.z + (1.f - fac2_b) * q2->vertex.w * q2->vertex.z) / r2w,
r2w
},
fac2_b * q1->b0 + (1.f - fac2_b) * q2->b0,
@@ -158,7 +158,7 @@ static void _perspective_crop_y(std::vector<TriangleDerived>& tris, TriangleDeri
{
q3->vertex.x + fac3 * dq3.x,
y,
- fac3_b * q1->vertex.z + (1.f - fac3_b) * q3->vertex.z,
+ (fac3_b * q1->vertex.w * q1->vertex.z + (1.f - fac3_b) * q3->vertex.w * q3->vertex.z) / r3w,
r3w
},
fac3_b * q1->b0 + (1.f - fac3_b) * q3->b0,