ofs | hex dump | ascii |
---|
0000 | 4f 67 67 53 00 02 00 00 00 00 00 00 00 00 57 a0 5e 67 00 00 00 00 a1 9b d9 2b 01 1e 01 76 6f 72 | OggS..........W.^g.......+...vor |
0020 | 62 69 73 00 00 00 00 01 44 ac 00 00 00 00 00 00 00 77 01 00 00 00 00 00 b8 01 4f 67 67 53 00 00 | bis.....D........w........OggS.. |
0040 | 00 00 00 00 00 00 00 00 57 a0 5e 67 01 00 00 00 ae aa 6f 72 10 ab ff ff ff ff ff ff ff ff ff ff | ........W.^g......or............ |
0060 | ff ff ff ff c9 03 76 6f 72 62 69 73 2f 00 00 00 58 69 70 68 2e 4f 72 67 20 6c 69 62 56 6f 72 62 | ......vorbis/...Xiph.Org.libVorb |
0080 | 69 73 20 49 20 32 30 31 34 30 31 32 32 20 28 54 75 72 70 61 6b c3 a4 72 c3 a4 6a 69 69 6e 29 01 | is.I.20140122.(Turpak..r..jiin). |
00a0 | 00 00 00 68 00 00 00 44 45 53 43 52 49 50 54 49 4f 4e 3d 4d 65 74 72 6f 20 64 65 20 4c 69 73 62 | ...h...DESCRIPTION=Metro.de.Lisb |
00c0 | 6f 61 20 74 72 61 69 6e 20 73 74 6f 70 70 69 6e 67 2c 20 72 65 63 6f 72 64 65 64 20 69 6e 73 69 | oa.train.stopping,.recorded.insi |
00e0 | 64 65 20 74 68 65 20 74 72 61 69 6e 20 6f 6e 20 4a 61 6e 75 61 72 79 20 31 30 2c 20 32 30 31 37 | de.the.train.on.January.10,.2017 |
0100 | 2e 20 50 75 62 6c 69 63 20 64 6f 6d 61 69 6e 01 05 76 6f 72 62 69 73 29 42 43 56 01 00 08 00 00 | ..Public.domain..vorbis)BCV..... |
0120 | 00 31 4c 20 c5 80 d0 90 55 00 00 10 00 00 60 24 29 0e 93 66 49 29 a5 94 a1 28 79 98 94 48 49 29 | .1L.....U.....`$)..fI)...(y..HI) |
0140 | a5 94 c5 30 89 98 94 89 c5 18 63 8c 31 c6 18 63 8c 31 c6 18 63 8c 20 34 64 15 00 00 04 00 80 28 | ...0......c.1..c.1..c..4d......( |
0160 | 09 8e a3 e6 49 6a ce 39 67 18 27 8e 72 a0 39 69 4e 38 a7 20 07 8a 51 e0 39 09 c2 f5 26 63 6e a6 | ....Ij.9g.'.r.9iN8....Q.9...&cn. |
0180 | b4 a6 6b 6e ce 29 25 08 0d 59 05 00 00 02 00 40 48 21 85 14 52 48 21 85 14 62 88 21 86 18 62 88 | ..kn.)%..Y.....@H!..RH!..b.!..b. |
01a0 | 21 87 1c 72 c8 21 a7 9c 72 0a 2a a8 a0 82 0a 32 c8 20 83 4c 32 e9 a4 93 4e 3a e9 a8 a3 8e 3a ea | !..r.!..r.*....2...L2...N:....:. |
01c0 | 28 b4 d0 42 0b 2d b4 d2 4a 4c 31 d5 56 63 ae bd 06 5d 7c 73 ce 39 e7 9c 73 ce 39 e7 9c 73 ce 09 | (..B.-..JL1.Vc...]|s.9..s.9..s.. |
01e0 | 42 43 56 01 00 20 00 00 04 42 06 19 64 10 42 08 21 85 14 52 88 29 a6 98 72 0a 32 c8 80 d0 90 55 | BCV......B..d.B.!..R.)..r.2....U |
0200 | 00 00 20 00 80 00 00 00 00 47 91 14 49 b1 14 cb b1 1c cd d1 24 4f f2 2c 51 13 35 d1 33 45 53 54 | .........G..I.......$O.,Q.5.3EST |
0220 | 4d 55 55 55 55 75 5d 57 76 65 d7 76 75 d7 76 7d 59 98 85 5b b8 7d 59 b8 85 5b d8 85 5d f7 85 61 | MUUUUu]Wve.vu.v}Y..[.}Y..[..]..a |
0240 | 18 86 61 18 86 61 18 86 61 f8 7d df f7 7d df f7 7d 20 34 64 15 00 20 01 00 a0 23 39 96 e3 29 a2 | ..a..a..a.}..}..}.4d......#9..). |
0260 | 22 1a a2 e2 39 a2 03 84 86 ac 02 00 64 00 00 04 00 20 09 92 22 29 92 a3 49 a6 66 6a ae 69 9b b6 | "...9.......d.......")..I.fj.i.. |
0280 | 68 ab b6 6d cb b2 2c cb b2 0c 84 86 ac 02 00 00 01 00 04 00 00 00 00 00 a0 69 9a a6 69 9a a6 69 | h..m..,..................i..i..i |
02a0 | 9a a6 69 9a a6 69 9a a6 69 9a a6 69 9a 66 59 96 65 59 96 65 59 96 65 59 96 65 59 96 65 59 96 65 | ..i..i..i..i.fY.eY.eY.eY.eY.eY.e |
02c0 | 59 96 65 59 96 65 59 96 65 59 96 65 59 96 65 59 96 65 59 40 68 c8 2a 00 40 02 00 40 c7 71 1c c7 | Y.eY.eY.eY.eY.eY.eY@h.*.@..@.q.. |
02e0 | 71 24 45 52 24 c7 72 2c 07 08 0d 59 05 00 c8 00 00 08 00 40 52 2c c5 72 34 47 73 34 c7 73 3c c7 | q$ER$.r,...Y.......@R,.r4Gs4.s<. |
0300 | 73 3c 47 74 44 c9 94 4c cd f4 4c 0f 08 0d 59 05 00 00 02 00 08 00 00 00 00 00 40 31 1c c5 71 1c | s<GtD..L..L...Y...........@1..q. |
0320 | c9 d1 24 4f 52 2d d3 72 35 57 73 3d d7 73 4d d7 75 5d 57 55 55 55 55 55 55 55 55 55 55 55 55 55 | ..$OR-.r5Ws=.sM.u]WUUUUUUUUUUUUU |
0340 | 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 81 d0 90 55 00 00 04 00 00 21 9d | UUUUUUUUUUUUUUUUUUUUU...U.....!. |
0360 | 66 96 6a 80 08 33 90 61 20 34 64 15 00 80 00 00 00 18 a1 08 43 0c 08 0d 59 05 00 00 04 00 00 88 | f.j..3.a.4d.........C...Y....... |
0380 | a1 e4 20 9a d0 9a f3 cd 39 0e 9a e5 a0 a9 14 9b d3 c1 89 54 9b 27 b9 a9 98 9b 73 ce 39 e7 9c 6c | ........9..........T.'....s.9..l |
03a0 | ce 19 e3 9c 73 ce 29 ca 99 c5 a0 99 d0 9a 73 ce 49 0c 9a a5 a0 99 d0 9a 73 ce 79 12 9b 07 ad a9 | ....s.).......s.I.......s.y..... |
03c0 | d2 9a 73 ce 19 e7 9c 0e c6 19 61 9c 73 ce 69 d2 9a 07 a9 d9 58 9b 73 ce 59 d0 9a e6 a8 b9 14 9b | ..s.......a.s.i.....X.s.Y....... |
03e0 | 73 ce 89 94 9b 27 b5 b9 54 9b 73 ce 39 e7 9c 73 ce 39 e7 9c 73 ce a9 5e 9c ce c1 39 e1 9c 73 ce | s....'..T.s.9..s.9..s..^...9..s. |
/*
Minetest
Copyright (C) 2014-2018 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
Copyright (C) 2014-2018 paramat
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include "objdef.h"
#include "nodedef.h"
#include "noise.h"
class Server;
class Settings;
class BiomeManager;
////
//// Biome
////
typedef u8 biome_t;
#define BIOME_NONE ((biome_t)0)
enum BiomeType {
BIOMETYPE_NORMAL,
};
class Biome : public ObjDef, public NodeResolver {
public:
u32 flags;
content_t c_top;
content_t c_filler;
content_t c_stone;
content_t c_water_top;
content_t c_water;
content_t c_river_water;
content_t c_riverbed;
content_t c_dust;
std::vector<content_t> c_cave_liquid;
content_t c_dungeon;
content_t c_dungeon_alt;
content_t c_dungeon_stair;
s16 depth_top;
s16 depth_filler;
s16 depth_water_top;
s16 depth_riverbed;
v3s16 min_pos;
v3s16 max_pos;
float heat_point;
float humidity_point;
s16 vertical_blend;
virtual void resolveNodeNames();
};
////
//// BiomeGen
////
enum BiomeGenType {
BIOMEGEN_ORIGINAL,
};
struct BiomeParams {
virtual void readParams(const Settings *settings) = 0;
virtual void writeParams(Settings *settings) const = 0;
virtual ~BiomeParams() = default;
s32 seed;
};
class BiomeGen {
public:
virtual ~BiomeGen() = default;
virtual BiomeGenType getType() const = 0;
// Calculates the biome at the exact position provided. This function can
// be called at any time, but may be less efficient than the latter methods,
// depending on implementation.
virtual Biome *calcBiomeAtPoint(v3s16 pos) const = 0;
// Computes any intermediate results needed for biome generation. Must be
// called before using any of: getBiomes, getBiomeAtPoint, or getBiomeAtIndex.
// Calling this invalidates the previous results stored in biomemap.
virtual void calcBiomeNoise(v3s16 pmin) = 0;
// Gets all biomes in current chunk using each corresponding element of
// heightmap as the y position, then stores the results by biome index in
// biomemap (also returned)
virtual biome_t *getBiomes(s16 *heightmap, v3s16 pmin) = 0;
// Gets a single biome at the specified position, which must be contained
// in the region formed by m_pmin and (m_pmin + m_csize - 1).
virtual Biome *getBiomeAtPoint(v3s16 pos) const = 0;
// Same as above, but uses a raw numeric index correlating to the (x,z) position.
virtual Biome *getBiomeAtIndex(size_t index, v3s16 pos) const = 0;
// Result of calcBiomes bulk computation.
biome_t *biomemap = nullptr;
protected:
BiomeManager *m_bmgr = nullptr;
v3s16 m_pmin;
v3s16 m_csize;
};
////
//// BiomeGen implementations
////
//
// Original biome algorithm (Whittaker's classification + surface height)
//
struct BiomeParamsOriginal : public BiomeParams {
BiomeParamsOriginal() :
np_heat(50, 50, v3f(1000.0, 1000.0, 1000.0), 5349, 3, 0.5, 2.0),
np_humidity(50, 50, v3f(1000.0, 1000.0, 1000.0), 842, 3, 0.5, 2.0),
np_heat_blend(0, 1.5, v3f(8.0, 8.0, 8.0), 13, 2, 1.0, 2.0),
np_humidity_blend(0, 1.5, v3f(8.0, 8.0, 8.0), 90003, 2, 1.0, 2.0)
{
}
virtual void readParams(const Settings *settings);
virtual void writeParams(Settings *settings) const;
NoiseParams np_heat;
NoiseParams np_humidity;
NoiseParams np_heat_blend;
NoiseParams np_humidity_blend;
};
class BiomeGenOriginal : public BiomeGen {
public:
BiomeGenOriginal(BiomeManager *biomemgr,
BiomeParamsOriginal *params, v3s16 chunksize);
virtual ~BiomeGenOriginal();
BiomeGenType getType() const { return BIOMEGEN_ORIGINAL; }
Biome *calcBiomeAtPoint(v3s16 pos) const;
void calcBiomeNoise(v3s16 pmin);
biome_t *getBiomes(s16 *heightmap, v3s16 pmin);
Biome *getBiomeAtPoint(v3s16 pos) const;
Biome *getBiomeAtIndex(size_t index, v3s16 pos) const;
Biome *calcBiomeFromNoise(float heat, float humidity, v3s16 pos) const;
float *heatmap;
float *humidmap;
private:
BiomeParamsOriginal *m_params;
Noise *noise_heat;
Noise *noise_humidity;
Noise *noise_heat_blend;
Noise *noise_humidity_blend;
};
////
//// BiomeManager
////
class BiomeManager : public ObjDefManager {
public:
BiomeManager(Server *server);
virtual ~BiomeManager() = default;
const char *getObjectTitle() const
{
return "biome";
}
static Biome *create(BiomeType type)
{
return new Biome;
}
BiomeGen *createBiomeGen(BiomeGenType type, BiomeParams *params, v3s16 chunksize)
{
switch (type) {
case BIOMEGEN_ORIGINAL:
return new BiomeGenOriginal(this,
(BiomeParamsOriginal *)params, chunksize);
default:
return NULL;
}
}
static BiomeParams *createBiomeParams(BiomeGenType type)
{
switch (type) {
case BIOMEGEN_ORIGINAL:
return new BiomeParamsOriginal;
default:
return NULL;
}
}
virtual void clear();
// For BiomeGen type 'BiomeGenOriginal'
float getHeatAtPosOriginal(v3s16 pos, NoiseParams &np_heat,
NoiseParams &np_heat_blend, u64 seed);
float getHumidityAtPosOriginal(v3s16 pos, NoiseParams &np_humidity,
NoiseParams &np_humidity_blend, u64 seed);
Biome *getBiomeFromNoiseOriginal(float heat, float humidity, v3s16 pos);
private:
Server *m_server;
};
|