/*=========================================================================
*
* Material.h	- Material structures
*
* Version			1.0
* Revision date
*
*=======================================================================*/
#ifndef MATERIAL_H
#define MATERIAL_H 



//--- Includes --------------------------------------------------------

#include "SCR.h"

#include "typedef.h"

#include "color.h"


//--- Structures --------------------------------------------------------

typedef struct GEO_tdstGeometricObject_ GEO_tdstGeometricObject ;
typedef struct GLI_tdstTexture_ GLI_tdstTexture;

// multitextures
typedef struct MLT_tdstMultiTexture_
{
  xString	sName;
  xString	sTexture;
  xString	sOption;
  xString	sLoad;
  xString	sLinarMipMapping;
  xString	sPerspectiveCorrection;
  float		fBlendToColor[3];
  float		fBlendToAlpha;

}
MLT_tdstMultiTexture;

typedef struct MLT_tdstUVComputing_
{
  xString	sName;
  xString	sObject;
  int		iPosUSpeed;
  int		iPosU;
  int		iPosVSpeed;
  int		iPosV;
  int		iAngleSpeed;
  int		iAngleAlpha;
  int		iScaleU;
  int		iScaleV;

}
MLT_tdstUVComputing;

// material
typedef struct MLT_tdstMaterial_
{
	// name
	xString			sName;
	// flags
	BOOL			bAlreadySave;

	// asociated materials
	xString			sNameCMT;
	BOOL			bMaxMaterial;
	long			lSoundType;
	// TEX parameters
	xString			sQuality[100];
	xString			sOn[100];
	xString			sEnable[100];
	int				iVal[4][100];
	xString			sMipMapping;
	xString			sTilingFirst;
	xString			sTilingSecond;
	// VMT parameters
	xString			sBackface;
	xString			sMaterialType;
	MLT_tdstColor	stAmbient;
	MLT_tdstColor	stDiffuse;
	MLT_tdstColor	stSpecular;
	BOOL			bExistAmbient;
	BOOL			bExistDiffuse;
	long			lSpecularExponent;
	xString			sTexture[100];
	float			fTexture1[100];
	long			lTexture;
	long			lCurTexture;
	float			fScroll1[100];
	float			fScroll2[100];
	long			lNbScroll;
// multitextures
	long					lMultiTexture;
	MLT_tdstMultiTexture	stMultiTexture[100];
	long					lUVComputing;
	MLT_tdstUVComputing		stUVComputing[100];
} 
MLT_tdstMaterial;


// game material 
typedef struct MLT_tdstGameMaterial_
{
  xString		sName;
  xString		sNameCMT;
  BOOL			bMaxMaterial;
  long			lSoundType;
} 
MLT_tdstGameMaterial;


//--- Functions ---------------------------------------------------------

// load
extern SCR_tde_Anl_ReturnValue MLT_xLoadGameMaterial	(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType);
extern SCR_tde_Anl_ReturnValue MLT_xLoadMaterial		(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType);
// files
extern void MLT_vSaveGmtFile	(SCR_tdst_File_Description *p_stFile, char *sFileName, void *p_vPtr, SCR_tde_Ntfy_Action xAction);
extern void MLT_vSaveVmtFile	(SCR_tdst_File_Description *p_stFile, char *sFileName, void *p_vPtr, SCR_tde_Ntfy_Action xAction);
extern void MLT_vSaveTexFile	(SCR_tdst_File_Description *p_stFile, char *sFileName, void *p_vPtr, SCR_tde_Ntfy_Action xAction);
// save
extern void MLT_vSaveGameMaterial	(SCR_tdst_File_Description *p_stFile, char *sFileName, void *p_vPtr, SCR_tde_Ntfy_Action xAction);
extern void MLT_vSaveVisualMaterial	(SCR_tdst_File_Description *p_stFile, char *sFileName, void *p_vPtr, SCR_tde_Ntfy_Action xAction);
extern void MLT_vSaveTexture		(SCR_tdst_File_Description *p_stFile, char *sFileName, void *p_vPtr, SCR_tde_Ntfy_Action xAction);
// operations
extern long MLT_vGetCyclingTextNameKey	(char *d_ucFileName);
extern BOOL MLT_vGetNonZeroTextNameKey	(char *d_ucFileName);
extern void MLT_v2LastLetters			(char *d_ucFileName , char *a4_Extend);


#endif //  MATERIAL_H
