#ifndef __TRANSPARENCY
#define __TRANSPARENCY

#include "vectors.h"
#include "fileio.h"

enum{
	kMaterialBothSides=1<<0,
	kMaterialUseAlphaChannel=1<<1,
	kMaterialSphereMap=1<<2,
	kMaterialDisableWrap=1<<3,
	kMaterialAlphaTest=1<<4,
	kMaterialDisableShadow=1<<5,
	kMaterialDisableWrapS=1<<6,
	kMaterialDisableWrapT=1<<7,
	kMaterialEnableGlow=1<<8,
	//kMaterialBlurMap=1<<9,
	kMaterialEnableShine=1<<10,
	kMaterialDisableLighting=1<<11,
	kMaterialMoveUVs=1<<12
};

typedef struct{
	int numTextures;
	tFileRef *texRefs;
} tTexRefRecord;

typedef struct{
	tFileRef texRef;
	int flags;
	float shininess;
	tVector3 specular,ambient,diffuse;
}tPolyMaterial;

typedef struct{
	tVector2 texel;
	tVector3 normal,vertex;
	tVector2 texel2;
} tVertexArrayVertex;

typedef tVertexArrayVertex tVertexArrayElement[3];

typedef struct{
	tVertexArrayElement v;
	int textureSet;
	int ghost;
	float glow,blur;
	tPolyMaterial *mat;
}tTransparentPoly;

extern float gTunnelFactor,gGlowFactor,gShineFactor,gBlurMapFactor;
extern int gGhostShine;

void InitTransparency();
void DrawTransparentPolys(tVector3 *clipPlanes);
tTransparentPoly* GetNextTransparentPoly(int allocateMaterial);
int UseMaterial(tPolyMaterial *mat,int allowTransparency,int textureSet);
void UseMaterial2(tPolyMaterial *mat,tPolyMaterial *mat2,int textureSet);

#endif