sm3map.h

来自「这是整套横扫千军3D版游戏的源码」· C头文件 代码 · 共 73 行

H
73
字号

#ifndef SM3_MAP_H
#define SM3_MAP_H

#include "Map/ReadMap.h"
#include "terrain/TerrainBase.h"
#include "terrain/Terrain.h"
#include "Rendering/Textures/Bitmap.h"
#include "Frustum.h"

class CSm3GroundDrawer;


class CSm3ReadMap : public CReadMap
{
public:
	CR_DECLARE(CSm3ReadMap);

	CSm3ReadMap();
	~CSm3ReadMap();
	void Initialize (const char *mapname); // throws std::runtime_exception on errors

	CBaseGroundDrawer *GetGroundDrawer ();
	void HeightmapUpdated(int x1, int x2, int y1, int y2);
	float* GetHeightmap();
	void Update();
	void Explosion(float x,float y,float strength);
	void ExplosionUpdate(int x1,int x2,int y1,int y2);
	unsigned int GetShadingTexture (); // a texture with RGB for shading and A for height
	void DrawMinimap (); // draw the minimap in a quad (with extends: (0,0)-(1,1))

	// Feature creation
	int GetNumFeatures ();
	int GetNumFeatureTypes ();
	void GetFeatureInfo (MapFeatureInfo* f); // returns MapFeatureInfo[GetNumFeatures()]
	const char *GetFeatureType (int typeID);

	// Bitmaps (such as metal map, grass map, ...), handling them with a string as type seems flexible...
	// Some map types:
	//   "metal"  -  metalmap
	//   "grass"  -  grassmap
	unsigned char *GetInfoMap (const std::string& name, MapBitmapInfo* bm);
	void FreeInfoMap(const std::string& name, unsigned char *data);

	void GridVisibility(CCamera *cam, int quadSize, float maxdist, IQuadDrawer *cb, int extraSize);

protected:
	CSm3GroundDrawer *groundDrawer;
	terrain::Terrain *renderer;

	struct InfoMap {
		InfoMap ();
		~InfoMap ();
		int w,h;
		unsigned char *data;
	};

	GLuint minimapTexture;

	std::map<std::string, InfoMap> infoMaps;
	friend class CSm3GroundDrawer;

	std::vector<std::string*> featureTypes;
	MapFeatureInfo *featureInfo;
	unsigned int numFeatures;
	void LoadFeatureData();

	Frustum tmpFrustum;
};


#endif

⌨️ 快捷键说明

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