/** 
 * \file ModelStatic.h
 * \brief Header file containing CModelStatic class - encapsulation class for static meshes.
 * This class enables using static (as oposed to skinned, animated) 3D mesh. It loads x file and manages rendering.
 * 
 * \author Petar Bajic, MPE (C) All Rights Reserved, Homepage: www.mystic-peanut.com
 * \date January, 16 2007.
 */

#include "d3dx9.h"

#ifndef MPE_MODELSTATIC
#define MPE_MODELSTATIC


/**
 * \brief CModelStatic class is used for loading and presenting static 3D models
 *
 * \author Petar Bajic 
 * \date January, 16 2007.
 */
class CModelStatic
{
public:
	CModelStatic();
	~CModelStatic();
	bool Load(LPDIRECT3DDEVICE9 pd3dDevice, WCHAR* strFilePath, WCHAR* strFileName);
	void CModelStatic::OnRender(LPDIRECT3DDEVICE9 pd3dDevice);
	void CModelStatic::OnFrameMove(LPDIRECT3DDEVICE9 pd3dDevice, float rotation, D3DXVECTOR3 position);

	DWORD m_numMaterials;
	D3DXMATRIXA16 m_matWorld;

	//bool m_Alive;
	D3DXVECTOR3 m_Position;

	LPD3DXMESH m_pMesh;
	D3DMATERIAL9* m_pMaterial;
	LPDIRECT3DTEXTURE9* m_pTexture;
};



#ifndef V
#define V(x)           { hr = x; }
#endif
#ifndef V_RETURN
#define V_RETURN(x)    { hr = x; if( FAILED(hr) ) { return hr; } }
#endif

#ifndef SAFE_DELETE
#define SAFE_DELETE(p)       { if(p) { delete (p);     (p)=NULL; } }
#endif    
#ifndef SAFE_DELETE_ARRAY
#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p);   (p)=NULL; } }
#endif    
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p)      { if(p) { (p)->Release(); (p)=NULL; } }
#endif

#endif//MPE_MODELSTATIC