Cuboid.h
上传用户:whgydz
上传日期:2007-01-12
资源大小:2259k
文件大小:1k
源码类别:

其他书籍

开发平台:

HTML/CSS

  1. // Cuboid.h: interface for the CCuboid class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_CUBOID_H__AE25AF5F_AE56_48F5_99DC_47CAAA14F245__INCLUDED_)
  5. #define AFX_CUBOID_H__AE25AF5F_AE56_48F5_99DC_47CAAA14F245__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include <d3dx8.h>
  10. #include "Helper.h"
  11. //Define a FVF for our cubiods
  12. #define CUBIOD_D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE)
  13. class CCuboid  
  14. {
  15. public:
  16. bool SetPosition(float x, float y, float z);
  17. bool SetSize(float rWidth, float rHeight, float rDepth);
  18. bool Render();
  19. CCuboid(LPDIRECT3DDEVICE8 pD3DDevice);
  20. virtual ~CCuboid();
  21. private:
  22. bool UpdateVertices();
  23. HRESULT CreateVertexBuffer();
  24. LPDIRECT3DDEVICE8 m_pD3DDevice;
  25. LPDIRECT3DVERTEXBUFFER8 m_pVertexBuffer;
  26. float m_rWidth;
  27. float m_rHeight;
  28. float m_rDepth;
  29. float m_rX;
  30. float m_rY;
  31. float m_rZ;
  32. //Define a custom vertex for our cubiods
  33. struct CUBIOD_CUSTOMVERTEX
  34. {
  35. FLOAT x, y, z;
  36. DWORD colour;
  37. };
  38. };
  39. #endif // !defined(AFX_CUBOID_H__AE25AF5F_AE56_48F5_99DC_47CAAA14F245__INCLUDED_)