Redline/source/modeltypes.h

78 lines
2.1 KiB
C
Raw Normal View History

//modeltypes.h
//type definitions for 3d models
#ifndef __MODELTYPES
#define __MODELTYPES
#include "transparency.h"
#include <OpenGL/gl.h>
#define kDisableTransparencyFlag 0x80000000
#define kMaterialMask (~kDisableTransparencyFlag)
#define kFlagShadowFlag 1<<0
#define kFlagMultiTextureFlag 1<<1
//one vertex of a model's face.
typedef struct{
int vertex; //the index of the actual vertex coordinates
int normal; //the index of the vertex normal (or -1 for none)
int texel; //the index of the texture coordinates
int neighbor;//the index of the face sharing the edge belonging to this vertex (or -1 for none)
} tFaceVertex;
//one face of a model
typedef struct{
int material;
tFaceVertex vertices[3];
} tFaceData;
//one vertex of a model's face.
typedef struct{
int vertex; //the index of the actual vertex coordinates
int normal; //the index of the vertex normal (or -1 for none)
int texel,texel2; //the index of the texture coordinates
int neighbor;//the index of the face sharing the edge belonging to this vertex (or -1 for none)
} tFaceVertexMT;
//one face of a model
typedef struct{
int material;
tFaceVertexMT vertices[3];
} tFaceDataMT;
//the model data structure
typedef struct{
int vertexCount,normalCount,texelCount,faceCount,materialCount;//number of vertices,normal, etc... used
int modelFlags; //model flags
float maxExtends; //the distance between the farest vertex and the point (0,0,0)
char data[1]; //the actual model data:
// -vertexCount vertices as tVector3
// -normalCount normals as tVector3
// -texelCount texels as tVector2
// -faceCount faces as tFaceData
// -materialCount materials as tMaterial
} tModelData;
//a model's material structure
typedef struct{
char texName[32];//the filename of the texture used.
tPolyMaterial m;//and the material structure
}tMaterial;
typedef struct{
int start,num,numTransparent;
} tMaterialArrayIndices;
//a pointer to the model data and a GL display list reference
typedef struct{
GLuint arrayRef,ref;
tMaterialArrayIndices *indices;
tVertexArrayElement *array;
tModelData *data;
tVector3 center;
float centerMaxExtends;
}tModel;
#endif