VisualView.h
Upload User: fjejplh001
Upload Date: 2007-06-11
Package Size: 324k
Code Size: 5k
Category:

3D Graphic

Development Platform:

Visual C++

  1. // VisualView.h : interface of the CVisualView class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_VISUALVIEW_H__45E24C44_3953_49F2_8ECC_DDB348A6F49A__INCLUDED_)
  5. #define AFX_VISUALVIEW_H__45E24C44_3953_49F2_8ECC_DDB348A6F49A__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. enum{black,white,yellow,indigotic,fuchsine,selfdefine};
  10. enum{White,Red,Yellow,Green,Indigotic,Blue,Fuchsine,Black};
  11. enum{A,B,C,D};
  12. class CVisualView : public CView
  13. {
  14. protected: // create from serialization only
  15. CVisualView();
  16. DECLARE_DYNCREATE(CVisualView)
  17. // Attributes
  18. public:
  19. CVisualDoc* GetDocument();
  20. // Operations
  21. public:
  22. CVisualDoc* m_pDoc;
  23. HGLRC m_hRC;  //绘图 RC
  24. CClientDC * m_pDC; //绘图 DC
  25. int m_H;//窗口高度
  26. int m_W;//窗口宽度
  27.   float m_Fovy;//视角大小
  28. float m_Distance;//视点离坐标原点距离
  29. int    m_Viewport[4];  //记录视区变换的四个参数
  30. double m_ModelViewMatrix[16];//记录物体变换的矩阵
  31. double m_ProjectionMatrix[16];//记录投影变换的矩阵
  32. GLfloat m_RotateX; GLfloat m_RotateY; GLfloat m_RotateZ; //控制图形旋转变量
  33. GLfloat m_TranslateX; GLfloat m_TranslateY; GLfloat m_TranslateZ; //控制图形平移变量
  34. GLfloat m_ScaleX; GLfloat m_ScaleY; GLfloat m_ScaleZ; //控制图形缩放变量
  35. GLfloat m_ClipX; GLfloat m_ClipY; GLfloat m_ClipZ;
  36. GLfloat m_Clipd; GLfloat m_ClipPlane; //控制图形切片变量
  37. GLfloat m_ColorRed; GLfloat m_ColorGreen; GLfloat m_ColorBlue; //控制视图背景颜色变量
  38. int     m_BackgroundColor; //控制视图背景颜色变量
  39. int     m_LineWidth; //控制图形线宽变量
  40. int     m_ModelColor; //控制模型颜色变量
  41. BOOL    m_bStressModel; //控制模型应力模式显示与否
  42. BOOL    m_bStressParameters; //控制模型应力图示显示与否
  43. BOOL  m_bAutoRX; BOOL  m_bAutoRY; BOOL  m_bAutoRZ; //控制图形自动旋转演示与否
  44. // Overrides
  45. // ClassWizard generated virtual function overrides
  46. //{{AFX_VIRTUAL(CVisualView)
  47. public:
  48. virtual void OnDraw(CDC* pDC);  // overridden to draw this view
  49. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  50. protected:
  51. virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
  52. virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
  53. virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
  54. virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
  55. //}}AFX_VIRTUAL
  56. // Implementation
  57. public:
  58. void ControlNormal(GLdouble *dVertex1, GLdouble *dVertex2, GLdouble *dVertex3, GLdouble *dNormal);
  59. void DrawCube(double L,double W,double H);
  60. double GetFovy(double height, double distance);
  61. virtual ~CVisualView();
  62. #ifdef _DEBUG
  63. virtual void AssertValid() const;
  64. virtual void Dump(CDumpContext& dc) const;
  65. #endif
  66. protected:
  67. // Generated message map functions
  68. protected:
  69. void ControlModelColor();
  70. void ControlClip();
  71. void ControlStressParameters();
  72. void ControlLighting();
  73. void ControlMaterials();
  74. void ControlLineWidth();
  75. void ControlGuise();
  76. BOOL VisualPixelFormat();
  77. void VisualInit();
  78. //{{AFX_MSG(CVisualView)
  79. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  80. afx_msg void OnDestroy();
  81. afx_msg void OnSize(UINT nType, int cx, int cy);
  82. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  83. afx_msg void OnAntialias();
  84. afx_msg void OnFill();
  85. afx_msg void OnWireframe();
  86. afx_msg void OnRotateX1();
  87. afx_msg void OnRotateX2();
  88. afx_msg void OnRotateY1();
  89. afx_msg void OnRotateY2();
  90. afx_msg void OnRotateZ1();
  91. afx_msg void OnRotateZ2();
  92. afx_msg void OnScale1();
  93. afx_msg void OnScale2();
  94. afx_msg void OnTranslateX1();
  95. afx_msg void OnTranslateX2();
  96. afx_msg void OnTranslateY1();
  97. afx_msg void OnTranslateY2();
  98. afx_msg void OnTranslateZ1();
  99. afx_msg void OnTranslateZ2();
  100. afx_msg void OnToHome();
  101. afx_msg void OnLinewidthA();
  102. afx_msg void OnUpdateLinewidthA(CCmdUI* pCmdUI);
  103. afx_msg void OnLinewidthB();
  104. afx_msg void OnUpdateLinewidthB(CCmdUI* pCmdUI);
  105. afx_msg void OnLinewidthC();
  106. afx_msg void OnUpdateLinewidthC(CCmdUI* pCmdUI);
  107. afx_msg void OnLinewidthD();
  108. afx_msg void OnUpdateLinewidthD(CCmdUI* pCmdUI);
  109. afx_msg void OnAxis();
  110. afx_msg void OnLighting();
  111. afx_msg void OnTimer(UINT nIDEvent);
  112. afx_msg void OnAutoRotateZ();
  113. afx_msg void OnAutoRotateX();
  114. afx_msg void OnAutoRotateY();
  115. afx_msg void OnUpdateAutoRotateX(CCmdUI* pCmdUI);
  116. afx_msg void OnUpdateAutoRotateY(CCmdUI* pCmdUI);
  117. afx_msg void OnUpdateAutoRotateZ(CCmdUI* pCmdUI);
  118. afx_msg void OnStressParameters();
  119. afx_msg void OnUpdateStressParameters(CCmdUI* pCmdUI);
  120. afx_msg void OnStressModel();
  121. afx_msg void OnUpdateStressModel(CCmdUI* pCmdUI);
  122. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  123. //}}AFX_MSG
  124. DECLARE_MESSAGE_MAP()
  125. private:
  126. };
  127. #ifndef _DEBUG  // debug version in VisualView.cpp
  128. inline CVisualDoc* CVisualView::GetDocument()
  129.    { return (CVisualDoc*)m_pDocument; }
  130. #endif
  131. /////////////////////////////////////////////////////////////////////////////
  132. //{{AFX_INSERT_LOCATION}}
  133. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  134. #endif // !defined(AFX_VISUALVIEW_H__45E24C44_3953_49F2_8ECC_DDB348A6F49A__INCLUDED_)