Addressed compiler warnings for geometry module

This commit is contained in:
_ 2018-04-19 05:42:44 -07:00
parent dd5af2004d
commit 9f614e794c
2 changed files with 37 additions and 26 deletions

View File

@ -73,39 +73,35 @@ struct Mesh {
#pragma pack(pop) #pragma pack(pop)
typedef struct { typedef struct {
// input: pointer to struct
void (* const printheader) (struct Header*); void (* const printheader) (struct Header*);
// input: pointer to struct
void (* const printmeshheader)(struct MeshHeader*); void (* const printmeshheader)(struct MeshHeader*);
// input: pointer to struct
void (* const printbatch) (struct Batch*); void (* const printbatch) (struct Batch*);
// input: pointer to struct
void (* const printcoordinate)(struct Coordinate*, unsigned int); 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**, bool (* const getmeshheader) (struct MeshHeader**,
unsigned int i, unsigned int i,
const char * const); const char * const);
// input: pointer to struct, offset of file data batch is at, file data
bool (* const getbatch) (struct Batch*, bool (* const getbatch) (struct Batch*,
unsigned int offset, unsigned int offset,
const char * const); const char * const);
// input: pointer to struct, order, file data
bool (* const getmesh) (struct Mesh*, bool (* const getmesh) (struct Mesh*,
unsigned int i, unsigned int i,
const char* filename); const char*);
} fn_devil1geo; } fn_devil1geo;
extern fn_devil1geo const 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 #endif

View File

@ -1,6 +1,21 @@
#include "devil1geo.h" #include "devil1geo.h"
#include <stdio.h> #include <stdio.h>
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, fn_devil1geo const DEVIL1GEO = {printgheader,
printmeshheader, printmeshheader,
printmeshbatch, printmeshbatch,
@ -11,13 +26,13 @@ fn_devil1geo const DEVIL1GEO = {printgheader,
static void printgheader(struct Header *gh) { static void printgheader(struct Header *gh) {
if (gh != NULL) { if (gh != NULL) {
printf("pointer %x\n", gh); printf("pointer %p\n", gh);
printf("number of meshes %x\n", gh -> numMesh); printf("number of meshes %x\n", gh -> numMesh);
printf("unknown number B %x\n", gh -> unknownNumberB); printf("unknown number B %x\n", gh -> unknownNumberB);
printf("unknown number C %x\n", gh -> unknownNumberC); printf("unknown number C %x\n", gh -> unknownNumberC);
printf("unknown number D %x\n", gh -> unknownNumberD); printf("unknown number D %x\n", gh -> unknownNumberD);
printf("padding %x\n", gh -> padding); 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 batches %x\n", mh -> numBatch);
printf("number of vertices %x\n", mh -> numVertex); printf("number of vertices %x\n", mh -> numVertex);
printf("unknown %x\n", mh -> u); printf("unknown %x\n", mh -> u);
printf("batch offset %x\n", mh -> offsetBatches); printf("batch offset %lx\n", mh -> offsetBatches);
printf("flags %x\n\n", mh -> flags); printf("flags %lx\n\n", mh -> flags);
} }
static void printmeshbatch(struct Batch *b) { 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("number of vertices %x\n", bd -> numVertex);
printf("unknown byte %x\n", bd -> uB); printf("unknown byte %x\n", bd -> uB);
printf("padding %x\n", bd -> padding); printf("padding %x\n", bd -> padding);
printf("offsetPositions %x\n", bd -> offsetPositions); printf("offsetPositions %lx\n", bd -> offsetPositions);
printf("offsetNormals %x\n", bd -> offsetNormals); printf("offsetNormals %lx\n", bd -> offsetNormals);
printf("offsetUVs %x\n", bd -> offsetUVs); printf("offsetUVs %lx\n", bd -> offsetUVs);
printf("offsetBoneIndexes %x\n", bd -> offsetBoneIndexes); printf("offsetBoneIndexes %lx\n", bd -> offsetBoneIndexes);
printf("offsetBoneWeights %x\n", bd -> offsetBoneWeights); printf("offsetBoneWeights %lx\n", bd -> offsetBoneWeights);
printf("offsets %x\n\n", bd -> offsets[0]); printf("offsets %lx\n\n", bd -> offsets[0]);
printcoordinate(b -> vd.positions, 3); printcoordinate(b -> vd.positions, 3);
} }