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.3 / heightMap3.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-12-04  |  735 b   |  42 lines

  1. #include <d3dx9.h>
  2.  
  3. #define SIZE_X 100
  4. #define SIZE_Y 100
  5.  
  6. #define LEFT 0
  7. #define RIGHT 1
  8. #define UP 2
  9. #define DOWN 3
  10.  
  11. struct PARTICLE{
  12.     D3DXVECTOR3 position;
  13.     D3DCOLOR color;
  14.     static const DWORD FVF;
  15. };
  16.  
  17. struct HEIGHTMAP3
  18. {
  19.     //Functions
  20.     HEIGHTMAP3(IDirect3DDevice9* Dev);
  21.     ~HEIGHTMAP3();
  22.  
  23.     void RaiseTerrain(RECT r, float f);
  24.     void SmoothTerrain();
  25.     HRESULT CreateParticles();
  26.     void Render();
  27.     D3DXVECTOR2 GetCentre(){return D3DXVECTOR2(SIZE_X / 2.0f, SIZE_Y / 2.0f);}
  28.     void MoveRect(int dir);
  29.     
  30.  
  31.     //The actual Heightmap
  32.     float maxHeight;
  33.     float heightMap[SIZE_X][SIZE_Y];
  34.  
  35.     RECT selRect;
  36.  
  37.     //Vertex buffer for points
  38.     IDirect3DVertexBuffer9 *vb;
  39.  
  40.     //Our device
  41.     IDirect3DDevice9* Device; 
  42. };