www.pudn.com > Direct3D_ZBuffer.zip > Cuboid.h
// Cuboid.h: interface for the CCuboid class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_CUBOID_H__AE25AF5F_AE56_48F5_99DC_47CAAA14F245__INCLUDED_) #define AFX_CUBOID_H__AE25AF5F_AE56_48F5_99DC_47CAAA14F245__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include#include "Helper.h" //Define a FVF for our cubiods #define CUBIOD_D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE) class CCuboid { public: bool SetPosition(float x, float y, float z); bool SetSize(float rWidth, float rHeight, float rDepth); bool Render(); CCuboid(LPDIRECT3DDEVICE8 pD3DDevice); virtual ~CCuboid(); private: bool UpdateVertices(); HRESULT CreateVertexBuffer(); LPDIRECT3DDEVICE8 m_pD3DDevice; LPDIRECT3DVERTEXBUFFER8 m_pVertexBuffer; float m_rWidth; float m_rHeight; float m_rDepth; float m_rX; float m_rY; float m_rZ; //Define a custom vertex for our cubiods struct CUBIOD_CUSTOMVERTEX { FLOAT x, y, z; DWORD colour; }; }; #endif // !defined(AFX_CUBOID_H__AE25AF5F_AE56_48F5_99DC_47CAAA14F245__INCLUDED_)