/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////*****************************************************************************************************////////////////
///////////////** 																									**///////////////
//////////////**								~ Zoo Engine (Moteur 3D pour SCOL) ~								 **//////////////
/////////////**											  ~ version 1.0 ~											  **/////////////
/////////////**																										  **/////////////
//////////////**										par Pacôme DANHIEZ		  									 **//////////////
///////////////** 																									**///////////////
////////////////*****************************************************************************************************////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///																																  ///
///		FICHIER :	ZooStd.h																									  ///
///																																  ///
///		NATURE	:	Lecture et enregistrement d'un fichier au format M3D														  ///
///																																  ///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////




#ifndef __ZOOSTD_H__
#define __ZOOSTD_H__



#pragma warning (disable:4786)


#include	<stdlib.h>
#include	<stdio.h>
#include	<math.h>			// math functions (sin, cos, etc.)

#include	<string>
using		std::string;
#include	<vector>
using		std::vector;



#include	<assert.h>


#ifndef ASSERT
	#define	ASSERT				assert
#endif

#define DELETEARRAY(x)		if (x) { delete []x;		x = NULL; }
#define CHECKALLOC(x)		if(!x) { return false;}



#include	"..\Basic\ZooNode.h"
#include	"..\Datas\ZooData.h"
#include	"..\Basic\ZooMatrix.h"




#include	<windows.h>
#include	<GL/gl.h>
#include	<GL/glu.h>
//#include	<GL/glaux.h>


#include	"..\Basic\ZooArray.h"
#include	"..\Basic\ZooMalloc.h"
#include "../scol/objstr.h"



//#define			_SUPPORT_ASM_			1
//#define			_SHOW_NORMALS_			1
//#define			_INFO_SCREEN_			1
//#define			_BLENDING_CONTROL_		1
//#define				_BENCH_SOFT_		1



#ifdef	_INFO_SCREEN_

#include  "commctrl.h"

extern HTREEITEM	selectedITEM;
extern HWND			TreeGraph;
extern HWND			TreeDatas;
extern HWND			mainInfoWND;
extern HGLRC		mainInfoRC;
extern HDC			mainInfoDC;
extern int			mainInfoWW;
extern int			mainInfoWH;
extern int			mainMouseX, mainMouseY;
extern HINSTANCE	hInstINFO;
extern bool			keysPressed[256];

extern int			InfoScreenHH;
extern int			InfoStaticHH;
extern int			InfoTreeHH;
extern int			InfoMouseHH;

extern int			focusInfo;


#endif



// MATERIAL's types
#define		RENDER_TEXTURED				(1)
#define		RENDER_TEXTURED_BIS			(1<<7)

#define		RENDER_LIGHTED				(1<<3)	
#define		RENDER_GOURAUD_LIGHT		(1<<1)	

#define		RENDER_COLOR1				(1<<8)			
#define		RENDER_COLOR2				(1<<5)
#define		RENDER_COLOR_VERTEX			(1<<6)

#define		RENDER_TRANSP				(1<<2)	
#define		RENDER_ENVMAP				(1<<4)	

#define		MAXIMUM_MODE				(1<<9)				// DETECTION DU MODE MAXIMAL !!!


// LIGHT's types
#define		LIGHT_AMBIENT	0
#define		LIGHT_PARA		1
#define		LIGHT_OMNI		2
#define		LIGHT_SPOT		3


// ANIMATION's types
#define		ANIM_POS		1
#define		ANIM_ANG		2
#define		ANIM_TOP		4


// Node's types
#define		OBJ_TYPE_ID		0
#define		CAM_TYPE_ID		1
#define		LGH_TYPE_ID		2
#define		SHL_TYPE_ID		3
#define		COL_TYPE_ID		4
#define		SPR_TYPE_ID		5
#define		ANI_TYPE_ID		6
#define		PCL_TYPE_ID		7
#define		SND_TYPE_ID		8

#define		MAX_NODE_SCENE	8

#define		MSH_TYPE_ID		10
#define		PRS_TYPE_ID		11

#define		TEX_TYPE_ID		12
#define		MAT_TYPE_ID		13

#define		FNT_TYPE_ID		14

#define		PCLDEF_TYPE_ID	15
#define		PCLEFF_TYPE_ID	16

#define		MAXIMUM_NODE_ID	17



#define		WLD_TYPE_ID		20
#define		MAT_COLL_ID		21
#define		TEX_COLL_ID		22
#define		GBC_COLL_ID		23
#define		MSH_COLL_ID		24
#define		PRS_COLL_ID		25
#define		ANI_COLL_ID		26
#define		FNT_COLL_ID		27
#define		PCL_COLL_ID		28 




#define		CONST_TEX_COORD_SHIFT		256.0f
#define		CONST_TEX_COORD				255.0f
#define		CONST_COLOR					255.0f
#define		CONST_VAL8					255.0f
#define		CONST_ANGLE					65536.0f

#define		CONST_ALPHA_TEST			0.7f

#define		RANGE_INFINITY				-10


#define		MY_PI 3.14159265358979323846f



#define		AROUNDINT(x)	(	(((x)-floor(x)) < (ceil(x)-(x))) ? ((int)floor(x)) : ((int)ceil(x))		)



///////////////////////////////////
///		FENETRE OpenGL MERE		///
///////////////////////////////////
extern int			mainPIXELFORMAT;
extern int			mainBPP;
extern int			mainDEPTH;
extern int			mainDBLBUF;
extern bool			userACCEL;


extern int			valDST;
extern int			valSRC;

extern bool			infoP3;
extern bool			infoP4;

extern bool			monClavier[256];


struct RenderBuffer
{
	OBJBITMAP_BUFFER Image;
	int		BPL;
	int		width;
	int		height;
};




typedef union 
{
	float	f;
	int		d;
} CELL;






// Palette utilisée pour le FOG
//$LB 
#define LOGTABCOL      10
#define TABCOL         1024
#define TABCOL_OFFSET1 256 
#define TABCOL_OFFSET2 512


extern CELL		*Zbuffer;
//$LB 
extern unsigned char	palette24[TABCOL*64*16];









#ifdef		_BENCH_SOFT_
#include	"..\Basic\ZooProfile.h"
class	ZProfile;
extern		ZProfile	*profile;
#endif









#endif

