www.pudn.com > 3DmaxSLoader.rar > 3DSLoaderView.h


// 3DSLoaderView.h : interface of the CMy3DSLoaderView 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 "glStructures.h"	//数据结构定义 
#include "3dsReader.h"		//C3dsReader说明文件 
#include "TriList.h"		//CTriList说明文件 
#include "Texture.h" 
#define MAX  500 
struct vertex 
{ 
	GLfloat x, y, z, light; 
}; 
 
 
class CMy3DSLoaderView : public CView 
{ 
protected: // create from serialization only 
	CMy3DSLoaderView(); 
	DECLARE_DYNCREATE(CMy3DSLoaderView) 
 
// Attributes 
public: 
	CMy3DSLoaderDoc* GetDocument(); 
 
	vertex field[MAX+9][MAX+9]; 
	Texture m_texture; 
 
// Operations 
public: 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CMy3DSLoaderView) 
	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 ~CMy3DSLoaderView(); 
///////////////////////////////////////////////////////////////// 
//添加成员函数与成员变量 
	BOOL RenderScene(); 
	BOOL SetupPixelFormat(void); 
	void SetLogicalPalette(void); 
	BOOL InitializeOpenGL(CDC* pDC); 
 
	HGLRC		m_hRC;			//OpenGL绘制描述表 
	HPALETTE	m_hPalette;		//OpenGL调色板 
	CDC*	    m_pDC;			//OpenGL设备描述表 
///////////////////////////////////////////////////////////////// 
	void Init(GLvoid); 
	void Draw3ds(); 
	bool InitGL(GLvoid); 
	bool InitTerrain(GLvoid); 
	bool InitSmoke(GLvoid); 
	bool DrawWireframe(GLvoid); 
	bool DrawTexture(GLvoid); 
	bool DrawWater(GLvoid); 
	bool DrawTerrain(GLvoid); 
	bool DrawSky(GLvoid); 
	void Caculate(GLvoid); 
	GLfloat Hypot(GLfloat A, GLfloat B); 
	GLfloat ABS(GLfloat A); 
	void RestoreMyDefaultSettings(); 
	BOOL OpenFile(LPCTSTR lpszPathName); 
 
	CTriList	m_triList;			 
	float		camRot[3];		 
	float		camPos[3];		 
	float		sceneRot[3];	 
	float		scenePos[3]; 
 
#ifdef _DEBUG 
	virtual void AssertValid() const; 
	virtual void Dump(CDumpContext& dc) const; 
#endif 
 
protected: 
 
// Generated message map functions 
protected: 
	//{{AFX_MSG(CMy3DSLoaderView) 
	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 OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
#ifndef _DEBUG  // debug version in 3DSLoaderView.cpp 
inline CMy3DSLoaderDoc* CMy3DSLoaderView::GetDocument() 
   { return (CMy3DSLoaderDoc*)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_)