What is the best way to store meshes or 3d models in a class

Posted by Robse on Game Development See other posts from Game Development or by Robse
Published on 2011-11-09T09:46:57Z Indexed on 2012/09/04 21:52 UTC
Read the original article Hit count: 231

Filed under:
|
|

I am wondering, how I should store my mesh into memory after loading it from whatever file. I have Questions floating in my head:

  1. Should a mesh could have sub meshes or does the 3d model just store a list of meshes all on the same level
  2. Is there one material assigned to one mesh 1:1?
  3. What do I have to consider, if I want to store skeletal animations?

Btw it's a OpenGL|ES2 iOS game using GLKit.

I came up with some basic struct types: (But I think they are way to simple and I need to add padding or change the vector3 to vector4.)

typedef union _N3DShortVector2 {
    struct { short x, y; };
    struct { short s, t; };
    short v[2];
} N3DShortVector2;

typedef union _N3DShortVector3 {
    struct { short x, y, z; };
    struct { short r, g, b; };
    struct { short s, t, p; };
    short v[3];
} N3DShortVector3;

typedef GLKVector3 N3DFloatVector3;

typedef struct _N3DMeshRecordSV3 {
    N3DShortVector3 v1, v2, v3;
} N3DMeshRecordSV3;

typedef struct _N3DMeshRecordSV3FN3ST2 {
    N3DShortVector3 v1, v2, v3;
    N3DFloatVector3 n1, n2, n3;
    N3DShortVector2 t1, t2, t3;
} N3DMeshRecordSV3FN3ST2;

© Game Development or respective owner

Related posts about opengl-es

Related posts about ios