Sign in to follow this  

3D modelers

This topic is 4736 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well lets take for example the ASE file format (from 3DMax)
1.When you reach the *GEOMOBJECT tag then you found another object in the file
2.*MESH_NUMVERTEX <number>stores the number of vertices
3.*MESH_NUMFACES <number>stores the number of faces
4.*MESH_VERTEX_LIST a list of vertices
5.*MESH_VERTEX is a tag that goes before each vertex like:
<tag> <index> <coordinates>
*MESH_VERTEX 0 -1.0979 -2.7760 4.4121
*MESH_VERTEX 1 -0.9912 -1.7433 6.1101
*MESH_VERTEX 2 -0.7890 -0.7264 7.6270
*MESH_VERTEX 3 -0.6620 -0.3812 8.8613
*MESH_VERTEX 4 -0.9718 -1.6821 8.9201
*MESH_VERTEX 5 -1.2107 -2.3794 8.1152
*MESH_VERTEX 6 -1.4578 -3.2617 9.4907
*MESH_VERTEX 7 -1.3566 -2.5776 10.1653
*MESH_VERTEX 8 -1.0153 -1.3110 11.107
!!!!the coordinates are in this order : x,-z,y!!!!!(this goes with the quake Md2 file format)
6.*MESH_FACE_LIST -the list of faces given in indeces ,each vertex of the face is in fact an index into the vertex arrays
7.*MESH_FACE 0: A: 3 B: 451 C: 219 AB: 1 BC: 1 CA: 0 *MESH_SMOOTHING 2 *MESH_MTLID 0
you need only the A,B,C values
8.*MESH_NUMTVERTEX <number of texture coordinates>
(eg)*MESH_TVERT 0 0.6494 0.5660 0.8068
9.Now every face is mapped onto the texture using indeces

*MESH_NUMTVFACES 3850
*MESH_TFACELIST {
*MESH_TFACE 0 3 451 219
*MESH_TFACE 1 219 453 3
*MESH_TFACE 2 54 452 1927
*MESH_TFACE 3 1928 1929 54

10.Normals for every face or for every vertex

(eg)*MESH_NORMALS {
*MESH_FACENORMAL 0 0.4892 -0.1081 0.8654
*MESH_VERTEXNORMAL 3 0.6109 -0.3027 0.7316
*MESH_VERTEXNORMAL 451 0.4515 -0.1174 0.8845
*MESH_VERTEXNORMAL 219 0.5068 -0.0361 0.8613
*MESH_FACENORMAL 1 0.5204 0.0069 0.8539
*MESH_VERTEXNORMAL 219 0.5068 -0.0361 0.8613
*MESH_VERTEXNORMAL 453 0.5211 0.0459 0.8522
*MESH_VERTEXNORMAL 3 0.6109 -0.3027 0.7316


This is just one format you could use


Here are some structures that you could find useful :

eg.

typedef struct _POINT3
{
float x;
float y;
float z;

}Point3;



typedef struct t_Face
{

int vertIndex[3]; //indeces into the vertex arrays
int coordIndex[3]; //indeces into the texture coordiantes array

}tFace;

struct Object
{
int numOfVerts;
int numOfFaces;
int numTexVertex;
t_Face *pFaces;
Point3* pVerts;
Point3* pFaceNormals;
Point3* pVertexNormals;
Point3* pTexVerts;
}


=Render each face(triangle)using the indeces .

Of course this is not the fastest format to load but this is a possible model.
Then you can use vertex arrays /vertexbuffers for OpenGL and Direct3D .

I hope that helped.

Share this post


Link to post
Share on other sites

This topic is 4736 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this