mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-26 00:38:55 +05:30
43 lines
1.3 KiB
C
43 lines
1.3 KiB
C
|
#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;
|
||
|
}
|