Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
treegen.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2010-2018 celeron55, Perttu Ahola <celeron55@gmail.com>,
4// Copyright (C) 2012-2018 RealBadAngel, Maciej Kasatkin
5// Copyright (C) 2015-2018 paramat
6
7#pragma once
8
9#include <string>
10#include "irr_v3d.h"
11#include "nodedef.h"
12#include "mapnode.h"
13
14class MMVManip;
15class NodeDefManager;
16class ServerMap;
17
18namespace treegen {
19
24
25 struct TreeDef : public NodeResolver {
27 // Initialize param1 and param2
32 {}
33 virtual void resolveNodeNames();
34
35 std::string initial_axiom;
36 std::string rules_a;
37 std::string rules_b;
38 std::string rules_c;
39 std::string rules_d;
40
44
46 int angle;
49 std::string trunk_type;
53 s32 seed;
55 };
56
57 // Add default tree
58 void make_tree(MMVManip &vmanip, v3s16 p0,
59 bool is_apple_tree, const NodeDefManager *ndef, s32 seed);
60 // Add jungle tree
61 void make_jungletree(MMVManip &vmanip, v3s16 p0,
62 const NodeDefManager *ndef, s32 seed);
63 // Add pine tree
64 void make_pine_tree(MMVManip &vmanip, v3s16 p0,
65 const NodeDefManager *ndef, s32 seed);
66
67 // Spawn L-Systems tree on VManip
68 treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, const TreeDef &def);
69 // Helper to spawn it directly on map
70 treegen::error spawn_ltree(ServerMap *map, v3s16 p0, const TreeDef &def);
71}; // namespace treegen
Definition map.h:305
This class is for getting the actual properties of nodes from their content ID.
Definition nodedef.h:540
Definition nodedef.h:837
Definition servermap.h:44
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
#define CONTENT_IGNORE
Definition mapnode.h:58
Definition mg_decoration.h:19
void make_tree(MMVManip &vmanip, v3s16 p0, bool is_apple_tree, const NodeDefManager *ndef, s32 seed)
Definition treegen.cpp:47
void make_jungletree(MMVManip &vmanip, v3s16 p0, const NodeDefManager *ndef, s32 seed)
Definition treegen.cpp:646
void make_pine_tree(MMVManip &vmanip, v3s16 p0, const NodeDefManager *ndef, s32 seed)
Definition treegen.cpp:750
error
Definition treegen.h:20
@ SUCCESS
Definition treegen.h:21
@ UNBALANCED_BRACKETS
Definition treegen.h:22
treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, const TreeDef &tree_definition)
Definition treegen.cpp:156
treegen::error spawn_ltree(ServerMap *map, v3s16 p0, const TreeDef &tree_definition)
Definition treegen.cpp:133
Definition mapnode.h:124
Definition treegen.h:25
int iterations
Definition treegen.h:47
virtual void resolveNodeNames()
Definition treegen.cpp:20
int fruit_chance
Definition treegen.h:52
int leaves2_chance
Definition treegen.h:45
TreeDef()
Definition treegen.h:26
std::string trunk_type
Definition treegen.h:49
MapNode leavesnode
Definition treegen.h:42
MapNode fruitnode
Definition treegen.h:51
std::string initial_axiom
Definition treegen.h:35
std::string rules_b
Definition treegen.h:37
std::string rules_c
Definition treegen.h:38
bool thin_branches
Definition treegen.h:50
int angle
Definition treegen.h:46
bool explicit_seed
Definition treegen.h:54
MapNode leaves2node
Definition treegen.h:43
s32 seed
Definition treegen.h:53
MapNode trunknode
Definition treegen.h:41
std::string rules_a
Definition treegen.h:36
int iterations_random_level
Definition treegen.h:48
std::string rules_d
Definition treegen.h:39