3#include <unordered_map>
4#include <unordered_set>
13using std::unordered_map;
14using std::unordered_set;
38 vector<unordered_map<int, vector<Transformations>>>
foliageMaps;
54 delete foliageFoliagePrototypeMapIt.second;
56 for (
auto brush:
brushes)
delete brush;
115 vector<int> waterPositionMapsIndices;
117 waterPositionMapsIndices.push_back(waterPositionMapsIt.first);
119 return waterPositionMapsIndices;
174 if (prototype->
getFileName() == foliageFoliagePrototypeMapIt.second->getFileName())
return foliageFoliagePrototypeMapIt.first;
186 vector<int> foliagePrototypeIndices;
188 foliagePrototypeIndices.push_back(foliageFoliagePrototypeMapIt.first);
190 return foliagePrototypeIndices;
203 return foliageFoliagePrototypeIt->second;
219 vector<string> foliagePrototypeEntityIds;
220 auto prototypeEntityIdx = 0;
222 for (
auto& foliageMapPartitionIt: foliageMapPartition) {
223 auto& transformationsVector = foliageMapPartition[prototypeIdx];
224 if (transformationsVector.empty() ==
true)
continue;
226 if (foliagePrototype->isRenderGroups() ==
false) {
227 for (
auto& transformations: transformationsVector) {
228 foliagePrototypeEntityIds.push_back(
"tdme.foliage." + to_string(prototypeIdx) +
"." + to_string(prototypeEntityIdx++));
233 return foliagePrototypeEntityIds;
242 map<string, Transformations> foliagePrototypeEntityTransformations;
243 auto prototypeEntityIdx = 0;
245 auto& transformationsVector = foliageMapPartition[prototypeIdx];
246 if (transformationsVector.empty() ==
true)
continue;
248 if (foliagePrototype->isRenderGroups() ==
false) {
249 for (
auto& transformations: transformationsVector) {
250 foliagePrototypeEntityTransformations[
"tdme.foliage." + to_string(prototypeIdx) +
"." + to_string(prototypeEntityIdx++)] = transformations;
254 return foliagePrototypeEntityTransformations;
260 inline const vector<PrototypeTerrainBrush*>&
getBrushes()
const {
270 if (idx < 0 || idx >=
brushes.size())
return nullptr;
289 if (idx < 0 || idx >=
brushes.size())
return false;
Prototype terrain brush prototype definition.
Prototype terrain definition.
unordered_map< int, Prototype * > foliageFoliagePrototypeMap
const vector< PrototypeTerrainBrush * > & getBrushes() const
vector< float > terrainHeightVector
PrototypeTerrainBrush * addBrush()
Add prototype terrain brush.
void setWidth(float width)
Set width.
vector< int > getWaterPositionMapsIndices()
Get water position maps indices.
unordered_map< int, float > & getWaterPositionMapsHeight()
vector< unordered_map< int, vector< Transformations > > > & getFoliageMaps()
int getFoliagePrototypeIndex(Prototype *prototype)
Get or allocate a foliage prototype index.
void setDepth(float depth)
Set depth.
unordered_map< int, float > waterPositionMapsHeight
vector< float > & getHeightVector()
const map< string, Transformations > getFoliagePrototypeEntityTransformations(int prototypeIdx)
Get foliage prototype entity transformations indexed by entity id.
void setWaterPositionMapHeight(int idx, float waterHeight)
Set water position map height at given water position map index.
unordered_map< int, unordered_set< int > > & getWaterPositionMap(int idx)
Get water position map at given index.
Prototype * getFoliagePrototype(int prototypeIdx)
Get foliage prototype by given index.
vector< int > getFoliagePrototypeIndices()
Get foliage prototype indices.
int foliagePrototypeMapIdx
const vector< string > getFoliagePrototypeEntityIds(int prototypeIdx)
Get foliage prototype entity ids.
unordered_map< int, unordered_map< int, unordered_set< int > > > & getWaterPositionMaps()
~PrototypeTerrain()
Destructor.
bool removeBrush(int idx)
Remove prototype terrain brush.
int allocateWaterPositionMapIdx()
void removeWaterPositionMap(int idx)
Remove water position map at given water position map index.
PrototypeTerrainBrush * getBrush(int idx)
Get prototype terrain brush.
PrototypeTerrain()
Public constructor.
vector< unordered_map< int, vector< Transformations > > > foliageMaps
vector< PrototypeTerrainBrush * > brushes
unordered_map< int, unordered_map< int, unordered_set< int > > > waterPositionMaps
float getWaterPositionMapHeight(int idx)
Get water position map height at given water position map index.
const string & getFileName()