3 Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser 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.
20 #ifndef CAVEGEN_HEADER
21 #define CAVEGEN_HEADER
23 #define VMANIP_FLAG_CAVE VOXELFLAG_CHECKED1
24 #define DEFAULT_LAVA_DEPTH (-256)
26 class GenerateNotifier;
28 class CavesRandomWalk {
32 INodeDefManager *ndef;
37 NoiseParams *np_caveliquids;
39 s16 min_tunnel_diameter;
40 s16 max_tunnel_diameter;
41 u16 tunnel_routepoints;
43 int part_max_length_rs;
45 bool large_cave_is_flat;
52 v3f orp; // starting point, relative to caved space
53 v3s16 of; // absolute coordinates of caved space
54 v3s16 ar; // allowed route area
55 s16 rs; // tunnel radius size
63 content_t c_water_source;
64 content_t c_lava_source;
70 CavesRandomWalk(Mapgen *mg, PseudoRandom *ps);
71 void makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height);
72 void makeTunnel(bool dirswitch);
73 void carveRoute(v3f vec, float f, bool randomize_xz);
77 CavesV6 is the original version of caves used with Mapgen V6.
79 Though it uses the same fundamental algorithm as CavesRandomWalk, it is made
80 separate to preserve the exact sequence of PseudoRandom calls - any change
81 to this ordering results in the output being radically different.
82 Because caves in Mapgen V6 are responsible for a large portion of the basic
83 terrain shape, modifying this will break our contract of reverse
84 compatibility for a 'stable' mapgen such as V6.
87 *** DO NOT TOUCH THIS CLASS UNLESS YOU KNOW WHAT YOU ARE DOING ***
92 INodeDefManager *ndef;
93 GenerateNotifier *gennotify;
98 content_t c_water_source;
99 content_t c_lava_source;
104 s16 min_tunnel_diameter;
105 s16 max_tunnel_diameter;
106 u16 tunnel_routepoints;
108 int part_max_length_rs;
111 bool large_cave_is_flat;
116 v3f orp; // starting point, relative to caved space
117 v3s16 of; // absolute coordinates of caved space
118 v3s16 ar; // allowed route area
119 s16 rs; // tunnel radius size
125 // ndef is a mandatory parameter.
126 // If gennotify is NULL, generation events are not logged.
127 CavesV6(INodeDefManager *ndef,
128 GenerateNotifier *gennotify = NULL,
130 content_t water_source = CONTENT_IGNORE,
131 content_t lava_source = CONTENT_IGNORE);
133 // vm, ps, and ps2 are mandatory parameters.
134 // If heightmap is NULL, the surface level at all points is assumed to
136 void makeCave(MMVManip *vm, v3s16 nmin, v3s16 nmax,
137 PseudoRandom *ps, PseudoRandom *ps2,
138 bool is_large_cave, int max_stone_height, s16 *heightmap = NULL);
141 void makeTunnel(bool dirswitch);
142 void carveRoute(v3f vec, float f, bool randomize_xz, bool tunnel_above_ground);