mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-16 01:45:36 +02:00
Add weights to biomes (#15142)
This commit is contained in:
@@ -39,6 +39,7 @@ BiomeManager::BiomeManager(Server *server) :
|
||||
b->heat_point = 0.0;
|
||||
b->humidity_point = 0.0;
|
||||
b->vertical_blend = 0;
|
||||
b->weight = 1.0f;
|
||||
|
||||
b->m_nodenames.emplace_back("mapgen_stone");
|
||||
b->m_nodenames.emplace_back("mapgen_stone");
|
||||
@@ -256,7 +257,9 @@ Biome *BiomeGenOriginal::calcBiomeFromNoise(float heat, float humidity, v3s16 po
|
||||
|
||||
float d_heat = heat - b->heat_point;
|
||||
float d_humidity = humidity - b->humidity_point;
|
||||
float dist = (d_heat * d_heat) + (d_humidity * d_humidity);
|
||||
float dist = ((d_heat * d_heat) + (d_humidity * d_humidity));
|
||||
if (b->weight > 0.f)
|
||||
dist /= b->weight;
|
||||
|
||||
if (pos.Y <= b->max_pos.Y) { // Within y limits of biome b
|
||||
if (dist < dist_min) {
|
||||
@@ -321,6 +324,7 @@ ObjDef *Biome::clone() const
|
||||
obj->heat_point = heat_point;
|
||||
obj->humidity_point = humidity_point;
|
||||
obj->vertical_blend = vertical_blend;
|
||||
obj->weight = weight;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
@@ -54,6 +54,7 @@ public:
|
||||
float heat_point;
|
||||
float humidity_point;
|
||||
s16 vertical_blend;
|
||||
float weight;
|
||||
|
||||
virtual void resolveNodeNames();
|
||||
};
|
||||
|
Reference in New Issue
Block a user