⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.h

📁 本人的毕业设计 提供给大家 共同学习
💻 H
字号:
#ifndef _MAIN_H
#define _MAIN_H

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <fstream>
#include <vector>
#include <gl\gl.h>										
#include <gl\glu.h>										
#include <gl\glaux.h>

#include <crtdbg.h>

#pragma comment( lib, "glaux.lib" )
#pragma comment( lib, "opengl32.lib" )
#pragma comment( lib, "glu32.lib" )
//#pragma comment( lib, "glew32.lib" )
#pragma comment( lib, "winmm.lib" )
using namespace std;

#define SCREEN_WIDTH 1024								
#define SCREEN_HEIGHT 768								
#define SCREEN_DEPTH 16	
#define piover180 3.1415926/180								


#define MAX_TEXTURES 100								// 挖掘机最大的纹理数目

#define MAX_SAND_TEXTURES 20

// 定义3D点的类,用于保存模型中的顶点
class CVector3 
{
public:
	float x, y, z;
};

// 定义2D点类,用于保存模型的UV纹理坐标
class CVector2 
{
public:
	float x, y;
};

//  面的结构定义
struct tFace
{
	int vertIndex[3];			// 顶点索引
	int coordIndex[3];			// 纹理坐标索引
};

//  材质信息结构体
struct tMaterialInfo
{
	char  strName[255];			// 纹理名称
	char  strFile[255];			// 如果存在纹理映射,则表示纹理文件名称
	BYTE  color[3];				// 对象的RGB颜色
	int   texureId;				// 纹理ID
	float uTile;				// u 重复
	float vTile;				// v 重复
	float uOffset;			    // u 纹理偏移
	float vOffset;				// v 纹理偏移
} ;

//  对象信息结构体
struct t3DObject 
{
	int  numOfVerts;			// 模型中顶点的数目
	int  numOfFaces;			// 模型中面的数目
	int  numTexVertex;			// 模型中纹理坐标的数目
	int  materialID;			// 纹理ID
	bool bHasTexture;			// 是否具有纹理映射
	char strName[255];			// 对象的名称
	CVector3  *pVerts;			// 对象的顶点
	CVector3  *pNormals;		// 对象的法向量
	CVector2  *pTexVerts;		// 纹理UV坐标
	tFace *pFaces;				// 对象的面信息
};

//  模型信息结构体
struct t3DModel 
{
	int numOfObjects;					// 模型中对象的数目
	int numOfMaterials;					// 模型中材质的数目
	vector<tMaterialInfo> pMaterials;	// 材质链表信息
	vector<t3DObject> pObject;			// 模型中对象链表信息
};


extern bool  g_bFullScreen;									
extern HWND  g_hWnd;										
extern RECT  g_rRect;										
extern HDC   g_hDC;											
extern HGLRC g_hRC;											
extern HINSTANCE g_hInstance;
extern int iSceneFlag;
							
//HINSTANCE g_hInstance;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow);
LRESULT CALLBACK WinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
WPARAM MainLoop();

// 生成纹理,并将其保存在纹理队列中
void CreateTexture(UINT textureArray[], LPSTR strFileName, int textureID);

void CreateSceneTextureWithAlpha(LPSTR strFileName, GLuint &textureID );

void CreateSceneTexture( LPSTR strFileName, GLuint &textureID );

BOOL CALLBACK SceneSelectProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam);

// 改变显示为全屏模式
void ChangeToFullScreen();

// 生成用户窗口
HWND CreateMyWindow(LPSTR strWindowName, int width, int height, DWORD dwStyle, bool bFullScreen, HINSTANCE hInstance);

// 设置像素格式
bool bSetupPixelFormat(HDC hdc);

// 初始化投影变换
void SizeOpenGLScreen(int width, int height);

// 初始化OpenGL
void InitializeOpenGL(int width, int height);

// 初始化整个程序
void Init(HWND hWnd);

// 渲染场景
void RenderScene();

// 释放程序占用的内存空间
void DeInit();

//初始化挖掘机数据
void InitGrab( void );

//初始化总场景中的数据
void InitAllScene( void );

//初始化挖沙场景中的数据
void InitSandScene( void );

//初始化挖土场景中的数据
void InitSoilScene( void );

//初始化填坑场景中的数据
void InitRamScene( void );

//初始化装车场景中的数据
void InitLoadScene( void );

//初始化挖石头场景中的数据
void InitStoneScene( void );

void InitSandParticles( void );

void InitSoilParticles( void );

void InitStoneParticles( void );

void InitStoneParticles( void );

void InitTruck( void );

//显示总的场景
void displayAllScene( void );

//显示挖沙场景
void displaySandScene( void );

//显示挖土场景
void displaySoilScene( void );

//显示填坑场景
void displayRamScene( void );

//显示装车场景
void displayLoadScene( void );

//显示挖石头场景
void displayStoneScene( void );

void displaySandParticles( void );

void displaySoilParticles( void );

void displayStoneParticles( void );

void displayTruck( void );

//清除总场景中的数据
void ClearAllScene( void );

//清除挖沙场景中的数据
void ClearSandScene( void );

//清除挖土场景中的数据
void ClearSoilScene( void );

//清除填坑场景中的数据
void ClearRamScene( void );

//清除装车场景中的数据
void ClearLoadScene( void );

//清除挖石头场景中的数据
void ClearStoneScene( void );

void ClearTruck( void );

void ClearScene( void );

void ClearSandParticles( void );

void ClearSoilParticles( void );

void ClearStoneParticles( void );

//生成粒子系统
void Generateparticles( void );

#endif 


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -