mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2025-05-31 14:11:42 +05:30
Added getmesh function
This commit is contained in:
22
test/main.c
22
test/main.c
@@ -113,20 +113,17 @@ void extractmeshes(const char *filedata,
|
||||
}
|
||||
struct Header *h = (struct Header*)filedata;
|
||||
struct MeshHeader *mh = NULL;
|
||||
struct Batch b;
|
||||
struct Mesh m;
|
||||
m.b = NULL;
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
bool ok;
|
||||
//for (i = 0; i < 5; i++) {
|
||||
for (i = 0; i < h -> numMesh; i++) {
|
||||
ok = getmeshheader(&mh, i, filedata);
|
||||
if (ok) {
|
||||
for (j = 0; j < mh -> numBatch; j++) {
|
||||
unsigned int offset = mh->offsetBatches + j * sizeof(struct BatchData);
|
||||
getmeshbatch(&b, offset, filedata);
|
||||
printmeshbatch(&b);
|
||||
} // end for
|
||||
} // end if
|
||||
getmeshheader(&mh, i, filedata);
|
||||
m.b = (struct Batch*)malloc(sizeof(struct Batch) * (mh -> numBatch));
|
||||
if (m.b != NULL) {
|
||||
getmesh(&m, i, filedata);
|
||||
// do something with mesh e.g write to file.
|
||||
free(m.b);
|
||||
}
|
||||
} // end for
|
||||
}
|
||||
|
||||
@@ -141,3 +138,4 @@ int main(int argc, char ** argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user