Split main.c into separate files and set up directory structure

This commit is contained in:
_
2018-04-01 23:45:30 -07:00
parent 97527f549c
commit f2c827ff6b
5 changed files with 57 additions and 30 deletions

69
include/devil1geo.h Normal file
View File

@@ -0,0 +1,69 @@
#ifndef DEVIL1GEO_H
#define DEVIL1GEO_H
#include <stdint.h>
#pragma pack(1)
struct Header {
unsigned char numMesh;
unsigned char unknownNumberB;
unsigned char unknownNumberC;
unsigned char unknownNumberD;
uint32_t padding; // <format=hex>
uint64_t unknownOffset;
};
struct MeshHeaders {
int16_t numBatch;
int16_t numVertex;
uint32_t u; // <format=hex>
uint64_t offsetBatches;
uint64_t flags;
}; // put these in an array of size: [header.numMesh]
struct Positions {
float x, y, z;
};
struct Normals {
float x, y, z;
};
struct UVs {
int16_t u, v;
};
struct BoneIndexes {
unsigned char indexes[4]; // from ubyte
};
struct BoneWeights {
uint16_t weights; // <format=hex>
};
// This is where most of the parsing will be.
// this struct is in-order of what the file format will have.
struct Batch {
int16_t numVertex;
int16_t uB;
uint32_t padding; // <format=hex>
uint64_t offsetPositions; // <format=hex>
uint64_t offsetNormals; // <format=hex>
uint64_t offsetUVs; // <format=hex>
uint64_t offsetBoneIndexes; // <format=hex>
uint64_t offsetBoneWeights; // <format=hex>
uint64_t offsets[1]; // <format=hex>
int64_t pos; // set while parsing batch from ftell();
// following structs should in an array of size numVertex
struct Positions *p;
struct Normals *n;
struct UVs *u;
struct BoneIndexes *bi;
struct BoneWeights *bw;
};
struct Mesh {
struct Batch b;
};
#endif

18
include/devil1pld.h Normal file
View File

@@ -0,0 +1,18 @@
#ifndef DEVIL1PLD_H
#define DEVIL1PLD_H
#include <stdint.h>
#pragma pack(1)
struct PldHeader {
int32_t numOffset;
// array of numOffset elements
uint32_t *offsets; // <format=hex>
};
// input: a pld header struct.
void showpldh(struct PldHeader *);
// input: contents of the .pld file.
struct PldHeader *getpldh(const char*);
#endif