Page 1 of 1

AddPrim, GsSortObject4 and Z problem

Posted: April 25th, 2021, 1:27 am
by kernex
Hello guys, I have a little problem.

I'm using AddPrism to draw a simple vertex array and GsSortObject4 to draw vertices from TMD file.

Ok, nice.

Except the polygons drawn by AddPrism always get behind the polygons drawn by GsSortObject4, no matter if I move the z axis forward or backward.

My draw rotine is the following:

...
if ((OT_z > 0) && (OT_z < (1 << OT_LENGTH)))
AddPrim(&OT_TAGs[currBuffer][OT_z - 2], &f3[currBuffer]);

...

GsSortObject4(spr->obj, spr->ot, 14 - OT_LENGTH, getScratchAddr(0));
...

GsDrawOt(&OTs[currBuffer]);

Somebody can help me?

Thanks.

Re: AddPrim, GsSortObject4 and Z problem

Posted: April 25th, 2021, 4:07 am
by kernex
I believe I found the solution.

I figure out I need divide the OT_z result by (14-OT_LENGTH).

AddPrim(&OT_TAGs[currBuffer][(OT_z) >> (14 - OT_LENGTH)], &f3[currBuffer]);