Terrain.h
资源名称:3DRPG.rar [点击查看]
上传用户:cjwanglu
上传日期:2013-07-10
资源大小:4744k
文件大小:1k
源码类别:
游戏
开发平台:
Visual C++
- #include <d3dx9.h>
- #define D3DFVF_VERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)//|D3DFVF_NORMAL
- class CTerrain
- {
- private:
- struct VERTEX
- {
- float x,y,z;
- float nx,ny,nz;
- float tu,tv;
- };
- public:
- CTerrain(HINSTANCE hinst,LPDIRECT3DDEVICE9 d3dd);
- virtual ~CTerrain();
- void Translate();
- void RenerTerrain();
- float GetHeight(float x,float z);
- float y;
- DWORD m_dwRow,m_dwCol;
- private:
- D3DXVECTOR3 GetTriangeNormal(D3DXVECTOR3* vV1, D3DXVECTOR3* vV2, D3DXVECTOR3* vV3);
- D3DMATERIAL9 material;
- void SetMaterial();
- void CreateVertex();
- void SetTexture();
- LPDIRECT3DDEVICE9 m_pD3DDevice;
- LPDIRECT3DVERTEXBUFFER9 m_pVb;
- LPDIRECT3DINDEXBUFFER9 m_pIb;
- LPDIRECT3DTEXTURE9 m_pTx;
- float m_fHeight;
- float m_fcell;
- BYTE * m_pHeightData;
- HINSTANCE m_hInst;
- };