mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2025-05-31 14:11:42 +05:30
Added getmesh function
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user