| View previous topic :: View next topic |
| Author |
Message |
tesla

Joined: 26 May 2008 Posts: 4 Location: /dev/urandom
|
Posted: Mon May 26, 2008 6:37 pm Post subject: gsKit, ZBuffer etc ... |
|
|
Hi,
Need little help with gsKit. What I want is to make function
gsKit_prim_triangle_gouraud_3d()
to work similar to:
draw_triangles() from libdraw.
Point is to store all the vertices like draw_triangles() does.
I'm fresh here (ps2 code) so if i misunderstood smtg plese correct me.
Calculating color values and pasing them to gsKit function is not a problem (i get them using Z depth so it's simple gouraud - no light angle etc.)
draw_triangles() makes smtg like this:
[...]
GIF_SET_TAG(count, 1, 0, 0, GIF_TAG_REGLIST, 2).
then loops with sending XYZ and it's colour.
Count is number of points of triangles.
gsKit_prim_triangle_gouraud_3d() does:
[...]
*p_data++ = GS_SETREG_PRIM( GS_PRIM_PRIM_TRIANGLE,...[...]
then stores XYZ with colours of three points of one triangle.
I didn't find out how to make it with gsKit to use hw zbuffering. Sorting vertices by hand to get triangles that should be drawn first works but is not a solution i need.
Jah bless |
|
| Back to top |
|
 |
ps2devman
Joined: 09 Oct 2006 Posts: 265
|
Posted: Mon May 26, 2008 7:43 pm Post subject: |
|
|
http://home.tele2.fr/~fr-51785/ps2_initial_fantasy.zip
(250000 vertices/frame 3D rendering loop)
Old stuff, but 'optimal' I think.
Note that gsKit is not used as main rendering loop, but used as comfortable graphic library for all non speed-sensitive 3D stuff. |
|
| Back to top |
|
 |
tesla

Joined: 26 May 2008 Posts: 4 Location: /dev/urandom
|
Posted: Mon May 26, 2008 8:20 pm Post subject: |
|
|
:) k, i was afraid of answer like this but k. got the point i think.
gsKit mostly used for init stuff k.
Not exactly what i asked for but comments in code are ok. Just one more question:
object data created using get_mesh_batches() and send by vu1UploadHugeDataContFlush(), right ?
Thx. |
|
| Back to top |
|
 |
ps2devman
Joined: 09 Oct 2006 Posts: 265
|
Posted: Tue May 27, 2008 6:30 pm Post subject: |
|
|
Yes. It's the insane -probably professional- method. You prepare everything to go to gs through massive non-stop dma transferts.
I think you can still use gskit normal stuff to draw and it will act properly in regard of Z buffer. I mean, in order to have my little yellow line drawn I had to carefully choose the Z value. |
|
| Back to top |
|
 |
tesla

Joined: 26 May 2008 Posts: 4 Location: /dev/urandom
|
Posted: Wed May 28, 2008 5:22 pm Post subject: |
|
|
| ps2devman wrote: |
I think you can still use gskit normal stuff to draw and it will act properly in regard of Z buffer. I mean, in order to have my little yellow line drawn I had to carefully choose the Z value. |
Man, that Z value tip was what i need :) To draw it properly (object) i had to
GS_ZTEST_ON, then call gsKit_prim_triangle_gouraud_3d() in loop with z1,z2,z3 set as positive integer value and GS_ZTEST_OFF. When Z is < 0 it doesn't sort vertices. Thx a lot and Jah bless. |
|
| Back to top |
|
 |
|