ChildView.h
上传用户:lin85885
上传日期:2013-04-27
资源大小:796k
文件大小:4k
- // ChildView.h : interface of the CChildView class
- //
- /////////////////////////////////////////////////////////////////////////////
- #if !defined(AFX_CHILDVIEW_H__BDDF956A_C67B_11D3_91F5_0000E83E7EBA__INCLUDED_)
- #define AFX_CHILDVIEW_H__BDDF956A_C67B_11D3_91F5_0000E83E7EBA__INCLUDED_
- #include "Transform.h"
- #include "Mesh.h"
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #define MOUSE_SPIN 1
- #define MOUSE_TRANSLATE 2
- #define MOUSE_ZOOM 3
- #define TIMER_ANIMATE 1
- #define TIMER_TOOLBAR 2
- #define ANIMATE_RATE 50
- #define TOOLBAR_RATE 20
- #define ROTATE_RATE 4.0f
- #define ZOOM_RATE 0.05f
- /////////////////////////////////////////////////////////////////////////////
- // CChildView window
- class CChildView : public CWnd
- {
- // Construction
- public:
- CChildView();
- // Attributes
- public:
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CChildView)
- protected:
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
- virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
- //}}AFX_VIRTUAL
- // Implementation
- public:
- BOOL SaveAsBMP(char *bmpFileName);
- void DrawAxes();
- void Init();
- void Translate(float d[3]);
- void MouseTranslate(UINT nFlags, int x, int y);
- void MouseZoom(UINT nFlags, int x, int y);
- void Zoom(float scale);
- void MouseSpinGlobal(UINT nFlags, int x, int y, int init);
- void SpinGlobal(float axes[3], float angle);
- void DrawScene();
- void Project();
- virtual ~CChildView();
- protected:
- HDC m_hDc;
- HGLRC m_hRc;
- float m_fViewWidth, m_fViewHeight;
- float m_fViewNear, m_fViewFar;
- BOOL m_bLButtonDown;
- int m_nMouseAct;
- BOOL m_bAnimate;
- BOOL m_bAxes;
- float m_vProjectCenter[3];
- EYE m_sEye;
- float m_spinAxes[3];
- float m_spinAngle;
- int m_nRenderMode,m_nRenderModel;
- CMesh * m_pModel;
- int m_nFaceNo;
- int m_nsFaceNo;
- protected:
- void SetupBmpHeader(BITMAPINFOHEADER *pbmih, int sx, int sy, int bpp);
- BOOL SetThePixelFormat(CDC * pDC);
- // Generated message map functions
- //{{AFX_MSG(CChildView)
- afx_msg void OnPaint();
- afx_msg void OnSize( UINT nType, int cx, int cy );
- afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );
- afx_msg void OnMouseMove( UINT nFlags, CPoint point );
- afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
- afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
- afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
- afx_msg void OnTimer( UINT nIDEvent );
- afx_msg void OnContextMenu( CWnd* pWnd, CPoint pos );
- afx_msg void OnMouseSpin();
- afx_msg void OnUpdateMouseSpin(CCmdUI* pCmdUI);
- afx_msg void OnMouseTranslate();
- afx_msg void OnUpdateMouseTranslate(CCmdUI* pCmdUI);
- afx_msg void OnMouseZoom();
- afx_msg void OnUpdateMouseZoom(CCmdUI* pCmdUI);
- afx_msg void OnAnimate();
- afx_msg void OnUpdateAnimate(CCmdUI* pCmdUI);
- afx_msg void OnSpinXccw();
- afx_msg void OnSpinXcw();
- afx_msg void OnSpinYccw();
- afx_msg void OnSpinYcw();
- afx_msg void OnSpinZccw();
- afx_msg void OnSpinZcw();
- afx_msg void OnZoomIn();
- afx_msg void OnZoomOut();
- afx_msg void OnOpenFile();
- afx_msg void OnOriginalModel();
- afx_msg void OnUpdateOriginalModel(CCmdUI* pCmdUI);
- afx_msg void OnSimplifiedModel();
- afx_msg void OnUpdateSimplifiedModel(CCmdUI* pCmdUI);
- afx_msg void OnWireframe();
- afx_msg void OnUpdateWireframe(CCmdUI* pCmdUI);
- afx_msg void OnFlat();
- afx_msg void OnUpdateFlat(CCmdUI* pCmdUI);
- afx_msg void OnSimplify();
- afx_msg void OnSaveFile();
- afx_msg void OnAxes();
- afx_msg void OnUpdateAxes(CCmdUI* pCmdUI);
- afx_msg void OnSavePicture();
- afx_msg void OnUpdateSimplify(CCmdUI* pCmdUI);
- afx_msg void OnUpdateSaveFile(CCmdUI* pCmdUI);
- afx_msg void OnCloseFile();
- afx_msg void OnUpdateCloseFile(CCmdUI* pCmdUI);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_CHILDVIEW_H__BDDF956A_C67B_11D3_91F5_0000E83E7EBA__INCLUDED_)