Fixed iterating bug with initializing mesh batches

This commit is contained in:
_
2018-04-13 14:56:14 -07:00
parent d38926b86a
commit 4df1024a55
3 changed files with 46 additions and 48 deletions

View File

@@ -23,11 +23,7 @@ struct MeshHeader {
uint64_t flags;
}; // put these in an array of size: [header.numMesh]
struct Positions {
float x, y, z;
};
struct Normals {
struct Coordinate {
float x, y, z;
};
@@ -43,10 +39,7 @@ struct BoneWeights {
uint16_t weights; // <format=hex>
};
// This is where most of the parsing will be.
// this struct is in-order of what the file format will have.
struct Batch {
struct BatchData {
int16_t numVertex;
int16_t uB;
uint32_t padding; // <format=hex>
@@ -56,16 +49,27 @@ struct Batch {
uint64_t offsetBoneIndexes; // <format=hex>
uint64_t offsetBoneWeights; // <format=hex>
uint64_t offsets[1]; // <format=hex>
};
struct VertexData {
// following structs should in an array of size numVertex
struct Positions *p;
struct Normals *n;
struct Coordinate *positions;
struct Coordinate *normals;
struct UVs *u;
struct BoneIndexes *bi;
struct BoneWeights *bw;
};
// This is where most of the parsing will be.
// this struct is in-order of what the file format will have.
struct Batch {
struct BatchData *bd;
struct VertexData vd;
};
struct Mesh {
struct Batch b;
// may contain multiple batches
struct Batch *b;
};
#pragma pack(pop)
@@ -76,15 +80,13 @@ void printmeshheader(struct MeshHeader*);
void printmeshbatch(struct Batch*);
void printpositions(struct Positions*, unsigned int);
void printnormals(struct Normals*, unsigned int);
void printcoordinate(struct Coordinate*, 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**,
bool getmeshbatch(struct Batch*,
struct MeshHeader*,
const char * const);