home *** CD-ROM | disk | FTP | other *** search
/ Beginning Direct3D Game Programming / Direct3D.iso / directx / dxf / samples / multimedia / direct3d / mfcfog / fog.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-11-04  |  4.4 KB  |  161 lines

  1. //-----------------------------------------------------------------------------
  2. // File: Fog.h
  3. //
  4. // Desc: Header file MFCFog sample app
  5. //
  6. //
  7. // Copyright (c) 1997-2000 Microsoft Corporation. All rights reserved.
  8. //-----------------------------------------------------------------------------
  9. #ifndef FOG_H
  10. #define FOG_H
  11.  
  12. #if _MSC_VER >= 1000
  13. #pragma once
  14. #endif
  15. #ifndef __AFXWIN_H__
  16. #error include 'stdafx.h' before including this file
  17. #endif
  18.  
  19.  
  20.  
  21.  
  22.  
  23. //-----------------------------------------------------------------------------
  24. // Name: class CAppDoc
  25. // Desc: Overridden CDocument class needed for the CFormView
  26. //-----------------------------------------------------------------------------
  27. class CAppDoc : public CDocument
  28. {
  29. protected:
  30.     DECLARE_DYNCREATE(CAppDoc)
  31. };
  32.  
  33.  
  34.  
  35.  
  36. //-----------------------------------------------------------------------------
  37. // Name: class CAppFrameWnd
  38. // Desc: CFrameWnd-based class needed to override the CFormView's window style
  39. //-----------------------------------------------------------------------------
  40. class CAppFrameWnd : public CFrameWnd
  41. {
  42. protected:
  43.     DECLARE_DYNCREATE(CAppFrameWnd)
  44. public:
  45.     virtual BOOL PreCreateWindow( CREATESTRUCT& cs );
  46. };
  47.  
  48.  
  49.  
  50.  
  51. //-----------------------------------------------------------------------------
  52. // Name: class CApp
  53. // Desc: Main MFCapplication class derived from CWinApp.
  54. //-----------------------------------------------------------------------------
  55. class CApp : public CWinApp
  56. {
  57. public:
  58.     //{{AFX_VIRTUAL(CD3DApp)
  59.     virtual BOOL InitInstance();
  60.     virtual BOOL OnIdle( LONG );
  61.     //}}AFX_VIRTUAL
  62.  
  63.     //{{AFX_MSG(CApp)
  64.     //}}AFX_MSG
  65.     DECLARE_MESSAGE_MAP()
  66. };
  67.  
  68.  
  69.  
  70.  
  71. //-----------------------------------------------------------------------------
  72. // Name: class CAppForm
  73. // Desc: CFormView-based class which allows the UI to be created with a form
  74. //       (dialog) resource. This class manages all the controls on the form.
  75. //-----------------------------------------------------------------------------
  76. class CAppForm : public CFormView, public CD3DApplication
  77. {
  78. private:
  79.     BOOL    m_bHiResTerrain;
  80.     BOOL    m_bHiResTerrainOld;
  81.     DWORD   m_dwFogColor;
  82.     DWORD   m_dwFogMode;
  83.     BOOL    m_bCanDoTableFog;
  84.     BOOL    m_bCanDoVertexFog;
  85.     BOOL    m_bCanDoWFog;
  86.     BOOL    m_bDeviceUsesWFog;
  87.     BOOL    m_bRangeBasedFog;
  88.     BOOL    m_bUsingTableFog;
  89.     FLOAT   m_fFogStartSlider;
  90.     FLOAT   m_fFogEndSlider;
  91.     FLOAT   m_fFogStartValue;
  92.     FLOAT   m_fFogEndValue;
  93.     FLOAT   m_fFogDensity;
  94.     HWND    m_hwndRenderWindow;
  95.     HWND    m_hwndRenderFullScreen;
  96.     LPDIRECT3DTEXTURE8      m_pFloorTexture;
  97.     LPDIRECT3DVERTEXBUFFER8 m_pTerrainVB;
  98.     DWORD                   m_dwNumTerrainVertices;
  99.     LPDIRECT3DVERTEXBUFFER8 m_pColumnVB;
  100.     DWORD                   m_dwNumColumnVertices;
  101.  
  102.     HRESULT ConfirmDevice( D3DCAPS8*,DWORD,D3DFORMAT );
  103.     HRESULT OneTimeSceneInit();
  104.     HRESULT InitDeviceObjects();
  105.     HRESULT RestoreDeviceObjects();
  106.     HRESULT FrameMove();
  107.     HRESULT Render();
  108.     HRESULT InvalidateDeviceObjects();
  109.     HRESULT DeleteDeviceObjects();
  110.     HRESULT FinalCleanup();
  111.     virtual HRESULT AdjustWindowForChange();
  112.  
  113.     VOID    UpdateUIForDeviceCapabilites();
  114.     VOID    SetFogParameters();
  115.     HRESULT GenerateTerrainDisk( LPDIRECT3DDEVICE8 pd3dDevice, DWORD dwNumSegments,
  116.                                  FLOAT fScale );
  117.     HRESULT GenerateColumn( LPDIRECT3DDEVICE8 pd3dDevice, DWORD dwNumSegments,
  118.                             FLOAT fRadius, FLOAT fHeight );
  119.  
  120.  
  121. protected:
  122.     DECLARE_DYNCREATE(CAppForm)
  123.  
  124.              CAppForm();
  125.     virtual  ~CAppForm();
  126.  
  127. public:
  128.     BOOL IsReady() { return m_bReady; }
  129.     TCHAR* PstrFrameStats() { return m_strFrameStats; }
  130.     VOID RenderScene() { Render3DEnvironment(); }
  131.     HRESULT CheckForLostFullscreen();
  132.  
  133.     //{{AFX_DATA(CAppForm)
  134.     enum { IDD = IDD_FORMVIEW };
  135.     //}}AFX_DATA
  136.  
  137.     //{{AFX_VIRTUAL(CAppForm)
  138.     virtual void OnInitialUpdate();
  139.     //}}AFX_VIRTUAL
  140.  
  141.     //{{AFX_MSG(CAppForm)
  142.     afx_msg void OnToggleFullScreen();
  143.     afx_msg void OnChangeDevice();
  144.     afx_msg void OnHScroll( UINT, UINT, CScrollBar* );
  145.     afx_msg void OnFogColor();
  146.     afx_msg void OnRangeBasedFog();
  147.     afx_msg void OnVertexFog();
  148.     afx_msg void OnTableFog();
  149.     afx_msg void OnFogMode();
  150.     afx_msg void OnTerrainResolution();
  151.     //}}AFX_MSG
  152.     DECLARE_MESSAGE_MAP()
  153. };
  154.  
  155.  
  156.  
  157.  
  158. #endif
  159.  
  160.  
  161.