1#ifndef TerrainObjectManager_H
2#define TerrainObjectManager_H
8using MapKey = std::string
const;
18class TerrainObjectManager
21 friend class TerrainObjectManagerAttorney;
23 static TerrainObjectManager* ptrInstance;
25 TerrainObjectManager();
26 TerrainObjectManager(
const TerrainObjectManager&) =
delete;
27 TerrainObjectManager& operator=(
const TerrainObjectManager&) =
delete;
28 ~TerrainObjectManager() =
default;
30 static TerrainObjectManager& Instance()
32 if (ptrInstance ==
nullptr)
33 ptrInstance =
new TerrainObjectManager();
40 static void Delete() { Instance().privDelete(); };
44 void privLoad(MapKey key,
Terrain* t);
45 void privLoad(MapKey key, std::string heightmap,
float sideLen,
float maxH,
float zeroAltitude, std::string tex,
float uRep,
float vRep);
64 static Terrain*
Get(MapKey key) {
return Instance().privGet(key); };
72 static void Load(MapKey key,
Terrain* t) { Instance().privLoad(key, t); };
86 static void Load(MapKey key, std::string heightmap,
float sideLen,
float maxH,
float zeroAltitude, std::string tex,
float uRep,
float vRep)
88 Instance().privLoad(key, heightmap, sideLen, maxH, zeroAltitude, tex, uRep, vRep);
Represents a 3D terrain generated from a heightmap.
Definition Terrain.h:18
static void Delete()
Deletes all managed Terrain objects and the singleton instance.
Definition TerrainObjectManager.h:40
static Terrain * Get(MapKey key)
Retrieves a Terrain object by its key.
Definition TerrainObjectManager.h:64
static void Load(MapKey key, std::string heightmap, float sideLen, float maxH, float zeroAltitude, std::string tex, float uRep, float vRep)
Loads a Terrain object from parameters.
Definition TerrainObjectManager.h:86
static const MapKey defaultTerrainKey
Default key for the default Terrain.
Definition TerrainObjectManager.h:56
static void Load(MapKey key, Terrain *t)
Loads a Terrain object directly.
Definition TerrainObjectManager.h:72
std::map< MapKey, Terrain * > storageMap
Map storing Terrain objects associated with their keys.
Definition TerrainObjectManager.h:50