rasterize: fix viewport and perspective transformations. now triangles are rendered terribly in the correct place
This commit is contained in:
parent
fff695d3c1
commit
38d10282f4
|
@ -245,15 +245,18 @@ static void Render()
|
||||||
{
|
{
|
||||||
VERT &vert = gfx3d.vertlist->list[i];
|
VERT &vert = gfx3d.vertlist->list[i];
|
||||||
|
|
||||||
//perspective division
|
////perspective division
|
||||||
vert.coord[0] = (vert.coord[0] + vert.coord[3]) / 2 / vert.coord[3];
|
//vert.coord[0] = (vert.coord[0] + vert.coord[3]) / 2 / vert.coord[3];
|
||||||
vert.coord[1] = (vert.coord[1] + vert.coord[3]) / 2 / vert.coord[3];
|
//vert.coord[1] = (vert.coord[1] + vert.coord[3]) / 2 / vert.coord[3];
|
||||||
vert.coord[2] = (vert.coord[2] + vert.coord[3]) / 2 / vert.coord[3];
|
//vert.coord[2] = (vert.coord[2] + vert.coord[3]) / 2 / vert.coord[3];
|
||||||
vert.coord[3] = 1;
|
//vert.coord[3] = 1;
|
||||||
|
|
||||||
//transform to viewport. this is badly broken
|
////transform to viewport. this is badly broken
|
||||||
vert.coord[0] = (vert.coord[0])*128;
|
//vert.coord[0] = (vert.coord[0])*128;
|
||||||
vert.coord[1] = (vert.coord[1])*96;
|
//vert.coord[1] = (vert.coord[1])*96;
|
||||||
|
|
||||||
|
vert.coord[0] = (vert.coord[0]+vert.coord[3])*256 / (2*vert.coord[3]) + 0;
|
||||||
|
vert.coord[1] = (vert.coord[1]+vert.coord[3])*192 / (2*vert.coord[3]) + 0;
|
||||||
|
|
||||||
int zzz=9;
|
int zzz=9;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue