Ridley5 opened this issue on Jul 26, 2010 · 1724 posts
kawecki posted Wed, 04 August 2010 at 4:40 AM
Maybe this can help with the geometry:
typedef struct NAME{char name[NAME_MAXSIZE];} NAME;
typedef struct VERTEX{float x,y,z,nx,ny,nz;int flag,flag1;} VERTEX; // nx,ny,nz = normals flag,flag1 = for any use.
typedef struct UVVERTEX{float u,v;int flag,flag1;} UVVERTEX;
typedef struct FACE{int material,group,nindex,index[4],uvindex[4],flag;} FACE;
typedef struct MATERIAL{NAME name;... other properties ....;}MATERIAL;
typedef struct GEOMETRY{int nvertices,nuv_vertices,nfaces,ngroups,nmaterials;
VERTEX *vertex; UVVERT *tvert;FACE *face;MATERIAL *mat;
NAME group_name[MAX_GROUPS];} GEOMETRY;
Now allocate memory for the structures (you will need to relocate memeory during the process)
Scan all the posed geometry and fill all the data of the structures, if a face has more than four sides split into traingles and update nfaces.
Once filled all the structures, sort face[n] by group and then by material.
Try to find seams within the same material then create extra vertices at the end of vertex[] array.
Duplicate the normals for this extra vertice and update the values of face[n].
Now geometry structure has all the data for export.
Stupidity also evolves!