Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
treegen.h
Go to the documentation of this file.
1/*
2Minetest
3Copyright (C) 2010-2018 celeron55, Perttu Ahola <celeron55@gmail.com>,
4Copyright (C) 2012-2018 RealBadAngel, Maciej Kasatkin
5Copyright (C) 2015-2018 paramat
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU Lesser General Public License as published by
9the Free Software Foundation; either version 2.1 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along
18with this program; if not, write to the Free Software Foundation, Inc.,
1951 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20*/
21
22#pragma once
23
24#include <string>
25#include "irr_v3d.h"
26#include "nodedef.h"
27#include "mapnode.h"
28
29class MMVManip;
30class NodeDefManager;
31class ServerMap;
32
33namespace treegen {
34
35 enum error {
38 };
39
40 struct TreeDef : public NodeResolver {
42 // Initialize param1 and param2
47 {}
48 virtual void resolveNodeNames();
49
50 std::string initial_axiom;
51 std::string rules_a;
52 std::string rules_b;
53 std::string rules_c;
54 std::string rules_d;
55
59
61 int angle;
64 std::string trunk_type;
68 s32 seed;
70 };
71
72 // Add default tree
73 void make_tree(MMVManip &vmanip, v3s16 p0,
74 bool is_apple_tree, const NodeDefManager *ndef, s32 seed);
75 // Add jungle tree
76 void make_jungletree(MMVManip &vmanip, v3s16 p0,
77 const NodeDefManager *ndef, s32 seed);
78 // Add pine tree
79 void make_pine_tree(MMVManip &vmanip, v3s16 p0,
80 const NodeDefManager *ndef, s32 seed);
81
82 // Spawn L-Systems tree on VManip
83 treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, const TreeDef &def);
84 // Helper to spawn it directly on map
85 treegen::error spawn_ltree(ServerMap *map, v3s16 p0, const TreeDef &def);
86}; // namespace treegen
Definition: map.h:320
This class is for getting the actual properties of nodes from their content ID.
Definition: nodedef.h:556
Definition: nodedef.h:853
Definition: servermap.h:46
core::vector3d< s16 > v3s16
Definition: irr_v3d.h:28
#define CONTENT_IGNORE
Definition: mapnode.h:73
Definition: mg_decoration.h:34
void make_tree(MMVManip &vmanip, v3s16 p0, bool is_apple_tree, const NodeDefManager *ndef, s32 seed)
Definition: treegen.cpp:62
void make_jungletree(MMVManip &vmanip, v3s16 p0, const NodeDefManager *ndef, s32 seed)
Definition: treegen.cpp:661
void make_pine_tree(MMVManip &vmanip, v3s16 p0, const NodeDefManager *ndef, s32 seed)
Definition: treegen.cpp:765
error
Definition: treegen.h:35
@ SUCCESS
Definition: treegen.h:36
@ UNBALANCED_BRACKETS
Definition: treegen.h:37
treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, const TreeDef &tree_definition)
Definition: treegen.cpp:171
treegen::error spawn_ltree(ServerMap *map, v3s16 p0, const TreeDef &tree_definition)
Definition: treegen.cpp:148
Definition: mapnode.h:139
Definition: treegen.h:40
int iterations
Definition: treegen.h:62
virtual void resolveNodeNames()
Definition: treegen.cpp:35
int fruit_chance
Definition: treegen.h:67
int leaves2_chance
Definition: treegen.h:60
TreeDef()
Definition: treegen.h:41
std::string trunk_type
Definition: treegen.h:64
MapNode leavesnode
Definition: treegen.h:57
MapNode fruitnode
Definition: treegen.h:66
std::string initial_axiom
Definition: treegen.h:50
std::string rules_b
Definition: treegen.h:52
std::string rules_c
Definition: treegen.h:53
bool thin_branches
Definition: treegen.h:65
int angle
Definition: treegen.h:61
bool explicit_seed
Definition: treegen.h:69
MapNode leaves2node
Definition: treegen.h:58
s32 seed
Definition: treegen.h:68
MapNode trunknode
Definition: treegen.h:56
std::string rules_a
Definition: treegen.h:51
int iterations_random_level
Definition: treegen.h:63
std::string rules_d
Definition: treegen.h:54