mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2025-05-31 14:11:42 +05:30
Moved out for loop & fixed getting mesh headers
This commit is contained in:
42
src/devil1geo.c
Normal file
42
src/devil1geo.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "devil1geo.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void printgheader(struct Header *gh) {
|
||||
if (gh != NULL) {
|
||||
printf("pointer %x\n", gh);
|
||||
printf("number of meshes %x\n", gh -> numMesh);
|
||||
printf("unknown number B %x\n", gh -> unknownNumberB);
|
||||
printf("unknown number C %x\n", gh -> unknownNumberC);
|
||||
printf("unknown number D %x\n", gh -> unknownNumberD);
|
||||
printf("padding %x\n", gh -> padding);
|
||||
printf("unknown offset %x\n", gh -> unknownOffset);
|
||||
}
|
||||
}
|
||||
|
||||
void printmeshheader(struct MeshHeader *mh) {
|
||||
if (mh == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("number of batches %x\n", mh -> numBatch);
|
||||
printf("number of vertices %x\n", mh -> numVertex);
|
||||
printf("unknown %x\n", mh -> u);
|
||||
printf("batch offset %x\n", mh -> offsetBatches);
|
||||
printf("flags %x\n\n", mh -> flags);
|
||||
}
|
||||
|
||||
bool getmeshheader(struct MeshHeader **hs,
|
||||
unsigned int i,
|
||||
const char * const filedata) {
|
||||
bool done = false;
|
||||
if (hs == NULL || filedata == NULL) {
|
||||
return done;
|
||||
}
|
||||
struct Header *h = (struct Header*)filedata;
|
||||
if (h -> numMesh < i) {
|
||||
return done;
|
||||
}
|
||||
unsigned int pos = sizeof(struct MeshHeader) * i + sizeof(struct Header);
|
||||
(*hs) = (struct MeshHeader*)(filedata + pos);
|
||||
done = true;
|
||||
return done;
|
||||
}
|
Reference in New Issue
Block a user