3DView.h
上传用户:kelijie
上传日期:2007-01-01
资源大小:123k
文件大小:2k
源码类别:

图形图象

开发平台:

Visual C++

  1. #if !defined(AFX_3DVIEW_H__73B8DC8D_F1E7_11D2_955D_8422F5C00000__INCLUDED_)
  2. #define AFX_3DVIEW_H__73B8DC8D_F1E7_11D2_955D_8422F5C00000__INCLUDED_
  3. #if _MSC_VER >= 1000
  4. #pragma once
  5. #endif // _MSC_VER >= 1000
  6. // 3DView.h : header file
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9. // C3DView view
  10. #include "standard.h"
  11. #include <glgl.h>
  12. #include <glglu.h>
  13. #include <glglaux.h>
  14. #define PI (float)3.1415926
  15. typedef struct
  16. {
  17.     BYTE m_vColor[4];
  18. }dVertex;
  19. typedef struct
  20. {
  21.     float m_vNormal[3];
  22.     float m_vPoint[3];
  23. }dCoord;
  24. #define  ROW   40
  25. #define  COL   40 
  26. class _declspec(dllexport) C3DView : public CStandardView
  27. {
  28. public:
  29. C3DView();           // protected constructor used by dynamic creation
  30. DECLARE_DYNCREATE(C3DView)
  31. // Attributes
  32. public:
  33. dVertex m_Vertex[ROW*COL];
  34. dCoord  m_Point[(ROW+1)*(COL+1)];
  35. float   m_a, m_b, m_c;  
  36. float   m_x, m_y, m_z;
  37. float   m_xa, m_ya, m_za;
  38. BYTE    m_Color1[4];
  39. BYTE    m_Color2[4];
  40. HPALETTE m_hPalette;
  41. HGLRC    m_hRC;
  42. HDC      m_hDC; // Device Context
  43. int      m_iCounter;
  44. int      m_iTimer;
  45. BOOL     m_bTimer;
  46. BOOL     m_bActive;
  47. BOOL     m_iInit;
  48. // Operations
  49. public:
  50. void SetupLogicalPalette(void);
  51. void SetupEnv(void);
  52. void Build3Ddata(void); 
  53. void Draw3DObject(void);
  54. // Overrides
  55. // ClassWizard generated virtual function overrides
  56. //{{AFX_VIRTUAL(C3DView)
  57. public:
  58. virtual void OnDraw(CDC* pDC);      // overridden to draw this view
  59. virtual BOOL DestroyWindow();
  60. protected:
  61. virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
  62. //}}AFX_VIRTUAL
  63. // Implementation
  64. public:
  65. virtual ~C3DView();
  66. #ifdef _DEBUG
  67. virtual void AssertValid() const;
  68. virtual void Dump(CDumpContext& dc) const;
  69. #endif
  70. // Generated message map functions
  71. public:
  72. //{{AFX_MSG(C3DView)
  73. afx_msg void On3dexit();
  74. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  75. afx_msg void OnTimer(UINT nIDEvent);
  76. afx_msg void OnSize(UINT nType, int cx, int cy);
  77. afx_msg void OnSetFocus(CWnd* pOldWnd);
  78. afx_msg void OnKillFocus(CWnd* pNewWnd);
  79. //}}AFX_MSG
  80. DECLARE_MESSAGE_MAP()
  81. };
  82. /////////////////////////////////////////////////////////////////////////////
  83. //{{AFX_INSERT_LOCATION}}
  84. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  85. #endif // !defined(AFX_3DVIEW_H__73B8DC8D_F1E7_11D2_955D_8422F5C00000__INCLUDED_)