mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-22 13:53:02 +05:30
Meshes with multiple batches handled
This commit is contained in:
parent
4df1024a55
commit
ad32d3d10a
@ -87,7 +87,7 @@ bool getmeshheader(struct MeshHeader**, unsigned int i, const char * const);
|
|||||||
|
|
||||||
// ** = 'pass by reference' of a pointer to struct
|
// ** = 'pass by reference' of a pointer to struct
|
||||||
bool getmeshbatch(struct Batch*,
|
bool getmeshbatch(struct Batch*,
|
||||||
struct MeshHeader*,
|
unsigned int offset,
|
||||||
const char * const);
|
const char * const);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,13 +69,12 @@ bool getmeshheader(struct MeshHeader **hs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool getmeshbatch(struct Batch *b,
|
bool getmeshbatch(struct Batch *b,
|
||||||
struct MeshHeader *h,
|
unsigned int offset,
|
||||||
const char * const filedata) {
|
const char * const filedata) {
|
||||||
bool done = false;
|
bool done = false;
|
||||||
if (b == NULL || h == NULL || filedata == NULL) {
|
if (b == NULL || filedata == NULL) {
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
unsigned int offset = h -> offsetBatches;
|
|
||||||
struct BatchData *d1 = NULL;
|
struct BatchData *d1 = NULL;
|
||||||
struct VertexData d2;
|
struct VertexData d2;
|
||||||
d1 = (struct BatchData*) (filedata + offset);
|
d1 = (struct BatchData*) (filedata + offset);
|
||||||
|
@ -117,14 +117,15 @@ void extractmeshes(const char *filedata,
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
bool ok;
|
bool ok;
|
||||||
//h -> numMesh
|
//for (i = 0; i < 5; i++) {
|
||||||
for (i = 0; i < h -> numMesh; i++) {
|
for (i = 0; i < h -> numMesh; i++) {
|
||||||
ok = getmeshheader(&mh, i, filedata);
|
ok = getmeshheader(&mh, i, filedata);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
// for (j = 0; j < mh -> numBatch; j++) {
|
for (j = 0; j < mh -> numBatch; j++) {
|
||||||
getmeshbatch(&b, mh, filedata);
|
unsigned int offset = mh->offsetBatches + j * sizeof(struct BatchData);
|
||||||
|
getmeshbatch(&b, offset, filedata);
|
||||||
printmeshbatch(&b);
|
printmeshbatch(&b);
|
||||||
// } // end for
|
} // end for
|
||||||
} // end if
|
} // end if
|
||||||
} // end for
|
} // end for
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user