mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-22 20:35:24 +02:00
Add L-system trees as decorations (#14355)
This commit is contained in:
@@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "util/numeric.h"
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include "mapgen/treegen.h"
|
||||
|
||||
|
||||
FlagDesc flagdesc_deco[] = {
|
||||
@@ -472,3 +473,24 @@ size_t DecoSchematic::generate(MMVManip *vm, PcgRandom *pr, v3s16 p, bool ceilin
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
ObjDef *DecoLSystem::clone() const
|
||||
{
|
||||
auto def = new DecoLSystem();
|
||||
Decoration::cloneTo(def);
|
||||
|
||||
def->tree_def = tree_def;
|
||||
return def;
|
||||
}
|
||||
|
||||
|
||||
size_t DecoLSystem::generate(MMVManip *vm, PcgRandom *pr, v3s16 p, bool ceiling)
|
||||
{
|
||||
if (!canPlaceDecoration(vm, p))
|
||||
return 0;
|
||||
|
||||
// Make sure that tree_def can't be modified, since it is shared.
|
||||
const auto &ref = *tree_def;
|
||||
return treegen::make_ltree(*vm, p, m_ndef, ref);
|
||||
}
|
||||
|
Reference in New Issue
Block a user