/*=========================================================================
*
* RLISave.h	- Saving functions for RLI file
*
* Version			1.0
* Revision date
*
*=======================================================================*/
#ifndef RLISAVE_H
#define RLISAVE_H

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

#include "SCR.h"

#include "typedef.h"

#include "color.h"
#include "matrix.h"
#include "geoobj.h"
#include "sprobj.h"			

//----------------------------------------------------------------------

#ifdef _WINDOWS
/********************************************************/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus 
/********************************************************/
#endif //_WINDOWS

	
//--- Globals ---------------------------------------------------------

extern long		g_lLightIndex;


//--- Defines ---------------------------------------------------------

enum {SPHERICAL, AMBIENT, HOTSPOT, PARALLEL};
enum {L_RGB=0, L_PAINT=1, L_ALPHA=2};


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

typedef struct MLT_Light_
{
	xString			sName;				// name
	int				iGeomType;			// SPHERICAL, AMBIENT, ...
	int				iType;				// RGB, PAINT, ALPHA
	int				iRLI;				// affected RLI
	int				iState;				// ON/OFF
	MLT_tdstColor	color;
	float			fNearFar[2]; 
	float			fAlphas[2];
	MLT_tdstMatrix	*Matrix;
	BOOL			bNotCompute;
} 
MLT_Light;


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

// init functions
extern void MLT_vLoadLG2();
extern void MLT_LoadLGT();
extern void MLT_vCreateRLI();
extern void MLT_vDeleteAllLights();
// loading functions
extern SCR_tde_Anl_ReturnValue MLT_xLoadLight		(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType);
extern SCR_tde_Anl_ReturnValue MLT_xLoadMatrixRLI	(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType);
// compute functions
extern void MLT_vComputeFullRLI			(MLT_tdstGeometricObject *obj, MLT_tdstColor *rli);
extern void MLT_vComputeSphericalRLI	(MLT_tdstMatrix *p_stMatrix, MLT_Light *light, MLT_tdstGeometricObject *obj, MLT_tdstColor *rli);
extern void MLT_vComputeAmbientRLI		(MLT_tdstMatrix *p_stMatrix, MLT_Light *light, MLT_tdstGeometricObject *obj, MLT_tdstColor *rli);
extern void MLT_vComputeHotSpotRLI		(MLT_tdstMatrix *p_stMatrix, MLT_Light *light, MLT_tdstGeometricObject *obj, MLT_tdstColor *rli);
extern void MLT_vComputeParallelRLI		(MLT_tdstMatrix *p_stMatrix, MLT_Light *light, MLT_tdstGeometricObject *obj, MLT_tdstColor *rli);
extern void MLT_vComputeOneRLI			(MLT_tdxHandleToSuperObject hSupObj, MLT_tdstMatrix *p_stMatrix, MLT_tdstColor **rli, int nRLI, SCR_tdst_File_Description *p_stFile);
// light functions
extern int  MLT_iGetLightType	(char *type);
extern void MLT_vAddLightEffect	(MLT_tdstColor *dst, MLT_tdstColor *src, float coef);
// level functions
extern MLT_Light *	MLT_hGetLight		(xString sStaticLight, MLT_Light **g_hLights);
extern void			MLT_vComputeSector	(MLT_tdxHandleToSuperObject hSupObj);


#ifdef _WINDOWS
/********************************************************/
#ifdef __cplusplus
}
#endif // __cplusplus 
/********************************************************/
#endif //_WINDOWS

#endif // RLISAVE_H
