www.pudn.com > MissileTest.rar > MissileTestView.h


// MissileTestView.h : interface of the CMissileTestView class 
// 
///////////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_MYSDOPENGLVIEW_H__75C5AAEC_37B0_4A8B_9132_9A0C663F6DDC__INCLUDED_) 
#define AFX_MYSDOPENGLVIEW_H__75C5AAEC_37B0_4A8B_9132_9A0C663F6DDC__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
#include "Texture.h" 
#define DIMX 16 
#define DIMZ 16 
#define MAXSMOKEMISSILE 64 
#define MAXSMOKEEXPLOSION 64 
#define MAXFRAGMENT 1024 
#define CAM_A 0 
#define CAM_B 1 
#define CAM_C 2 
#define CAM_D 3 
#define CAM_E 4 
#define CAM_F 5 
#define CAM_G 6 
#define CAM_H 7 
typedef struct 
{ 
	double x; 
	double y; 
	double z; 
} Vector; 
 
typedef struct { 
	float x; 
	float y; 
	float z; 
	float type; 
} CAMERA; 
 
typedef struct { 
	int cameratype; 
	float xcam; 
	float ycam; 
	float zcam; 
	float xmis; 
	float ymis; 
	float zmis; 
	float vmis; 
	float amis; 
	float damis; 
	bool fcollision; 
	bool fexplosion; 
	int nexplosion; 
	float potenza; 
	float anparete; 
	float mparete; 
	bool fine; 
} DATA; 
 
typedef struct { 
	float x; 
	float y; 
	float z; 
	float dist; 
} TARGET; 
 
typedef struct { 
	bool active; 
	float x; 
	float y; 
	float z; 
	float dx; 
	float dy; 
	float dz; 
	float anx; 
	float any; 
	float anz; 
	float dim; 
	float ddim; 
	float r; 
	float g; 
	float b; 
} SMOKE; 
class Model; 
class CMissileTestView : public CView 
{ 
protected: // create from serialization only 
	CMissileTestView(); 
	DECLARE_DYNCREATE(CMissileTestView) 
 
// Attributes 
public: 
	CMissileTestDoc* GetDocument(); 
	Model *pModel; 
	Texture m_texture; 
 
	CAMERA camera[10]; 
	DATA var; 
	TARGET target[DIMX][DIMZ][5]; 
	TARGET target_ex[DIMX][DIMZ][5]; 
	SMOKE smoke_mis[MAXSMOKEMISSILE];	// 导弹尾部烟雾效果 
	SMOKE smoke_exp[MAXSMOKEEXPLOSION];	// 爆炸烟雾效果 
	SMOKE fragment[MAXFRAGMENT]; 
	GLUquadricObj *quadratic;	// Storage For Our Quadratic Objects ( NEW ) 
 
 
// Operations 
public: 
	int InitGL(GLvoid);		 
	void InitData(void);				// 初始化数据 
	void InitTarget(void);				// 初始化目标靶 
	void Camera(void);					// 视点处理 
	void CalFragment(void);				// 计算爆炸后的碎片 
	void DrawFragment(void);			// 绘制爆炸后的碎片 
	void CalTarget(void);				// 计算爆炸后的目标靶 
	void DrawExplosion(void);			// 绘制爆炸烟雾 
	void DrawMoveSmoke(void);			// 绘制尾部烟雾 
	void DrawMissile(void);				// 绘制导弹 
	void DrawLauncher(void);			// 绘制发射架 
	void DrawTerrain(void);				// 绘制地形 
	void DrawTarget(void);				// 绘制目标靶 
	double VectorLength( Vector v ); 
	Vector VectorNormalize( Vector v ); 
	Vector VectorMultiply( Vector v1, Vector v2 ); 
	Vector VectorScalarMultiply( Vector v, double s ); 
	Vector VectorDiff( Vector v1, Vector v2 ); 
	void Luce(double x, double y, double z,double dimensione,float r,float g,float b,float iox,float ioy,float ioz,int Tex); 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CMissileTestView) 
	public: 
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view 
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 
	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 ~CMissileTestView(); 
///////////////////////////////////////////////////////////////// 
//添加成员函数与成员变量 
	BOOL RenderScene(); 
	BOOL SetupPixelFormat(void); 
	void SetLogicalPalette(void); 
	BOOL InitializeOpenGL(CDC* pDC); 
 
	HGLRC		m_hRC;			//OpenGL绘制描述表 
	HPALETTE	m_hPalette;		//OpenGL调色板 
	CDC*	    m_pDC;			//OpenGL设备描述表 
///////////////////////////////////////////////////////////////// 
 
 
#ifdef _DEBUG 
	virtual void AssertValid() const; 
	virtual void Dump(CDumpContext& dc) const; 
#endif 
 
protected: 
 
// Generated message map functions 
protected: 
	//{{AFX_MSG(CMissileTestView) 
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 
	afx_msg void OnDestroy(); 
	afx_msg void OnSize(UINT nType, int cx, int cy); 
	afx_msg void OnTimer(UINT nIDEvent); 
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
#ifndef _DEBUG  // debug version in MissileTestView.cpp 
inline CMissileTestDoc* CMissileTestView::GetDocument() 
   { return (CMissileTestDoc*)m_pDocument; } 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_MYSDOPENGLVIEW_H__75C5AAEC_37B0_4A8B_9132_9A0C663F6DDC__INCLUDED_)