sega16 wrote:I still don't understand the format in meshes.c
usually in 3d rendering there are many polygons and polygons are all made up of triangles so why not just store everything in triangles maybe something like this
1x,1y,1z,2x,2y,2z,3x,3y,3z
well I guess I have some work to do......
Actually SGDK do not provide any 3D rendering capabilities, you just have 2D polygon drawing then you do whatever you want with it.
The meshs.c file contains severals tables which give all informations about the 3D cube. As said bioloid, you have the vertex array which contains points coordinates then index array which contains vertex index to define polygon or whatever.
When you have flat rendering i use this index table :
Code: Select all
cube_poly_ind[6 * 4] =
{
7, 4, 5, 6,
0, 3, 2, 1,
3, 7, 6, 2,
4, 0, 1, 5,
1, 2, 6, 5,
4, 7, 3, 0
};
To define quad polygon and draw them.
Why i use quad instead of triangle ? Just because it's faster :p
I actually have less edge calculation by drawing quad there.
When i draw in wireframe (enable with START key) i use this index table :
Code: Select all
const u16 cube_line_ind[12 * 2] =
{
0, 1,
1, 2,
2, 3,
3, 0,
4, 5,
5, 6,
6, 7,
7, 4,
0, 4,
1, 5,
2, 6,
3, 7
};
to find line to draw.