#ifndef __LUXINIA_MESH_VERTEX_H__
#define __LUXINIA_MESH_VERTEX_H__

#ifdef __cplusplus
extern "C" {
#endif

typedef enum VertexType_e{
	VERTEX_32_TEX2 = 0,		// 2 texcoords, color
	VERTEX_32_NRM,			// 1 tecoord, normal, color
	VERTEX_32_FN,			// float normals, no color
	VERTEX_32_TERR,	
	VERTEX_64_TEX4,			// 4 texcoords, tangent, normal, color
	VERTEX_64_SKIN,			// 2 texcoords, tangent, normal, color, blending
	VERTEX_16_HOM,			// homogenous coord, no color
	VERTEX_16_CLR,			// color
	VERTEX_16_TERR,
	VERTEX_LASTTYPE
}VertexType_t;


typedef struct Vertex16Color_s{
	float			pos[3];
	unsigned char	color[4];
}Vertex16Color_t;

typedef struct Vertex16Hom_s{
	float			pos[4];
}Vertex16Hom_t;

typedef struct Vertex16Terrain_s{
	unsigned char	tangent[4];
	unsigned char	normal[4];

	short			pos[4];
}Vertex16Terrain_t;

typedef struct Vertex32Terrain_s{
	short			tangent[4];
	short			normal[4];

	float			pos[3];
	unsigned char	color[4];
}Vertex32Terrain_t;

typedef struct Vertex32Nrm_s{
	float			tex[2];	
	short			normal[4];

	float			pos[3];
	unsigned char	color[4];
}Vertex32Nrm_t;

typedef struct Vertex32Tex2_s{
	float			tex[2];	
	float			tex1[2];

	float			pos[3];
	unsigned char	color[4];
}Vertex32Tex2_t;

typedef struct Vertex32FN_s{
	float			pos[3];
	float			normal[3];
	float			tex[2];
}Vertex32FN_t;

typedef struct Vertex64Tex4_s{	
	float			tex[2];
	float			tex1[2];
	float			tex2[2];
	float			tex3[2];
	short			normal[4];
	short			tangent[4];
	float			pos[3];
	unsigned char	color[4];
}Vertex64Tex4_t;

typedef struct Vertex64Skin_s{	
	float			tex[2];
	float			tex1[2];
	unsigned char	seccolor[4];
	unsigned char	blendi[4];
	unsigned short	blendw[4];
	short			normal[4];
	short			tangent[4];
	float			pos[3];
	unsigned char	color[4];
}Vertex64Skin_t;

//////////////////////////////////////////////////////////////////////////
// Internal Types (unions, colorcompact)

typedef struct Vertex16_s{
	float		pos[3];
	union{
		unsigned char	color[4];
		unsigned int	colorc;
		float			posw;
	};
}Vertex16_t;

typedef struct Vertex32_s{
	float		tex[2];		// base
	union{
		float	tex1[2];	// lightmap
		short	normal[4];	// normal
	};

	float		pos[3];
	union{
		unsigned char	color[4];
		unsigned int	colorc;
	};
}Vertex32_t;


// Warning gl_terrain depends on this order and f3d version >=250
typedef struct Vertex64_s{	
	float		tex[2];
	float		tex1[2];
	union{
		struct{
			float	tex2[2];
			float	tex3[2];
		};
		struct{
			unsigned char	seccolor[4];
			unsigned char	blendi[4];
			unsigned short	blendw[4];
		};
	};

	short		normal[4];
	short		tangent[4];
	float		pos[3];
	union{
		unsigned char	color[4];
		unsigned int	colorc;
	};
}Vertex64_t;

#ifdef __cplusplus
}
#endif

#endif
