mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2025-05-31 14:11:42 +05:30
Fixed iterating bug with initializing mesh batches
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user