#ifndef AI_MDLFILEHELPER_H_INC
#define AI_MDLFILEHELPER_H_INC
+#include <assimp/anim.h>
+#include <assimp/mesh.h>
+#include <assimp/Compiler/pushpack1.h>
#include "ByteSwapper.h"
-#include "./../include/assimp/anim.h"
-#include "./../include/assimp/mesh.h"
-#include "./../include/assimp/Compiler/pushpack1.h"
#include <stdint.h>
#include <vector>
#define AI_MDL_MAGIC_NUMBER_BE_GS7 AI_MAKE_MAGIC("MDL7")
#define AI_MDL_MAGIC_NUMBER_LE_GS7 AI_MAKE_MAGIC("7LDM")
-
// common limitations for Quake1 meshes. The loader does not check them,
// (however it warns) but models should not exceed these limits.
#if (!defined AI_MDL_VERSION)
/** \struct Header
* \brief Data structure for the MDL main header
*/
-struct Header
-{
+struct Header {
//! magic number: "IDPO"
uint32_t ident;
//! Could be the total size of the file (and not a float)
float size;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Header_MDL7
* \brief Data structure for the MDL 7 main header
*/
-struct Header_MDL7
-{
+struct Header_MDL7 {
//! magic number: "MDL7"
char ident[4];
//! Size of the Frame_MDL7 data structure used in the file
uint16_t frame_stc_size;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Bone_MDL7
* \brief Data structure for a bone in a MDL7 file
*/
-struct Bone_MDL7
-{
+struct Bone_MDL7 {
//! Index of the parent bone of *this* bone. 0xffff means:
//! "hey, I have no parent, I'm an orphan"
uint16_t parent_index;
//! Optional name of the bone
char name[1 /* DUMMY SIZE */];
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
#if (!defined AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_20_CHARS)
# define AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_20_CHARS (16 + 20)
/** \struct Group_MDL7
* \brief Group in a MDL7 file
*/
-struct Group_MDL7
-{
+struct Group_MDL7 {
//! = '1' -> triangle based Mesh
unsigned char typ;
//! Number of frames
int32_t numframes;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
#define AI_MDL7_SKINTYPE_MIPFLAG 0x08
#define AI_MDL7_SKINTYPE_MATERIAL 0x10
/** \struct Deformer_MDL7
* \brief Deformer in a MDL7 file
*/
-struct Deformer_MDL7
-{
+struct Deformer_MDL7 {
int8_t deformer_version; // 0
int8_t deformer_typ; // 0 - bones
int8_t _unused_[2];
int32_t group_index;
int32_t elements;
int32_t deformerdata_size;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct DeformerElement_MDL7
* \brief Deformer element in a MDL7 file
*/
-struct DeformerElement_MDL7
-{
+struct DeformerElement_MDL7 {
//! bei deformer_typ==0 (==bones) element_index == bone index
int32_t element_index;
char element_name[AI_MDL7_MAX_BONENAMESIZE];
int32_t weights;
-} PACK_STRUCT;
-
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct DeformerWeight_MDL7
* \brief Deformer weight in a MDL7 file
*/
-struct DeformerWeight_MDL7
-{
+struct DeformerWeight_MDL7 {
//! for deformer_typ==0 (==bones) index == vertex index
int32_t index;
float weight;
-} PACK_STRUCT;
-
+} /* PACK_STRUCT */;
// don't know why this was in the original headers ...
typedef int32_t MD7_MATERIAL_ASCDEFSIZE;
/** \struct ColorValue_MDL7
* \brief Data structure for a color value in a MDL7 file
*/
-struct ColorValue_MDL7
-{
+struct ColorValue_MDL7 {
float r,g,b,a;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Material_MDL7
* \brief Data structure for a Material in a MDL7 file
*/
-struct Material_MDL7
-{
+struct Material_MDL7 {
//! Diffuse base color of the material
ColorValue_MDL7 Diffuse;
//! Phong power
float Power;
-} PACK_STRUCT;
-
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Skin
* \brief Skin data structure #1 - used by Quake1, MDL2, MDL3 and MDL4
*/
-struct Skin
-{
+struct Skin {
//! 0 = single (Skin), 1 = group (GroupSkin)
//! For MDL3-5: Defines the type of the skin and there
//! fore the size of the data to skip:
//! Texture data
uint8_t *data;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
* \brief Skin data structure #2 - used by MDL5, MDL6 and MDL7
* \see Skin
*/
-struct Skin_MDL5
-{
+struct Skin_MDL5 {
int32_t size, width, height;
uint8_t *data;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// maximum length of texture file name
#if (!defined AI_MDL7_MAX_TEXNAMESIZE)
/** \struct Skin_MDL7
* \brief Skin data structure #3 - used by MDL7 and HMP7
*/
-struct Skin_MDL7
-{
+struct Skin_MDL7 {
uint8_t typ;
int8_t _unused_[3];
int32_t width;
int32_t height;
char texture_name[AI_MDL7_MAX_TEXNAMESIZE];
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct RGB565
* \brief Data structure for a RGB565 pixel in a texture
*/
-struct RGB565
-{
+struct RGB565 {
uint16_t r : 5;
uint16_t g : 6;
uint16_t b : 5;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct ARGB4
* \brief Data structure for a ARGB4444 pixel in a texture
*/
-struct ARGB4
-{
+struct ARGB4 {
uint16_t a : 4;
uint16_t r : 4;
uint16_t g : 4;
uint16_t b : 4;
-} PACK_STRUCT;
+} /*PACK_STRUCT*/;
// -------------------------------------------------------------------------------------
/** \struct GroupSkin
* \brief Skin data structure #2 (group of pictures)
*/
-struct GroupSkin
-{
+struct GroupSkin {
//! 0 = single (Skin), 1 = group (GroupSkin)
int32_t group;
//! Data of each image
uint8_t **data;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct TexCoord
* \brief Texture coordinate data structure used by the Quake1 MDL format
*/
-struct TexCoord
-{
+struct TexCoord {
//! Is the vertex on the noundary between front and back piece?
int32_t onseam;
//! Texture coordinate in the ty direction
int32_t t;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct TexCoord_MDL3
* \brief Data structure for an UV coordinate in the 3DGS MDL3 format
*/
-struct TexCoord_MDL3
-{
+struct TexCoord_MDL3 {
//! position, horizontally in range 0..skinwidth-1
int16_t u;
//! position, vertically in range 0..skinheight-1
int16_t v;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct TexCoord_MDL7
* \brief Data structure for an UV coordinate in the 3DGS MDL7 format
*/
-struct TexCoord_MDL7
-{
+struct TexCoord_MDL7 {
//! position, horizontally in range 0..1
float u;
//! position, vertically in range 0..1
float v;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct SkinSet_MDL7
//! Material index
int32_t material; // size 4
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Triangle
//! Vertex indices
int32_t vertex[3];
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Triangle_MDL3
//! Index of 3 skin vertices in range 0..numskinverts
uint16_t index_uv[3];
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Triangle_MDL7
//! Two skinsets. The second will be used for multi-texturing
SkinSet_MDL7 skinsets[2];
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
#if (!defined AI_MDL7_TRIANGLE_STD_SIZE_ONE_UV)
# define AI_MDL7_TRIANGLE_STD_SIZE_ONE_UV (6+sizeof(SkinSet_MDL7)-sizeof(uint32_t))
{
uint8_t v[3];
uint8_t normalIndex;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
uint8_t norm162index;
float norm[3];
};
-} PACK_STRUCT;
-
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct BoneTransform_MDL7
//! I HATE 3DGS AND THE SILLY DEVELOPER WHO DESIGNED
//! THIS STUPID FILE FORMAT!
int8_t _unused_[2];
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
#define AI_MDL7_MAX_FRAMENAMESIZE 16
-
// -------------------------------------------------------------------------------------
/** \struct Frame_MDL7
* \brief Frame data structure used by MDL7 files
//! Vertex list of the frame
Vertex *verts;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Frame
//! Frame data
SimpleFrame frame;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
//! Vertex list of the frame
Vertex_MDL4 *verts;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct GroupFrame
//! List of single frames
SimpleFrame *frames;
-} PACK_STRUCT;
+} /* PACK_STRUCT */;
#include "./../include/assimp/Compiler/poppack1.h"
/** \struct IntFace_MDL7
* \brief Internal data structure to temporarily represent a face
*/
-struct IntFace_MDL7
-{
+struct IntFace_MDL7 {
// provide a constructor for our own convenience
IntFace_MDL7()
{