91 lines
2.5 KiB
C++
91 lines
2.5 KiB
C++
// TestView.h : interface of the CTestView class
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
#if !defined(AFX_TESTVIEW_H__A75FDCFB_621C_4E38_A154_C344803E6372__INCLUDED_)
|
|
#define AFX_TESTVIEW_H__A75FDCFB_621C_4E38_A154_C344803E6372__INCLUDED_
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
#include "Face.h"
|
|
#include "ZBuffer.h"
|
|
#include "Transform.h"
|
|
|
|
class CTestView : public CView
|
|
{
|
|
protected: // create from serialization only
|
|
CTestView();
|
|
DECLARE_DYNCREATE(CTestView)
|
|
|
|
// Attributes
|
|
public:
|
|
CTestDoc* GetDocument();
|
|
|
|
// Operations
|
|
public:
|
|
void ReadVertex();//读入点表
|
|
void ReadFace();//读入面表
|
|
void InitParameter();//参数初始化
|
|
void PerProject(CP3);//透视投影
|
|
void DoubleBuffer();//双缓冲绘图
|
|
void DrawObject(CDC *);//绘制立方体表面
|
|
// Overrides
|
|
// ClassWizard generated virtual function overrides
|
|
//{{AFX_VIRTUAL(CTestView)
|
|
public:
|
|
virtual void OnDraw(CDC* pDC); // overridden to draw this view
|
|
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
|
virtual void OnInitialUpdate();
|
|
protected:
|
|
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
|
|
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
|
|
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
|
|
//}}AFX_VIRTUAL
|
|
|
|
// Implementation
|
|
public:
|
|
virtual ~CTestView();
|
|
#ifdef _DEBUG
|
|
virtual void AssertValid() const;
|
|
virtual void Dump(CDumpContext& dc) const;
|
|
#endif
|
|
|
|
protected:
|
|
CP3 V[10];//点表
|
|
CFace F[7];//面表
|
|
double R,Theta,Phi;//视点在用户坐标系中的球坐标
|
|
double d;//视距
|
|
double Near,Far;//远近剪切面
|
|
double k[9];//运算常量
|
|
CP3 ViewPoint;//视点球坐标
|
|
CPi3 ScreenP;//屏幕坐标系的三维坐标点
|
|
BOOL bPlay;//动画开关
|
|
double Alpha,Beta;//x方向旋转α角,y方向旋转β角
|
|
CTransform tran;//变换对象
|
|
// Generated message map functions
|
|
protected:
|
|
//{{AFX_MSG(CTestView)
|
|
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
|
afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
|
|
afx_msg void OnTimer(UINT nIDEvent);
|
|
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
|
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
|
afx_msg void OnPlay();
|
|
afx_msg void OnUpdatePlay(CCmdUI* pCmdUI);
|
|
//}}AFX_MSG
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
#ifndef _DEBUG // debug version in TestView.cpp
|
|
inline CTestDoc* CTestView::GetDocument()
|
|
{ return (CTestDoc*)m_pDocument; }
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
//{{AFX_INSERT_LOCATION}}
|
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
|
|
|
#endif // !defined(AFX_TESTVIEW_H__A75FDCFB_621C_4E38_A154_C344803E6372__INCLUDED_)
|