#ifndef DEVIL1GEO_H #define DEVIL1GEO_H #include #include #pragma pack(push, 1) struct Header { unsigned char numMesh; unsigned char unknownNumberB; unsigned char unknownNumberC; unsigned char unknownNumberD; uint32_t padding; // uint64_t unknownOffset; }; struct MeshHeader { int16_t numBatch; int16_t numVertex; uint32_t u; // uint64_t offsetBatches; uint64_t flags; }; // put these in an array of size: [header.numMesh] struct Positions { float x, y, z; }; struct Normals { float x, y, z; }; struct UVs { int16_t u, v; }; struct BoneIndexes { unsigned char indexes[4]; // from ubyte }; struct BoneWeights { uint16_t weights; // }; #pragma pack(pop) // This is where most of the parsing will be. // this struct is in-order of what the file format will have. struct Batch { int16_t numVertex; int16_t uB; uint32_t padding; // uint64_t offsetPositions; // uint64_t offsetNormals; // uint64_t offsetUVs; // uint64_t offsetBoneIndexes; // uint64_t offsetBoneWeights; // uint64_t offsets[1]; // // following structs should in an array of size numVertex struct Positions *p; struct Normals *n; struct UVs *u; struct BoneIndexes *bi; struct BoneWeights *bw; }; struct Mesh { struct Batch b; }; void printgheader(struct Header*); void printmeshheader(struct MeshHeader*); void printmeshbatch(struct Batch*); void printpositions(struct Positions*, unsigned int); void printnormals(struct Normals*, unsigned int); // ** = 'pass by reference' of a pointer to struct bool getmeshheader(struct MeshHeader**, unsigned int i, const char * const); // ** = 'pass by reference' of a pointer to struct bool getmeshbatch(struct Batch**, struct MeshHeader*, const char * const); #endif