///*
//	Header file
//	Class: CClothSimul - simulace tkaniny
//	Author: Michal Jirouš
//	Date 11.1.2008
//*/
//
//#ifndef __CLOTHSIMUL_H__
//#define __CLOTHSIMUL_H__
//
//#include "baseentity.h"
//
//const float SILA_PRUZINY	= 0.2f;
//
//class CClothSimul : public CBaseEnvironment
//{
//private:
//	struct ClothRelation;
//	alg::BoundingBox m_pBoundingBox;	//bounding box pres vsechny body tkaniny
//	
//	/* Definuje jeden bod latky */
//	struct ClothPoint
//	{
//		ClothPoint()
//		{
//			x_coord = y_coord = 0.0f;
//			m_bIsColliding = false;
//			m_bMoveAble = true;
//		}
//		bool m_bMoveAble;		//urcuje schopnost bodu pohybovat se
//		bool m_bIsColliding;	//urcuje zda nedojde pri pohybu ke kolizi
//		float x_coord, y_coord;	//texturovaci souradnice
//		Vector core;			//poloha bodu ve scene
//		Vector resultForce;		//vysledny vektor pohybu
//		std::list<ClothRelation*> m_listRelations;	//seznam vsechn vztahu s ostatninimy body
//	};
//	
//	/* Definuje vztah mezi body -> pruzina */
//	struct ClothRelation
//	{
//		ClothPoint *A, *B;		//body pruziny
//		float baseDistance;		//klidova vzdalenost mezi body
//		
//		/* Funkce prepocitava vektor sily v zavislosti na aktualni vzdalenosti bodu */
//		void calculateForce()
//		{
//			Vector direction(A->core[0] - B->core[0], A->core[1] - B->core[1], A->core[2] - B->core[2]);
//			float distance = direction.absolute() - baseDistance;
//			float force = -distance * SILA_PRUZINY;
//			m_vecForce = Vector( direction, force );
//		}
//		Vector m_vecForce;	//vektor pusobici sily pruziny
//	};
//
//	/* Definuje jeden trojuhelnik latky pro vykreslovani */
//	struct ClothTriangle
//	{
//		ClothPoint *points[3];	//tri body
//	};
//
//	std::list<ClothTriangle> m_listTriangles;	//seznam trojuhelniku
//	std::list<ClothRelation*> m_listRelations;	//seznam pruzin
//	std::list<ClothPoint*> m_listPoints;			//seznam bodu
//
//	TextureElement *m_Texture;				//ukazatel na texturu latky
//	std::list<CFan*> m_fanList;		//seznam pusobicich vetru
//	
//	Vector m_vecAxis;			//smer osy X na plose latky
//	Vector m_vecHAxis;			//smer osy Y na plose latky
//	std::string m_sConstraints;		//reteyec urcujici nepohyblive body
//
//	float m_fGravity;			//velikost gravitace
//	float m_fPointDistance;		//vzdalenost mezi body
//	int m_iWidth, m_iHeight;	//pocty bodu ve smeru X a Y
//
//	bool m_bReacting;			//schopnost latky reagovat na sily
//	bool m_bCollide;			//schopnost latky kolidovat s okolim
//	void createClothModel();	//funkce vytvari body, pruziny a trojuhelniky v zavislosti na parametrech
//public:	
//	CClothSimul(int iWidth, int iHeight, float fDistance, TextureElement *t, Vector axis, std::string sConstraint, Vector haxis);
//	void addFan( CFan *f )	{ m_fanList.push_back(f);	}	//funkce pridava novy vitr
//	void compile();								//priprava objektu
//	void run();									//periodicky spoustena funkce, kde se prepocitavaji sily a kolize
//	void draw();								//vykreslovani
//	void decompile();							//priprava ke smazani objektu
//	void onTarget()	{	m_bReacting ^= 1;	};	//funkce volana v pripade pouziti
//	void setParameters( int value );			//nastaveni parametru
//};
//
//#endif
