Added getmesh function

This commit is contained in:
_
2018-04-17 18:32:23 -07:00
parent 383abb1607
commit 9a75cd0940
3 changed files with 42 additions and 22 deletions

View File

@@ -88,3 +88,28 @@ bool getmeshbatch(struct Batch *b,
done = true;
return done;
}
// assume client has allocated memory for mesh
bool getmesh(struct Mesh *m,
unsigned int i,
const char * const filedata) {
bool done = false;
if (m == NULL || filedata == NULL || m -> b == NULL) {
return done;
}
struct MeshHeader *mh = NULL;
bool ok = getmeshheader(&mh, i, filedata);
if (ok) {
unsigned int j;
struct Batch b;
for (j = 0; j < mh -> numBatch; j++) {
unsigned int offset = mh->offsetBatches + j * sizeof(struct BatchData);
getmeshbatch(&b, offset, filedata);
printmeshbatch(&b);
m -> b[j] = b;
}
done = true;
}
return done;
}