diff --git a/include/devil1geo.h b/include/devil1geo.h index 00375ad..9755435 100644 --- a/include/devil1geo.h +++ b/include/devil1geo.h @@ -73,39 +73,35 @@ struct Mesh { #pragma pack(pop) typedef struct { +// input: pointer to struct void (* const printheader) (struct Header*); + +// input: pointer to struct void (* const printmeshheader)(struct MeshHeader*); + +// input: pointer to struct void (* const printbatch) (struct Batch*); + +// input: pointer to struct void (* const printcoordinate)(struct Coordinate*, unsigned int); +// input: pointer of pointer to struct, order, file data +// ** = 'pass by reference' of a pointer to struct bool (* const getmeshheader) (struct MeshHeader**, unsigned int i, const char * const); +// input: pointer to struct, offset of file data batch is at, file data bool (* const getbatch) (struct Batch*, unsigned int offset, const char * const); +// input: pointer to struct, order, file data bool (* const getmesh) (struct Mesh*, unsigned int i, - const char* filename); + const char*); } fn_devil1geo; extern fn_devil1geo const DEVIL1GEO; -static void printgheader(struct Header*); - -static void printmeshheader(struct MeshHeader*); - -static void printmeshbatch(struct Batch*); - -static void printcoordinate(struct Coordinate*, unsigned int); - -// ** = 'pass by reference' of a pointer to struct -static bool getmeshheader(struct MeshHeader**, unsigned int i, const char * const); - -static bool getmeshbatch(struct Batch*, unsigned int offset, const char * const); - -static bool getmesh(struct Mesh*, unsigned int i, const char* filename); - #endif diff --git a/src/devil1geo.c b/src/devil1geo.c index 7bd72c7..4284ba2 100644 --- a/src/devil1geo.c +++ b/src/devil1geo.c @@ -1,6 +1,21 @@ #include "devil1geo.h" #include +static void printgheader(struct Header*); + +static void printmeshheader(struct MeshHeader*); + +static void printmeshbatch(struct Batch*); + +static void printcoordinate(struct Coordinate*, unsigned int); + + +static bool getmeshheader(struct MeshHeader**, unsigned int i, const char * const); + +static bool getmeshbatch(struct Batch*, unsigned int offset, const char * const); + +static bool getmesh(struct Mesh*, unsigned int i, const char*); + fn_devil1geo const DEVIL1GEO = {printgheader, printmeshheader, printmeshbatch, @@ -11,13 +26,13 @@ fn_devil1geo const DEVIL1GEO = {printgheader, static void printgheader(struct Header *gh) { if (gh != NULL) { - printf("pointer %x\n", gh); + printf("pointer %p\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); + printf("unknown offset %lx\n", gh -> unknownOffset); } } @@ -28,8 +43,8 @@ static void printmeshheader(struct MeshHeader *mh) { 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); + printf("batch offset %lx\n", mh -> offsetBatches); + printf("flags %lx\n\n", mh -> flags); } static void printmeshbatch(struct Batch *b) { @@ -40,12 +55,12 @@ static void printmeshbatch(struct Batch *b) { printf("number of vertices %x\n", bd -> numVertex); printf("unknown byte %x\n", bd -> uB); printf("padding %x\n", bd -> padding); - printf("offsetPositions %x\n", bd -> offsetPositions); - printf("offsetNormals %x\n", bd -> offsetNormals); - printf("offsetUVs %x\n", bd -> offsetUVs); - printf("offsetBoneIndexes %x\n", bd -> offsetBoneIndexes); - printf("offsetBoneWeights %x\n", bd -> offsetBoneWeights); - printf("offsets %x\n\n", bd -> offsets[0]); + printf("offsetPositions %lx\n", bd -> offsetPositions); + printf("offsetNormals %lx\n", bd -> offsetNormals); + printf("offsetUVs %lx\n", bd -> offsetUVs); + printf("offsetBoneIndexes %lx\n", bd -> offsetBoneIndexes); + printf("offsetBoneWeights %lx\n", bd -> offsetBoneWeights); + printf("offsets %lx\n\n", bd -> offsets[0]); printcoordinate(b -> vd.positions, 3); }