aboutsummaryrefslogtreecommitdiff
path: root/advtrains/models/advtrains_dtrack_vst33.obj
blob: 8cb5f04dbf36d677d74790c8c3dfc3af09c2255a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# Blender v2.78 (sub 0) OBJ File: 'rail_redo.blend'
# www.blender.org
o dtrack_vst33_Cube.030
v 0.753760 0.166667 -0.500000
v 0.753760 0.166667 0.500000
v 0.753760 0.500000 0.500000
v -0.753760 0.166667 -0.500000
v -0.753760 0.166667 0.500000
v -0.753760 0.500000 0.500000
v 0.329165 0.358626 0.171599
v 0.329165 0.522686 0.171599
v 0.329165 0.244227 -0.171599
v 0.329165 0.408287 -0.171599
v 0.462280 0.358626 0.171599
v 0.462280 0.522686 0.171599
v 0.462280 0.244227 -0.171599
v 0.462280 0.408287 -0.171599
v 0.412289 0.540000 0.500000
v 0.412289 0.206667 -0.500000
v 0.560528 0.206667 -0.500000
v 0.560528 0.540000 0.500000
v 0.474055 0.560000 0.500000
v 0.474055 0.226667 -0.500000
v 0.498762 0.226667 -0.500000
v 0.498762 0.560000 0.500000
v 0.474055 0.610000 0.500000
v 0.474055 0.276667 -0.500000
v 0.498762 0.276667 -0.500000
v 0.498762 0.610000 0.500000
v 0.529645 0.281667 -0.500000
v 0.529645 0.615000 0.500000
v 0.443172 0.615000 0.500000
v 0.443172 0.281667 -0.500000
v 0.529645 0.306667 -0.500000
v 0.529645 0.640000 0.500000
v 0.443172 0.640000 0.500000
v 0.443172 0.306667 -0.500000
v 0.741194 0.468333 0.435000
v -0.741194 0.468333 0.435000
v -0.741194 0.428333 0.315000
v 0.741194 0.428333 0.315000
v 0.741193 0.518333 0.435000
v -0.741194 0.518333 0.435000
v -0.741194 0.478333 0.315000
v 0.741194 0.478333 0.315000
v -0.011733 3.379186 0.500000
v -0.011732 3.045852 -0.500001
v -0.011733 3.400814 0.500000
v -0.011732 3.067481 -0.500000
v 0.011732 3.045853 -0.500000
v 0.011732 3.379186 0.500000
v 0.011732 3.067481 -0.500000
v 0.011732 3.400814 0.500000
v -0.412289 0.206667 -0.500000
v -0.412289 0.540000 0.500000
v -0.560528 0.540000 0.500000
v -0.560528 0.206667 -0.500000
v -0.474055 0.226667 -0.500000
v -0.474055 0.560000 0.500000
v -0.498762 0.560000 0.500000
v -0.498762 0.226667 -0.500000
v -0.474055 0.276667 -0.500000
v -0.474055 0.610000 0.500000
v -0.498762 0.610000 0.500000
v -0.498762 0.276667 -0.500000
v -0.529645 0.615000 0.500000
v -0.529645 0.281667 -0.500000
v -0.443172 0.281667 -0.500000
v -0.443172 0.615000 0.500000
v -0.529645 0.640000 0.500000
v -0.529645 0.306667 -0.500000
v -0.443172 0.306667 -0.500000
v -0.443172 0.640000 0.500000
v -0.741194 0.178333 -0.435000
v 0.741194 0.178333 -0.435000
v 0.741194 0.218333 -0.315000
v -0.741194 0.218333 -0.315000
v -0.741193 0.228333 -0.435000
v 0.741194 0.228333 -0.435000
v 0.741194 0.268333 -0.315000
v -0.741194 0.268333 -0.315000
v 0.741194 0.385954 0.187862
v -0.741194 0.385954 0.187862
v -0.741194 0.345954 0.067862
v 0.741194 0.345954 0.067862
v 0.741193 0.435954 0.187862
v -0.741194 0.435954 0.187862
v -0.741194 0.395954 0.067862
v 0.741194 0.395954 0.067862
v -0.741194 0.260713 -0.187862
v 0.741194 0.260713 -0.187862
v 0.741194 0.300713 -0.067862
v -0.741194 0.300713 -0.067862
v -0.741193 0.310713 -0.187862
v 0.741194 0.310713 -0.187862
v 0.741194 0.350713 -0.067862
v -0.741194 0.350713 -0.067862
v -0.329165 0.358626 0.171599
v -0.329165 0.522687 0.171599
v -0.329165 0.244227 -0.171599
v -0.329165 0.408287 -0.171599
v -0.462280 0.358626 0.171599
v -0.462280 0.522686 0.171599
v -0.462280 0.244227 -0.171599
v -0.462280 0.408287 -0.171599
v 0.753760 -0.166667 0.500000
v 0.753760 -0.166667 -0.500000
v -0.753760 -0.166667 0.500000
v -0.753760 -0.166667 -0.500000
v 0.753760 -0.500000 0.500000
v 0.753760 -0.500000 -0.500000
v -0.753760 -0.500000 0.500000
v -0.753760 -0.500000 -0.500000
vt 0.7427 0.1169
vt 0.7427 0.3317
vt 0.6400 0.3317
vt 0.6400 0.1169
vt 0.8260 0.3317
vt 0.8260 0.4343
vt 0.7427 0.4343
vt 0.8260 0.1169
vt 0.7427 0.0142
vt 0.8260 0.0142
vt 0.5691 0.2971
vt 0.5691 0.9229
vt 0.5378 0.9229
vt 0.5378 0.2971
vt 0.3413 0.2971
vt 0.3819 0.2971
vt 0.3819 0.9229
vt 0.3413 0.9229
vt 0.4291 0.9855
vt 0.4678 0.9730
vt 0.4833 0.9730
vt 0.5219 0.9855
vt 0.6097 0.9229
vt 0.6097 0.2971
vt 0.4678 0.2470
vt 0.4291 0.2345
vt 0.5219 0.2345
vt 0.4833 0.2470
vt 0.4833 0.2783
vt 0.4678 0.2783
vt 0.4132 0.2971
vt 0.4132 0.9229
vt 0.4678 0.9417
vt 0.4833 0.9417
vt 0.5182 0.9229
vt 0.5182 0.2971
vt 0.4328 0.2971
vt 0.4328 0.9229
vt 0.5026 0.9229
vt 0.5026 0.2971
vt 0.4485 0.2971
vt 0.4485 0.9229
vt 0.5026 0.2814
vt 0.4485 0.2814
vt 0.4485 0.9386
vt 0.5026 0.9386
vt 0.9588 0.9625
vt 0.8837 0.9625
vt 0.8837 0.0348
vt 0.9588 0.0348
vt 0.9901 0.9625
vt 0.9901 0.0348
vt 0.9588 0.0035
vt 0.8837 0.0035
vt 0.8524 0.0348
vt 0.8524 0.9625
vt 0.9588 0.9938
vt 0.8837 0.9938
vt 0.6554 0.3627
vt 0.6690 0.3627
vt 0.6690 0.9885
vt 0.6554 0.9885
vt 0.6972 0.9885
vt 0.6837 0.9885
vt 0.6837 0.3627
vt 0.6972 0.3627
vt 0.7119 0.3627
vt 0.7119 0.9885
vt 0.5691 0.2971
vt 0.5691 0.9229
vt 0.5378 0.9229
vt 0.5378 0.2971
vt 0.3413 0.2971
vt 0.3819 0.2971
vt 0.3819 0.9229
vt 0.3413 0.9229
vt 0.4291 0.9855
vt 0.4678 0.9730
vt 0.4833 0.9730
vt 0.5219 0.9855
vt 0.6097 0.9229
vt 0.6097 0.2971
vt 0.4678 0.2470
vt 0.4291 0.2345
vt 0.5219 0.2345
vt 0.4833 0.2470
vt 0.4833 0.2783
vt 0.4678 0.2783
vt 0.4132 0.2971
vt 0.4132 0.9229
vt 0.4678 0.9417
vt 0.4833 0.9417
vt 0.5182 0.9229
vt 0.5182 0.2971
vt 0.4328 0.2971
vt 0.4328 0.9229
vt 0.5026 0.9229
vt 0.5026 0.2971
vt 0.4485 0.2971
vt 0.4485 0.9229
vt 0.5026 0.2814
vt 0.4485 0.2814
vt 0.4485 0.9386
vt 0.5026 0.9386
vt 0.9588 0.9625
vt 0.8837 0.9625
vt 0.8837 0.0348
vt 0.9588 0.0348
vt 0.9901 0.9625
vt 0.9901 0.0348
vt 0.9588 0.0035
vt 0.8837 0.0035
vt 0.8524 0.0348
vt 0.8524 0.9625
vt 0.9588 0.9938
vt 0.8837 0.9938
vt 0.9588 0.9625
vt 0.8837 0.9625
vt 0.8837 0.0348
vt 0.9588 0.0348
vt 0.9901 0.9625
vt 0.9901 0.0348
vt 0.9588 0.0035
vt 0.8837 0.0035
vt 0.8524 0.0348
vt 0.8524 0.9625
vt 0.9588 0.9938
vt 0.8837 0.9938
vt 0.9588 0.9625
vt 0.8837 0.9625
vt 0.8837 0.0348
vt 0.9588 0.0348
vt 0.9901 0.9625
vt 0.9901 0.0348
vt 0.9588 0.0035
vt 0.8837 0.0035
vt 0.8524 0.0348
vt 0.8524 0.9625
vt 0.9588 0.9938
vt 0.8837 0.9938
vt 0.7427 0.1169
vt 0.6400 0.1169
vt 0.6400 0.3317
vt 0.7427 0.3317
vt 0.7427 0.4343
vt 0.8260 0.4343
vt 0.8260 0.3317
vt 0.8260 0.1169
vt 0.8260 0.0142
vt 0.7427 0.0142
vt 1.2190 -0.0648
vt -0.3252 -0.0648
vt -0.3252 -0.4063
vt 1.2190 -0.4063
vt 1.2222 1.0112
vt -0.3220 1.0112
vt -0.3220 0.6697
vt 1.2222 0.6697
vt 1.2190 1.0149
vt 1.5430 0.0432
vt -0.3252 1.0149
vt -0.6491 0.0432
vt -0.3220 0.3283
vt 1.2222 0.3283
vt -0.3240 0.3223
vt 0.7003 0.3223
vt 0.7003 0.6637
vt -0.3240 0.6637
vt 1.2202 1.0043
vt -0.3240 1.0043
vt -0.3240 0.6629
vt 1.2202 0.6629
vt 0.6998 1.0039
vt -0.3245 1.0039
vt -0.3245 0.6625
vt 0.6998 0.6625
vt -0.3246 1.0127
vt -0.3246 -0.0117
vt 1.2196 -0.0117
vt 1.2196 1.0127
vt 0.7003 1.0051
vt -0.3240 1.0051
vt -0.3240 0.3214
vt 1.2202 0.3214
vt -0.3245 0.3210
vt 0.6998 0.3210
vn -1.0000 0.0000 -0.0000
vn 0.0000 0.0000 -1.0000
vn -0.0000 0.0000 1.0000
vn 0.0000 0.9487 -0.3162
vn 1.0000 0.0000 0.0000
vn -0.2936 0.9069 -0.3023
vn 0.2936 0.9069 -0.3023
vn 0.1518 -0.9377 0.3126
vn -0.1518 -0.9377 0.3126
vn 0.0000 -0.9487 0.3162
vn 0.0000 -1.0000 0.0000
g dtrack_vst33_Cube.030_SlopeRailMaterial
s off
f 8/1/1 10/2/1 9/3/1 7/4/1
f 10/2/2 14/5/2 13/6/2 9/7/2
f 12/8/3 8/1/3 7/9/3 11/10/3
f 12/8/4 14/5/4 10/2/4 8/1/4
f 22/11/5 21/12/5 25/13/5 26/14/5
f 15/15/6 19/16/6 20/17/6 16/18/6
f 16/19/2 20/20/2 21/21/2 17/22/2
f 17/23/7 21/12/7 22/11/7 18/24/7
f 19/25/3 15/26/3 18/27/3 22/28/3
f 26/29/3 23/30/3 19/25/3 22/28/3
f 19/16/1 23/31/1 24/32/1 20/17/1
f 21/21/2 20/20/2 24/33/2 25/34/2
f 26/14/8 25/13/8 27/35/8 28/36/8
f 24/32/9 23/31/9 29/37/9 30/38/9
f 28/36/5 27/35/5 31/39/5 32/40/5
f 30/38/1 29/37/1 33/41/1 34/42/1
f 31/39/4 34/42/4 33/41/4 32/40/4
f 23/30/3 26/29/3 28/43/3 32/40/3 33/41/3 29/44/3
f 24/33/2 30/45/2 34/42/2 31/39/2 27/46/2 25/34/2
f 39/47/4 42/48/4 41/49/4 40/50/4
f 35/51/3 39/47/3 40/50/3 36/52/3
f 36/53/1 40/50/1 41/49/1 37/54/1
f 37/55/2 41/49/2 42/48/2 38/56/2
f 39/47/5 35/57/5 38/58/5 42/48/5
f 43/59/1 45/60/1 46/61/1 44/62/1
f 47/63/5 49/64/5 50/65/5 48/66/5
f 43/67/10 44/68/10 47/63/10 48/66/10
f 45/60/4 50/65/4 49/64/4 46/61/4
f 58/69/1 57/70/1 61/71/1 62/72/1
f 51/73/7 55/74/7 56/75/7 52/76/7
f 52/77/3 56/78/3 57/79/3 53/80/3
f 53/81/6 57/70/6 58/69/6 54/82/6
f 55/83/2 51/84/2 54/85/2 58/86/2
f 62/87/2 59/88/2 55/83/2 58/86/2
f 55/74/5 59/89/5 60/90/5 56/75/5
f 57/79/3 56/78/3 60/91/3 61/92/3
f 62/72/9 61/71/9 63/93/9 64/94/9
f 60/90/8 59/89/8 65/95/8 66/96/8
f 64/94/1 63/93/1 67/97/1 68/98/1
f 66/96/5 65/95/5 69/99/5 70/100/5
f 67/97/4 70/100/4 69/99/4 68/98/4
f 59/88/2 62/87/2 64/101/2 68/98/2 69/99/2 65/102/2
f 60/91/3 66/103/3 70/100/3 67/97/3 63/104/3 61/92/3
f 75/105/4 78/106/4 77/107/4 76/108/4
f 71/109/2 75/105/2 76/108/2 72/110/2
f 72/111/5 76/108/5 77/107/5 73/112/5
f 73/113/3 77/107/3 78/106/3 74/114/3
f 75/105/1 71/115/1 74/116/1 78/106/1
f 83/117/4 86/118/4 85/119/4 84/120/4
f 79/121/3 83/117/3 84/120/3 80/122/3
f 80/123/1 84/120/1 85/119/1 81/124/1
f 81/125/2 85/119/2 86/118/2 82/126/2
f 83/117/5 79/127/5 82/128/5 86/118/5
f 91/129/4 94/130/4 93/131/4 92/132/4
f 87/133/2 91/129/2 92/132/2 88/134/2
f 88/135/5 92/132/5 93/131/5 89/136/5
f 89/137/3 93/131/3 94/130/3 90/138/3
f 91/129/1 87/139/1 90/140/1 94/130/1
f 96/141/5 95/142/5 97/143/5 98/144/5
f 98/144/2 97/145/2 101/146/2 102/147/2
f 100/148/3 99/149/3 95/150/3 96/141/3
f 100/148/4 96/141/4 98/144/4 102/147/4
g dtrack_vst33_Cube.030_SlopeGravelMaterial
f 3/151/3 6/152/3 5/153/3 2/154/3
f 4/155/2 1/156/2 104/157/2 106/158/2
f 1/159/5 3/151/5 2/160/5
f 6/152/1 4/161/1 5/162/1
f 4/161/4 6/152/4 3/151/4 1/159/4
f 106/158/2 104/157/2 108/163/2 110/164/2
f 5/165/1 4/166/1 106/167/1 105/168/1
f 2/169/3 5/170/3 105/171/3 103/172/3
f 1/173/5 2/174/5 103/175/5 104/176/5
f 108/177/11 107/178/11 109/179/11 110/180/11
f 105/168/1 106/167/1 110/181/1 109/182/1
f 103/172/3 105/171/3 109/183/3 107/184/3
f 104/176/5 103/175/5 107/185/5 108/186/5
class="hl pps">"dungeongen.h" #include "cavegen.h" #include "treegen.h" #include "mg_biome.h" #include "mg_ore.h" #include "mg_decoration.h" #include "mapgen_flat.h" FlagDesc flagdesc_mapgen_flat[] = { {"lakes", MGFLAT_LAKES}, {"hills", MGFLAT_HILLS}, {NULL, 0} }; /////////////////////////////////////////////////////////////////////////////////////// MapgenFlat::MapgenFlat(int mapgenid, MapgenParams *params, EmergeManager *emerge) : Mapgen(mapgenid, params, emerge) { this->m_emerge = emerge; this->bmgr = emerge->biomemgr; //// amount of elements to skip for the next index //// for noise/height/biome maps (not vmanip) this->ystride = csize.X; // 1-down overgeneration this->zstride_1d = csize.X * (csize.Y + 1); this->biomemap = new u8[csize.X * csize.Z]; this->heightmap = new s16[csize.X * csize.Z]; this->heatmap = NULL; this->humidmap = NULL; MapgenFlatParams *sp = (MapgenFlatParams *)params->sparams; this->spflags = sp->spflags; this->ground_level = sp->ground_level; this->large_cave_depth = sp->large_cave_depth; this->cave_width = sp->cave_width; this->lake_threshold = sp->lake_threshold; this->lake_steepness = sp->lake_steepness; this->hill_threshold = sp->hill_threshold; this->hill_steepness = sp->hill_steepness; //// 2D noise noise_terrain = new Noise(&sp->np_terrain, seed, csize.X, csize.Z); noise_filler_depth = new Noise(&sp->np_filler_depth, seed, csize.X, csize.Z); //// 3D noise // 1-down overgeneraion noise_cave1 = new Noise(&sp->np_cave1, seed, csize.X, csize.Y + 1, csize.Z); noise_cave2 = new Noise(&sp->np_cave2, seed, csize.X, csize.Y + 1, csize.Z); //// Biome noise noise_heat = new Noise(&params->np_biome_heat, seed, csize.X, csize.Z); noise_humidity = new Noise(&params->np_biome_humidity, seed, csize.X, csize.Z); noise_heat_blend = new Noise(&params->np_biome_heat_blend, seed, csize.X, csize.Z); noise_humidity_blend = new Noise(&params->np_biome_humidity_blend, seed, csize.X, csize.Z); //// Resolve nodes to be used INodeDefManager *ndef = emerge->ndef; c_stone = ndef->getId("mapgen_stone"); c_water_source = ndef->getId("mapgen_water_source"); c_lava_source = ndef->getId("mapgen_lava_source"); c_desert_stone = ndef->getId("mapgen_desert_stone"); c_ice = ndef->getId("mapgen_ice"); c_sandstone = ndef->getId("mapgen_sandstone"); c_cobble = ndef->getId("mapgen_cobble"); c_stair_cobble = ndef->getId("mapgen_stair_cobble"); c_mossycobble = ndef->getId("mapgen_mossycobble"); c_sandstonebrick = ndef->getId("mapgen_sandstonebrick"); c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick"); if (c_ice == CONTENT_IGNORE) c_ice = CONTENT_AIR; if (c_mossycobble == CONTENT_IGNORE) c_mossycobble = c_cobble; if (c_stair_cobble == CONTENT_IGNORE) c_stair_cobble = c_cobble; if (c_sandstonebrick == CONTENT_IGNORE) c_sandstonebrick = c_sandstone; if (c_stair_sandstonebrick == CONTENT_IGNORE) c_stair_sandstonebrick = c_sandstone; } MapgenFlat::~MapgenFlat() { delete noise_terrain; delete noise_filler_depth; delete noise_cave1; delete noise_cave2; delete noise_heat; delete noise_humidity; delete noise_heat_blend; delete noise_humidity_blend; delete[] heightmap; delete[] biomemap; } MapgenFlatParams::MapgenFlatParams() { spflags = 0; ground_level = 8; large_cave_depth = -33; cave_width = 0.3; lake_threshold = -0.45; lake_steepness = 48.0; hill_threshold = 0.45; hill_steepness = 64.0; np_terrain = NoiseParams(0, 1, v3f(600, 600, 600), 7244, 5, 0.6, 2.0); np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0); np_cave1 = NoiseParams(0, 12, v3f(96, 96, 96), 52534, 4, 0.5, 2.0); np_cave2 = NoiseParams(0, 12, v3f(96, 96, 96), 10325, 4, 0.5, 2.0); } void MapgenFlatParams::readParams(const Settings *settings) { settings->getFlagStrNoEx("mgflat_spflags", spflags, flagdesc_mapgen_flat); settings->getS16NoEx("mgflat_ground_level", ground_level); settings->getS16NoEx("mgflat_large_cave_depth", large_cave_depth); settings->getFloatNoEx("mgflat_cave_width", cave_width); settings->getFloatNoEx("mgflat_lake_threshold", lake_threshold); settings->getFloatNoEx("mgflat_lake_steepness", lake_steepness); settings->getFloatNoEx("mgflat_hill_threshold", hill_threshold); settings->getFloatNoEx("mgflat_hill_steepness", hill_steepness); settings->getNoiseParams("mgflat_np_terrain", np_terrain); settings->getNoiseParams("mgflat_np_filler_depth", np_filler_depth); settings->getNoiseParams("mgflat_np_cave1", np_cave1); settings->getNoiseParams("mgflat_np_cave2", np_cave2); } void MapgenFlatParams::writeParams(Settings *settings) const { settings->setFlagStr("mgflat_spflags", spflags, flagdesc_mapgen_flat, U32_MAX); settings->setS16("mgflat_ground_level", ground_level); settings->setS16("mgflat_large_cave_depth", large_cave_depth); settings->setFloat("mgflat_cave_width", cave_width); settings->setFloat("mgflat_lake_threshold", lake_threshold); settings->setFloat("mgflat_lake_steepness", lake_steepness); settings->setFloat("mgflat_hill_threshold", hill_threshold); settings->setFloat("mgflat_hill_steepness", hill_steepness); settings->setNoiseParams("mgflat_np_terrain", np_terrain); settings->setNoiseParams("mgflat_np_filler_depth", np_filler_depth); settings->setNoiseParams("mgflat_np_cave1", np_cave1); settings->setNoiseParams("mgflat_np_cave2", np_cave2); } ///////////////////////////////////////////////////////////////// int MapgenFlat::getSpawnLevelAtPoint(v2s16 p) { s16 level_at_point = ground_level; float n_terrain = NoisePerlin2D(&noise_terrain->np, p.X, p.Y, seed); if ((spflags & MGFLAT_LAKES) && n_terrain < lake_threshold) { level_at_point = ground_level - (lake_threshold - n_terrain) * lake_steepness; } else if ((spflags & MGFLAT_HILLS) && n_terrain > hill_threshold) { level_at_point = ground_level + (n_terrain - hill_threshold) * hill_steepness; } if (ground_level < water_level) // Ocean world, allow spawn in water return MYMAX(level_at_point, water_level); else if (level_at_point > water_level) return level_at_point; // Spawn on land else return MAX_MAP_GENERATION_LIMIT; // Unsuitable spawn point } void MapgenFlat::makeChunk(BlockMakeData *data) { // Pre-conditions assert(data->vmanip); assert(data->nodedef); assert(data->blockpos_requested.X >= data->blockpos_min.X && data->blockpos_requested.Y >= data->blockpos_min.Y && data->blockpos_requested.Z >= data->blockpos_min.Z); assert(data->blockpos_requested.X <= data->blockpos_max.X && data->blockpos_requested.Y <= data->blockpos_max.Y && data->blockpos_requested.Z <= data->blockpos_max.Z); this->generating = true; this->vm = data->vmanip; this->ndef = data->nodedef; //TimeTaker t("makeChunk"); v3s16 blockpos_min = data->blockpos_min; v3s16 blockpos_max = data->blockpos_max; node_min = blockpos_min * MAP_BLOCKSIZE; node_max = (blockpos_max + v3s16(1, 1, 1)) * MAP_BLOCKSIZE - v3s16(1, 1, 1); full_node_min = (blockpos_min - 1) * MAP_BLOCKSIZE; full_node_max = (blockpos_max + 2) * MAP_BLOCKSIZE - v3s16(1, 1, 1); blockseed = getBlockSeed2(full_node_min, seed); // Make some noise calculateNoise(); // Generate base terrain, mountains, and ridges with initial heightmaps s16 stone_surface_max_y = generateTerrain(); // Create heightmap updateHeightmap(node_min, node_max); // Create biomemap at heightmap surface bmgr->calcBiomes(csize.X, csize.Z, noise_heat->result, noise_humidity->result, heightmap, biomemap); // Actually place the biome-specific nodes MgStoneType stone_type = generateBiomes(noise_heat->result, noise_humidity->result); if (flags & MG_CAVES) generateCaves(stone_surface_max_y); if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) { DungeonParams dp; dp.np_rarity = nparams_dungeon_rarity; dp.np_density = nparams_dungeon_density; dp.np_wetness = nparams_dungeon_wetness; dp.c_water = c_water_source; if (stone_type == STONE) { dp.c_cobble = c_cobble; dp.c_moss = c_mossycobble; dp.c_stair = c_stair_cobble; dp.diagonal_dirs = false; dp.mossratio = 3.0; dp.holesize = v3s16(1, 2, 1); dp.roomsize = v3s16(0, 0, 0); dp.notifytype = GENNOTIFY_DUNGEON; } else if (stone_type == DESERT_STONE) { dp.c_cobble = c_desert_stone; dp.c_moss = c_desert_stone; dp.c_stair = c_desert_stone; dp.diagonal_dirs = true; dp.mossratio = 0.0; dp.holesize = v3s16(2, 3, 2); dp.roomsize = v3s16(2, 5, 2); dp.notifytype = GENNOTIFY_TEMPLE; } else if (stone_type == SANDSTONE) { dp.c_cobble = c_sandstonebrick; dp.c_moss = c_sandstonebrick; dp.c_stair = c_sandstonebrick; dp.diagonal_dirs = false; dp.mossratio = 0.0; dp.holesize = v3s16(2, 2, 2); dp.roomsize = v3s16(2, 0, 2); dp.notifytype = GENNOTIFY_DUNGEON; } DungeonGen dgen(this, &dp); dgen.generate(blockseed, full_node_min, full_node_max); } // Generate the registered decorations if (flags & MG_DECORATIONS) m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max); // Generate the registered ores m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); // Sprinkle some dust on top after everything else was generated dustTopNodes(); //printf("makeChunk: %dms\n", t.stop()); updateLiquid(&data->transforming_liquid, full_node_min, full_node_max); if (flags & MG_LIGHT) calcLighting(node_min - v3s16(0, 1, 0), node_max + v3s16(0, 1, 0), full_node_min, full_node_max); //setLighting(node_min - v3s16(1, 0, 1) * MAP_BLOCKSIZE, // node_max + v3s16(1, 0, 1) * MAP_BLOCKSIZE, 0xFF); this->generating = false; } void MapgenFlat::calculateNoise() { //TimeTaker t("calculateNoise", NULL, PRECISION_MICRO); s16 x = node_min.X; s16 z = node_min.Z; if ((spflags & MGFLAT_LAKES) || (spflags & MGFLAT_HILLS)) noise_terrain->perlinMap2D(x, z); // Cave noises are calculated in generateCaves() // only if solid terrain is present in mapchunk noise_filler_depth->perlinMap2D(x, z); noise_heat->perlinMap2D(x, z); noise_humidity->perlinMap2D(x, z); noise_heat_blend->perlinMap2D(x, z); noise_humidity_blend->perlinMap2D(x, z); for (s32 i = 0; i < csize.X * csize.Z; i++) { noise_heat->result[i] += noise_heat_blend->result[i]; noise_humidity->result[i] += noise_humidity_blend->result[i]; } heatmap = noise_heat->result; humidmap = noise_humidity->result; //printf("calculateNoise: %dus\n", t.stop()); } s16 MapgenFlat::generateTerrain() { MapNode n_air(CONTENT_AIR); MapNode n_stone(c_stone); MapNode n_water(c_water_source); v3s16 em = vm->m_area.getExtent(); s16 stone_surface_max_y = -MAX_MAP_GENERATION_LIMIT; u32 ni2d = 0; for (s16 z = node_min.Z; z <= node_max.Z; z++) for (s16 x = node_min.X; x <= node_max.X; x++, ni2d++) { s16 stone_level = ground_level; float n_terrain = 0.0f; if ((spflags & MGFLAT_LAKES) || (spflags & MGFLAT_HILLS)) n_terrain = noise_terrain->result[ni2d]; if ((spflags & MGFLAT_LAKES) && n_terrain < lake_threshold) { s16 depress = (lake_threshold - n_terrain) * lake_steepness; stone_level = ground_level - depress; } else if ((spflags & MGFLAT_HILLS) && n_terrain > hill_threshold) { s16 rise = (n_terrain - hill_threshold) * hill_steepness; stone_level = ground_level + rise; } u32 vi = vm->m_area.index(x, node_min.Y - 1, z); for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) { if (vm->m_data[vi].getContent() == CONTENT_IGNORE) { if (y <= stone_level) { vm->m_data[vi] = n_stone; if (y > stone_surface_max_y) stone_surface_max_y = y; } else if (y <= water_level) { vm->m_data[vi] = n_water; } else { vm->m_data[vi] = n_air; } } vm->m_area.add_y(em, vi, 1); } } return stone_surface_max_y; } MgStoneType MapgenFlat::generateBiomes(float *heat_map, float *humidity_map) { v3s16 em = vm->m_area.getExtent(); u32 index = 0; MgStoneType stone_type = STONE; for (s16 z = node_min.Z; z <= node_max.Z; z++) for (s16 x = node_min.X; x <= node_max.X; x++, index++) { Biome *biome = NULL; u16 depth_top = 0; u16 base_filler = 0; u16 depth_water_top = 0; u32 vi = vm->m_area.index(x, node_max.Y, z); // Check node at base of mapchunk above, either a node of a previously // generated mapchunk or if not, a node of overgenerated base terrain. content_t c_above = vm->m_data[vi + em.X].getContent(); bool air_above = c_above == CONTENT_AIR; bool water_above = c_above == c_water_source; // If there is air or water above enable top/filler placement, otherwise force // nplaced to stone level by setting a number exceeding any possible filler depth. u16 nplaced = (air_above || water_above) ? 0 : U16_MAX; for (s16 y = node_max.Y; y >= node_min.Y; y--) { content_t c = vm->m_data[vi].getContent(); // Biome is recalculated each time an upper surface is detected while // working down a column. The selected biome then remains in effect for // all nodes below until the next surface and biome recalculation. // Biome is recalculated: // 1. At the surface of stone below air or water. // 2. At the surface of water below air. // 3. When stone or water is detected but biome has not yet been calculated. if ((c == c_stone && (air_above || water_above || !biome)) || (c == c_water_source && (air_above || !biome))) { biome = bmgr->getBiome(heat_map[index], humidity_map[index], y); depth_top = biome->depth_top; base_filler = MYMAX(depth_top + biome->depth_filler + noise_filler_depth->result[index], 0); depth_water_top = biome->depth_water_top; // Detect stone type for dungeons during every biome calculation. // This is more efficient than detecting per-node and will not // miss any desert stone or sandstone biomes. if (biome->c_stone == c_desert_stone) stone_type = DESERT_STONE; else if (biome->c_stone == c_sandstone) stone_type = SANDSTONE; } if (c == c_stone) { content_t c_below = vm->m_data[vi - em.X].getContent(); // If the node below isn't solid, make this node stone, so that // any top/filler nodes above are structurally supported. // This is done by aborting the cycle of top/filler placement // immediately by forcing nplaced to stone level. if (c_below == CONTENT_AIR || c_below == c_water_source) nplaced = U16_MAX; if (nplaced < depth_top) { vm->m_data[vi] = MapNode(biome->c_top); nplaced++;