From d38926b86ab4ba6dbf64803f41f2c286c23bfbaf Mon Sep 17 00:00:00 2001 From: _ <_> Date: Mon, 9 Apr 2018 20:51:37 -0700 Subject: [PATCH] Added for loop to accomodate cases with multiple batches --- include/devil1geo.h | 4 +++- test/main.c | 13 ++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/devil1geo.h b/include/devil1geo.h index 8bfb750..ad5def3 100644 --- a/include/devil1geo.h +++ b/include/devil1geo.h @@ -42,7 +42,7 @@ struct BoneIndexes { 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. @@ -68,6 +68,8 @@ struct Mesh { struct Batch b; }; +#pragma pack(pop) + void printgheader(struct Header*); void printmeshheader(struct MeshHeader*); diff --git a/test/main.c b/test/main.c index 9b28057..d2a5fcf 100644 --- a/test/main.c +++ b/test/main.c @@ -115,15 +115,18 @@ void extractmeshes(const char *filedata, struct MeshHeader *mh = NULL; struct Batch *b = NULL; unsigned int i; + unsigned int j; bool ok; //h -> numMesh - for (i = 1; i < 2; i++) { + for (i = 0; i < 2; i++) { ok = getmeshheader(&mh, i, filedata); if (ok) { - getmeshbatch(&b, mh, filedata); - printmeshbatch(b); - } - } + for (j = 0; j < mh -> numBatch; j++) { + getmeshbatch(&b, mh, filedata); + printmeshbatch(b); + } // end for + } // end if + } // end for } int main(int argc, char ** argv) {