Vertex List question..

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
ayatollah
Posts: 15
Joined: Sun Sep 04, 2005 10:49 am

Vertex List question..

Post by ayatollah »

HI there

I am pretty new to 3d Programming and was wondering if somebody here could help me on the following question:

in the pspgu.h at the sceGuDrawArray I need to give a pointer to a vertex list.
I am playing around with the cube sample where it says:

Code: Select all

struct Vertex
{
	float u, v;
	unsigned int color;
	float x,y,z;
};

struct Vertex __attribute__((aligned(16))) vertices[12*3] =
{
	{0, 0, 0xff7f0000,-1,-1, 1}, // 0
	{1, 0, 0xff7f0000,-1, 1, 1}, // 4
	{1, 1, 0xff7f0000, 1, 1, 1}, // 5....
 
in the pspgu.h it states:

* Vertex order:
* [for vertices(1-8)]
* [texture uv]
* [weights (0-8)]
* [color]
* [normal]
* [vertex]
* [/for]

obviously, on the vertex structure the author defined:
float u, v;
unsigned int color;
float x,y,z;

Can i simply put EVERYTHING i need in this structure (like normals etc.???) it is my understanding that I need to follow the above order but how is it that the 3 last x,y,z are not mistaken for normals but correctly taken as vertex coords??

I am also trying different formats and came across a few exporter for 3ds max.. However they seem to export the coords and then a seperate set of POLYGONS (basically a list of what points need to be connected with which points from the coords of an object.. in the Cube Sample they are listed in the correct order for drawing but if I want to use an existing exporter or take a COLLADA File, how to I use the vertex coords AND the Polygon Information to render it on PSP??

I am not sure if this makes sense but it's rather hard to explain :)

Any help or hint would be greatly appreciated!
ufoz
Posts: 86
Joined: Thu Nov 10, 2005 2:36 am
Location: Tokyo
Contact:

Post by ufoz »

If you stick normals into your vertex structure, I think you will need to update the flags you pass to the DrawArray function with GU_NORMAL_???, then the PSP will know to look for a normal before the position.

For your second question, just stick the polygon info into an index buffer, and add a GU_INDEX_??? flag to your DrawArray call.
Post Reply