www.pudn.com > vessel2.rar > MYSDOPENGLVIEW.H


// MySDOpenGLView.h : interface of the CMySDOpenGLView 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 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; 
	int nexplosion; 
	float potenza; 
	float anparete; 
	float mparete; 
	bool fine; 
} DATA; 
 
class Model; 
class CMySDOpenGLView : public CView 
{ 
protected: // create from serialization only 
	CMySDOpenGLView(); 
	DECLARE_DYNCREATE(CMySDOpenGLView) 
 
// Attributes 
public: 
	CMySDOpenGLDoc* GetDocument(); 
	Model *pModel; 
	Texture m_texture; 
 
	CAMERA camera[10]; 
	DATA var; 
	GLUquadricObj *quadratic;	// Storage For Our Quadratic Objects ( NEW ) 
 
// Operations 
public: 
	int InitGL(GLvoid);		 
	void InitData(void);				// 初始化数据 
	void Camera(void);					// 视点处理 
	void DrawMissile(void);				// 绘制导弹 
	void DrawTerrain(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(CMySDOpenGLView) 
	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 ~CMySDOpenGLView(); 
///////////////////////////////////////////////////////////////// 
//添加成员函数与成员变量 
	BOOL RenderScene(); 
	BOOL SetupPixelFormat(void); 
	void SetLogicalPalette(void); 
	void Drawyuanzhu(GLfloat radius, GLfloat length); 
	void changesize(int w, int h); 
	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(CMySDOpenGLView) 
	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 MySDOpenGLView.cpp 
inline CMySDOpenGLDoc* CMySDOpenGLView::GetDocument() 
   { return (CMySDOpenGLDoc*)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_)