Terrain.h
上传用户:hkb425
上传日期:2007-06-16
资源大小:34191k
文件大小:2k
- // Terrain.h: interface for the CTerrain class.
- //作者:吴雪平 2002-6-17日修改
- //画地形
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_TERRAIN_H__A574B9A8_37A1_4B50_AE15_C397FFC404BB__INCLUDED_)
- #define AFX_TERRAIN_H__A574B9A8_37A1_4B50_AE15_C397FFC404BB__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "structdef.h"
- #include "FrustumCull.h"
- #include "heightmap.h"
- #include "normal.h"
- #define TEX_TYPE 1 //贴图的丰富程度,为了节约,只用一种
- class CTerrain
- {
- public:
- CTerrain();
- bool InitTerrain();
- void UpdateTerrainmap();
- void RendTerrain();
- void RestoreDrawMap();
- virtual ~CTerrain();
- int GetNumTriangles();
- protected:
- void RenderTerrainTile(int x,int z);
- void DrawLevel_1(int x,int z);
- void DrawLevel_2(int x,int z);
- void DrawLevel_3(int x,int z);
- void DrawLevel_4(int x,int z);
- void DrawLevel_5(int x,int z);
- void DrawLevel_6(int x,int z);
- void DrawLevel_7(int x,int z);
- void LevelChoose(int level,int x,int z);
- void FillMovemap();
- void UpdateLODmap(); //将视区内要画的点做记号
- void ProcessLine(int startX,int StartZ);//处理(X,Y,Z)到视点连线之间的点
- int GetPos(int x,int z);
- int GetXpos(int x,int z);
- int GetZpos(int x,int z);
- void DrawTerrainStrip(int X,int Z);
- CFrustumCull cFrustumCull;
- CHeightmap m_cHmap;
- TERRAIN_SKIN Skinmap[64][64];
- unsigned short NormalIndex[256*256];
- unsigned char LODmap[256][256];
- unsigned char DrawMap[256][256];
- int offsetx;
- int offsetz;
- float biasX;
- float biasZ;
- int radius,maxx,minx,maxz,minz;
- CNormal cNormal;
- //黄土地到草地的过渡贴图4幅,对应TerSkin1-4.skn
- //通过4副图产生16种贴法
- unsigned int Blend[4];
- unsigned int BaseA[TEX_TYPE]; //黄土地贴图1幅
- unsigned int BaseB[TEX_TYPE]; //草地贴图1幅
- unsigned int Detail[2]; //给近处的地面加上细节贴图
- int numTriangles; //记录画三角形个数
- };
- #endif // !defined(AFX_TERRAIN_H__A574B9A8_37A1_4B50_AE15_C397FFC404BB__INCLUDED_)