mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-22 13:53:02 +05:30
Added example for geo component
This commit is contained in:
parent
bc6b2081e0
commit
063a091d7f
@ -98,4 +98,30 @@ Functions
|
||||
When file size is detected to be too small for a given i-th
|
||||
Mesh.
|
||||
|
||||
Example logic to interact with all meshes:
|
||||
{
|
||||
// After the file has been read in.
|
||||
|
||||
// Need to know how many meshes are in the file.
|
||||
struct Header *h = (struct Header*)filedata;
|
||||
|
||||
// Need to know about a specific mesh (how many batches).
|
||||
struct MeshHeader *mh = NULL;
|
||||
|
||||
// Need to hold information about mesh.
|
||||
struct Mesh m;
|
||||
// As a precaution - empty for now.
|
||||
m.b = NULL;
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < h -> numMesh; i++) {
|
||||
DEVIL1GEO.getmeshheader(&mh, i, filedata);
|
||||
// Allocate space to hold batch data.
|
||||
m.b = (struct Batch*)malloc(sizeof(struct Batch) * (mh -> numBatch));
|
||||
if (m.b != NULL) {
|
||||
DEVIL1GEO.getmesh(&m, i, filedata, filesize);
|
||||
// Do whatever you want with the mesh.
|
||||
free(m.b);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user