AddPrim, GsSortObject4 and Z problem

Graphic based area of development (Graphics Processing Unit), including the Geometry Transform Engine (GTE), TIM, STR (MDEC), etc.
Post Reply
kernex
Interested PSXDEV User
Interested PSXDEV User
Posts: 7
Joined: Mar 14, 2020
I am a: Software engineer & PSX enthusiast
PlayStation Model: SCPH-101
Location: Brazil

AddPrim, GsSortObject4 and Z problem

Post by kernex » April 25th, 2021, 1:27 am

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.

kernex
Interested PSXDEV User
Interested PSXDEV User
Posts: 7
Joined: Mar 14, 2020
I am a: Software engineer & PSX enthusiast
PlayStation Model: SCPH-101
Location: Brazil

Post by kernex » April 25th, 2021, 4:07 am

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]);

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests