1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#ifndef SM3_MAP_H
#define SM3_MAP_H
#include "Frustum.h"
#include "terrain/TerrainBase.h"
#include "terrain/Terrain.h"
#include "Map/ReadMap.h"
#include "Rendering/Textures/Bitmap.h"
#include <map>
class CSM3GroundDrawer;
class CSM3ReadMap : public CReadMap
{
public:
CR_DECLARE(CSM3ReadMap);
CSM3ReadMap(const std::string& rm);
~CSM3ReadMap();
void ConfigNotify(const std::string& key, const std::string& value);
void InitGroundDrawer();
void KillGroundDrawer();
CBaseGroundDrawer* GetGroundDrawer();
void UpdateHeightMapUnsynced(const SRectangle& hmu);
unsigned int GetMiniMapTexture() const { return minimapTexture; }
unsigned int GetShadingTexture() const { return 0; }
void DrawMinimap() const; // 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* GetFeatureTypeName(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, IQuadDrawer* cb, float maxDist, int quadSize, int extraSize = 0) override;
protected:
CSM3GroundDrawer* groundDrawer;
terrain::Terrain* renderer;
struct InfoMap {
InfoMap();
~InfoMap();
int w;
int h;
unsigned char* data;
};
unsigned int 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
|