object.h
上传用户:junlon
上传日期:2022-01-05
资源大小:39075k
文件大小:1k
源码类别:

DirextX编程

开发平台:

Visual C++

  1. //--------------------------------------------------------------------------------------
  2. // File: object.h
  3. //
  4. // 定义了台灯类,包含了台灯模型,台灯光源,和一个相机模型,当按下鼠标左键移动的时候,能转动台灯
  5. //
  6. // Copyright (c) 子墨工作室. All rights reserved.
  7. //--------------------------------------------------------------------------------------
  8. #ifndef __OBJECT__H__INCLUDED__
  9. #define __OBJECT__H__INCLUDED__
  10. class CSpotLight
  11. {
  12. public:
  13. CSpotLight();
  14. ~CSpotLight();
  15. public:
  16. // 导入模型和纹理
  17. HRESULT OnCreateDevice( LPDIRECT3DDEVICE9 pd3dDevice );
  18. /*HRESULT OnResetDevice();
  19. HRESULT OnLostDevice();*/
  20. virtual LRESULT HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  21. void OnDestroyDevice();
  22. // 初始化m_light和m_lightCamera
  23. virtual void InitLight( D3DVECTOR position, D3DVECTOR direction, D3DVECTOR upVec );
  24. virtual void OnRender();
  25. // 调用了相机的FrameMove()函数,以改变相机的朝向状态
  26. void FrameMove( float fElapsedTime );
  27. CFirstPersonCamera m_lightCamera;
  28. D3DLIGHT9 m_light;
  29. protected:
  30. virtual void PreRender();
  31. virtual void PostRender();
  32. ID3DXMesh* m_pMesh;
  33. D3DMATERIAL9* m_pMeshMtrl;
  34. IDirect3DTexture9* m_pTexture;
  35. DWORD m_dwMtrls;
  36. bool m_bDeviceLost;
  37. IDirect3DDevice9* m_pd3dDevice;
  38. };
  39. #endif  // __OBJECT__H__INCLUDED__