#pragma once


class CFace
{
public:
	CFace(unsigned long _I,unsigned long _J,unsigned long _K,
		unsigned long _IUV,unsigned long _JUV,unsigned long _KUV,
		float _nx, float _ny, float _nz);
	unsigned long I,J,K;
	unsigned long IUV,JUV,KUV;
	float nx,ny,nz;
};

class CUV
{
public:
	CUV(float _U,float _V);
	float U,V;
	bool operator==(const CUV& rSrc) const;
};

class CModElem
{
public:
	char					m_name[MAX_FILE_NAME];
	std::vector <CFace>		m_Faces;
	std::vector <CUV>		m_UVs;
	Mtl*					m_material;

	CModElem(char*, Mtl*);
	~CModElem(){m_Faces.clear(); m_UVs.clear();};
};

class CVrtx
{
public:
	double x, y, z;
	double nx, ny, nz;
	CVrtx(double _x,double _y,double _z,double _nx,double _ny,double _nz)
		{x = _x; y = _y; z = _z;nx = _nx; ny = _ny; nz = _nz;};
	bool operator==(const CVrtx& rSrc) const;
};

class CModObject
{
private:
	Mesh*					m_mesh;
	unsigned long			m_nbrFaces;
	int						m_nbrIds  ;
	
	unsigned long			AddVerxt(DWORD _index);
	void					AddFace(MtlID _ElemIndex, 
									unsigned long _i, unsigned long _j, unsigned long _k,
									unsigned long _iUV, unsigned long _jUV, unsigned long _kUV,
									float _nx, float _ny, float _nz);
	unsigned long			AddUV(MtlID _ElemIndex, float _u, float _v);

public:
	BOOL					m_ValidObj;
	std::vector <CModElem*>	m_elements;
	char					m_name[MAX_FILE_NAME];
	unsigned long			m_nbrVrtx;
	std::vector <CVrtx>		m_Vertxs;
	
	CModObject(INode *_node, TimeValue _time);
	~CModObject(void);
};
