2018-04-01 12:43:30 +05:30
|
|
|
|
2018-04-02 02:51:12 +05:30
|
|
|
#ifndef DEVIL1GEO_H
|
|
|
|
#define DEVIL1GEO_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#pragma pack(1)
|
2018-04-01 12:43:30 +05:30
|
|
|
struct Header {
|
2018-04-02 02:51:12 +05:30
|
|
|
unsigned char numMesh;
|
|
|
|
unsigned char unknownNumberB;
|
|
|
|
unsigned char unknownNumberC;
|
|
|
|
unsigned char unknownNumberD;
|
2018-04-01 12:43:30 +05:30
|
|
|
uint32_t padding; // <format=hex>
|
2018-04-02 02:51:12 +05:30
|
|
|
uint64_t unknownOffset;
|
2018-04-01 12:43:30 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
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.
|
2018-04-02 02:51:12 +05:30
|
|
|
// this struct is in-order of what the file format will have.
|
2018-04-01 12:43:30 +05:30
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2018-04-02 02:51:12 +05:30
|
|
|
#endif
|
2018-04-01 12:43:30 +05:30
|
|
|
|