home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 4 / Example 4.10 / mesh.h < prev   
Encoding:
C/C++ Source or Header  |  2006-06-28  |  848 b   |  45 lines

  1. #ifndef _MESH
  2. #define _MESH
  3.  
  4. #include <d3dx9.h>
  5. #include <vector>
  6.  
  7. class MESH
  8. {
  9.     friend class MESHINSTANCE;
  10.     public:
  11.  
  12.         MESH();
  13.         MESH(char fName[], IDirect3DDevice9* Dev);
  14.         ~MESH();
  15.         HRESULT Load(char fName[], IDirect3DDevice9* Dev);
  16.         void Render();
  17.         void Release();
  18.  
  19.     private:
  20.  
  21.         IDirect3DDevice9 *m_pDevice;
  22.         ID3DXMesh *m_pMesh;
  23.         std::vector<IDirect3DTexture9*> m_textures;
  24.         std::vector<D3DMATERIAL9> m_materials;
  25.         D3DMATERIAL9 m_white;
  26. };
  27.  
  28. class MESHINSTANCE{
  29.     public:
  30.         MESHINSTANCE();
  31.         MESHINSTANCE(MESH *meshPtr);
  32.         void Render();
  33.  
  34.         void SetMesh(MESH *m)            {m_pMesh = m;}
  35.         void SetPosition(D3DXVECTOR3 p)    {m_pos = p;}
  36.         void SetRotation(D3DXVECTOR3 r)    {m_rot = r;}
  37.         void SetScale(D3DXVECTOR3 s)    {m_sca = s;}
  38.             
  39.     private:
  40.  
  41.         MESH *m_pMesh;
  42.         D3DXVECTOR3 m_pos, m_rot, m_sca;
  43. };
  44.  
  45. #endif