Spent a lot of time to achieve this function, most of the problems appear in the low-level error, it seems to remind more than spirit! The cause of the error is:
<span style= "Color:rgb (255, 255, 255); font-family:arial; font-size:14px; line-height:22px; " > </span>void ctriangle2dutils::D rawsolidgeneralclipzorder (D3dxvector3 p0, D3DXVECTOR3 p1, D3DXVECTOR3 p2, int color) {if (P0.y > P1.y) math3d::swap (P0, p1), if (P0.y > P2.y) math3d::swap (P0, p2); if (p1.y > P2.y) Math3d::swap (P2, p1); if (P0.y > BTM_BORDER_SCR | | P2.y < TOP_BORDER_SCR | | (p0.x < LEFT_BORDER_SCR && p1.x < LEFT_BORDER_SCR && p2.x < LEFT_BORDER_SCR) | | (p0.x > Right_border_scr && p1.x > Right_border_scr && p2.x > Right_border_scr)) return;//outside the//INV zp0.z = 1.0f/p0.z;p1.z = 1.0f/p1.z;p2.z = 1.0f/p2.z;if (fcmp (p0.x, p1.x) && fcmp (p1 . x, p2.x) | | FCMP (P0.Y, p1.y) && fcmp (P1.Y, p2.y)) {//Draw degenerate straight drawdeclineclip (P0, p1, p2, color);} else if (fcmp (P0.Y, p1.y)) {ctriangle2dutils::D rawsolidflattopclipzorder (P0, p1, p2, color);} else if (fcmp (P1.Y, p2.y)) {CtrianglE2dutils::D rawsolidflatbottomclipzorder (P0, p1, p2, color);} Else{//had INVe z Float dzdy = (p2.z-p0.z)/(P2.Y-P0.Y);//float Newz = Dzdy * (P2.Y-P0.Y) + p0.z;---------------that. Didn't change it back. cause z sort error Float Newz = dzdy * (P1.Y-P0.Y) + p0.z;//should be changed to this---------------//float NEWZINV = 1.0f/newz;d3dxvector3 pc (Line_x_nof (p0.x, P0.y, p2.x, P2.y, p1.y), P1.Y, Newz); Ctriangle2dutils::D rawsolidflatbottomclipzorder (P0, p1, PC, color); Ctriangle2dutils::D rawsolidflattopclipzorder (P1, PC, p2, color);}}
Deep sequencing of 3D soft engines