www.pudn.com > cs__cs.rar > CMap.h


 
#ifndef _H_MAP_INCLUDE 
#define _H_MAP_INCLUDE 
 
#include 		// Header File For Windows 
#include 			// Header File For Standard Input/Output 
#include 			// Header File For The OpenGL32 Library 
#include 			// Header File For The GLu32 Library 
#include 		// Header File For The Glaux Library 
 
class CMap 
{ 
public: 
	CMap(); 
	~CMap(); 
	bool LoadMap(char* filename); 
	int DrawScene(bool bSelect); 
	GLuint GetFixTexture(GLuint index); 
	void CheckLimit(float xo,float zo,float xn,float zn,float yrot,float yc,float* yo,float* yn,bool* xlimit,bool* zlimit); 
	GLuint fontlistbase; 
private: 
	typedef struct tagVERTEX 
	{ 
		float x, y, z; 
		float u, v; 
	} VERTEX; 
 
	typedef struct tagTRIANGLE 
	{ 
		int    texnum; //对应纹理号 
		VERTEX vertex[3]; 
	} TRIANGLE; 
 
	typedef struct tagSECTOR 
	{ 
		int numtriangles;   //三角形数目 
		TRIANGLE* triangle; 
	} SECTOR; 
 
	typedef struct tagQUAZ  //一个有高度的矩形结构: 
							//我们的主角只能在这样的矩形里移动 
	{						//比如一个矩形的 5 个域分别是 (-1,-2, 3,4, 5) 
		float  x1;          //那么“我”可以移动的条件就是: 
		float  z1;			// -1=2 
		float  x2; 
		float  z2; 
		float  y; 
	} QUAZ; 
 
	typedef struct tagSECTORLITMIT 
	{ 
		int numquazs;   
		QUAZ* quaz;        //矩形结构数组, 
						   //一个 SECTOR 通过一连串的矩形来确定主角的可移动范围 
	} SECTORLITMIT; 
 
	AUX_RGBImageRec* LoadBMP(char *filename); 
	AUX_RGBImageRec* LoadTGA(char *filename); 
	AUX_RGBImageRec* LoadImage(char *filename); 
	int LoadTextures(char *filename,GLuint** texture,GLuint* numtexture); 
	int LoadSectorLimit(char *filename); 
	GLvoid BuildFont(GLvoid); 
	GLvoid KillFont(GLvoid); 
	void UnloadMap(); 
	SECTOR sector; 
	SECTORLITMIT  sectorlimit; 
	GLuint* texturefix; 
	GLuint  numtexturefix; //固定纹理数目 
	GLuint* texture; 
	GLuint  numtexture; //纹理数目 
}; 
 
extern void readstr(FILE *f,char *string); 
 
#endif