MeshView.h
Upload User: hcfgz168
Upload Date: 2011-09-11
Package Size: 116k
Code Size: 3k
Category:

OpenGL program

Development Platform:

WINDOWS

  1. // MeshView.h : interface of the CMeshView class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_MESHVIEW_H__50ED6A32_C0C1_11D2_B4C7_006067306B48__INCLUDED_)
  5. #define AFX_MESHVIEW_H__50ED6A32_C0C1_11D2_B4C7_006067306B48__INCLUDED_
  6. #if _MSC_VER >= 1000
  7. #pragma once
  8. #endif // _MSC_VER >= 1000
  9. class CMeshView : public CView
  10. {
  11. protected: // create from serialization only
  12. CMeshView();
  13. DECLARE_DYNCREATE(CMeshView)
  14. // Attributes
  15. public:
  16. CMeshDoc* GetDocument();
  17. // OpenGL specific
  18. BOOL SetWindowPixelFormat(HDC hDC);
  19. BOOL CreateViewGLContext(HDC hDC);
  20. HGLRC m_hGLContext;
  21. int m_GLPixelIndex;
  22. void SetClearColor(void) { glClearColor(m_ClearColorRed,m_ClearColorGreen,m_ClearColorBlue,1.0f); }
  23. unsigned char *SnapClient(CSize *pSize);
  24. // Mouse 
  25. BOOL m_LeftButtonDown;
  26. BOOL m_RightButtonDown;
  27. CPoint m_LeftDownPos;
  28. CPoint m_RightDownPos;
  29. HCURSOR m_CursorRotation;
  30. // Position, rotation ,scaling
  31. void InitGeometry(void);
  32. float m_xRotation;
  33. float m_yRotation;
  34. float m_zRotation;
  35. BOOL m_xyRotation;
  36. float m_xTranslation;
  37. float m_yTranslation;
  38. float m_zTranslation;
  39. float m_xScaling;
  40. float m_yScaling;
  41. float m_zScaling;
  42. float m_SpeedTranslation;
  43. float m_SpeedRotation;
  44. // Colors
  45. float m_ClearColorRed;
  46. float m_ClearColorGreen;
  47. float m_ClearColorBlue;
  48. // Animation
  49. float m_StepRotationX;
  50. float m_StepRotationY;
  51. float m_StepRotationZ;
  52. // Operations
  53. public:
  54. // Overrides
  55. // ClassWizard generated virtual function overrides
  56. //{{AFX_VIRTUAL(CMeshView)
  57. public:
  58. virtual void OnDraw(CDC* pDC);  // overridden to draw this view
  59. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  60. protected:
  61. virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
  62. virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
  63. virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
  64. virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
  65. //}}AFX_VIRTUAL
  66. // Implementation
  67. public:
  68. virtual ~CMeshView();
  69. #ifdef _DEBUG
  70. virtual void AssertValid() const;
  71. virtual void Dump(CDumpContext& dc) const;
  72. #endif
  73. protected:
  74. // Generated message map functions
  75. protected:
  76. //{{AFX_MSG(CMeshView)
  77. afx_msg void OnPaint();
  78. afx_msg void OnDestroy();
  79. afx_msg void OnSize(UINT nType, int cx, int cy);
  80. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  81. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  82. afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  83. afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
  84. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  85. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  86. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  87. afx_msg void OnEditCopy();
  88. //}}AFX_MSG
  89. DECLARE_MESSAGE_MAP()
  90. };
  91. #ifndef _DEBUG  // debug version in MeshView.cpp
  92. inline CMeshDoc* CMeshView::GetDocument()
  93.    { return (CMeshDoc*)m_pDocument; }
  94. #endif
  95. /////////////////////////////////////////////////////////////////////////////
  96. //{{AFX_INSERT_LOCATION}}
  97. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  98. #endif // !defined(AFX_MESHVIEW_H__50ED6A32_C0C1_11D2_B4C7_006067306B48__INCLUDED_)