utility.h: Change Buffer's interface to be more compatible with SharedBuffer's interf...
[oweals/minetest.git] / src / mapgen.h
1 /*
2 Minetest-c55
3 Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef MAPGEN_HEADER
21 #define MAPGEN_HEADER
22
23 #include "common_irrlicht.h"
24 #include "utility.h" // UniqueQueue
25
26 struct BlockMakeData;
27 class MapBlock;
28 class ManualMapVoxelManipulator;
29
30 namespace mapgen
31 {
32         // Finds precise ground level at any position
33         s16 find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision);
34
35         // Find out if block is completely underground
36         bool block_is_underground(u64 seed, v3s16 blockpos);
37
38         // Main map generation routine
39         void make_block(BlockMakeData *data);
40         
41         // Add objects according to block content
42         void add_random_objects(MapBlock *block);
43
44         // Add a tree
45         void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0, bool is_apple_tree);
46         
47         /*
48                 These are used by FarMesh
49         */
50         bool get_have_sand(u64 seed, v2s16 p2d);
51         double tree_amount_2d(u64 seed, v2s16 p);
52         
53
54         struct BlockMakeData
55         {
56                 bool no_op;
57                 ManualMapVoxelManipulator *vmanip;
58                 u64 seed;
59                 v3s16 blockpos;
60                 UniqueQueue<v3s16> transforming_liquid;
61
62                 BlockMakeData();
63                 ~BlockMakeData();
64         };
65
66 }; // namespace mapgen
67
68 #endif
69