stone_surface_max_y = y;
}
}
- index2d = index2d - ystride;
+ index2d -= ystride;
}
- index2d = index2d + ystride;
+ index2d += ystride;
}
return stone_surface_max_y;
if (node_max.Y < water_level)
return false;
- MapNode n_air(CONTENT_AIR);
- MapNode n_stone(c_stone);
- MapNode n_water(c_water_source);
-
v3s16 em = vm->m_area.getExtent();
u32 index = 0;
bool desert_stone = false;
if (d1*d2 > 0.125)
vm->m_data[i] = MapNode(CONTENT_AIR);
}
- index2d = index2d - ystride;
+ index2d -= ystride;
}
- index2d = index2d + ystride;
+ index2d += ystride;
}
if (node_max.Y > LARGE_CAVE_DEPTH)
if (biome->c_dust == CONTENT_IGNORE)
continue;
- s16 y_full_max = full_node_max.Y;
- u32 vi_full_max = vm->m_area.index(x, y_full_max, z);
- content_t c_full_max = vm->m_data[vi_full_max].getContent();
+ u32 vi = vm->m_area.index(x, full_node_max.Y, z);
+ content_t c_full_max = vm->m_data[vi].getContent();
s16 y_start;
if (c_full_max == CONTENT_AIR) {
- y_start = y_full_max - 1;
+ y_start = full_node_max.Y - 1;
} else if (c_full_max == CONTENT_IGNORE) {
- s16 y_max = node_max.Y;
- u32 vi_max = vm->m_area.index(x, y_max, z);
- content_t c_max = vm->m_data[vi_max].getContent();
+ vi = vm->m_area.index(x, node_max.Y + 1, z);
+ content_t c_max = vm->m_data[vi].getContent();
if (c_max == CONTENT_AIR)
- y_start = y_max - 1;
+ y_start = node_max.Y;
else
continue;
} else {
continue;
}
- u32 vi = vm->m_area.index(x, y_start, z);
+ vi = vm->m_area.index(x, y_start, z);
for (s16 y = y_start; y >= node_min.Y - 1; y--) {
if (vm->m_data[vi].getContent() != CONTENT_AIR)
break;
//// amount of elements to skip for the next index
//// for noise/height/biome maps (not vmanip)
this->ystride = csize.X;
- this->zstride = csize.X * csize.Y;
+ this->zstride = csize.X * (csize.Y + 2);
this->biomemap = new u8[csize.X * csize.Z];
this->heightmap = new s16[csize.X * csize.Z];
noise_ridge_uwater = new Noise(&sp->np_ridge_uwater, seed, csize.X, csize.Z);
//// 3d terrain noise
- noise_mountain = new Noise(&sp->np_mountain, seed, csize.X, csize.Y, csize.Z);
- noise_ridge = new Noise(&sp->np_ridge, seed, csize.X, csize.Y, csize.Z);
- noise_cave1 = new Noise(&sp->np_cave1, seed, csize.X, csize.Y, csize.Z);
- noise_cave2 = new Noise(&sp->np_cave2, seed, csize.X, csize.Y, csize.Z);
+ noise_mountain = new Noise(&sp->np_mountain, seed, csize.X, csize.Y + 2, csize.Z);
+ noise_ridge = new Noise(&sp->np_ridge, seed, csize.X, csize.Y + 2, csize.Z);
+ noise_cave1 = new Noise(&sp->np_cave1, seed, csize.X, csize.Y + 2, csize.Z);
+ noise_cave2 = new Noise(&sp->np_cave2, seed, csize.X, csize.Y + 2, csize.Z);
//// Biome noise
noise_heat = new Noise(¶ms->np_biome_heat, seed, csize.X, csize.Z);
updateLiquid(&data->transforming_liquid, full_node_min, full_node_max);
if (flags & MG_LIGHT)
- calcLighting(node_min, node_max);
+ 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);
{
//TimeTaker t("calculateNoise", NULL, PRECISION_MICRO);
int x = node_min.X;
- int y = node_min.Y;
+ int y = node_min.Y - 1;
int z = node_min.Z;
noise_terrain_persist->perlinMap2D(x, z);
if (surface_y > stone_surface_max_y)
stone_surface_max_y = surface_y;
- u32 i = vm->m_area.index(x, node_min.Y, z);
- for (s16 y = node_min.Y; y <= node_max.Y; y++) {
+ u32 i = 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[i].getContent() == CONTENT_IGNORE) {
if (y <= surface_y)
vm->m_data[i] = n_stone;
u32 j = 0;
for (s16 z = node_min.Z; z <= node_max.Z; z++)
- for (s16 y = node_min.Y; y <= node_max.Y; y++) {
+ for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) {
u32 vi = vm->m_area.index(node_min.X, y, z);
for (s16 x = node_min.X; x <= node_max.X; x++) {
int index = (z - node_min.Z) * csize.X + (x - node_min.X);
float width = 0.2; // TODO: figure out acceptable perlin noise values
for (s16 z = node_min.Z; z <= node_max.Z; z++)
- for (s16 y = node_min.Y; y <= node_max.Y; y++) {
+ for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) {
u32 vi = vm->m_area.index(node_min.X, y, z);
for (s16 x = node_min.X; x <= node_max.X; x++, index++, vi++) {
int j = (z - node_min.Z) * csize.X + (x - node_min.X);
if (node_max.Y < water_level)
return false;
- MapNode n_air(CONTENT_AIR);
- MapNode n_stone(c_stone);
- MapNode n_water(c_water_source);
-
v3s16 em = vm->m_area.getExtent();
u32 index = 0;
bool desert_stone = false;
for (s16 y = node_max.Y; y >= node_min.Y; y--) {
content_t c = vm->m_data[i].getContent();
- // It could be the case that the elevation is equal to the chunk
- // boundary, but the chunk above has not been generated yet
- if (y == node_max.Y && c_above == CONTENT_IGNORE &&
- y == heightmap[index] && c == c_stone) {
- int j = (z - node_min.Z) * zstride +
- (y - node_min.Y) * ystride +
- (x - node_min.X);
- have_air = !getMountainTerrainFromMap(j, index, y);
- }
-
if (c != CONTENT_IGNORE && c != CONTENT_AIR && (y == node_max.Y || have_air)) {
biome = bmgr->getBiome(heat_map[index], humidity_map[index], y);
dfiller = biome->depth_filler + noise_filler_depth->result[index];
if (biome->c_dust == CONTENT_IGNORE)
continue;
- s16 y_full_max = full_node_max.Y;
- u32 vi_full_max = vm->m_area.index(x, y_full_max, z);
- content_t c_full_max = vm->m_data[vi_full_max].getContent();
+ u32 vi = vm->m_area.index(x, full_node_max.Y, z);
+ content_t c_full_max = vm->m_data[vi].getContent();
s16 y_start;
if (c_full_max == CONTENT_AIR) {
- y_start = y_full_max - 1;
+ y_start = full_node_max.Y - 1;
} else if (c_full_max == CONTENT_IGNORE) {
- s16 y_max = node_max.Y;
- u32 vi_max = vm->m_area.index(x, y_max, z);
- content_t c_max = vm->m_data[vi_max].getContent();
+ vi = vm->m_area.index(x, node_max.Y + 1, z);
+ content_t c_max = vm->m_data[vi].getContent();
if (c_max == CONTENT_AIR)
- y_start = y_max - 1;
+ y_start = node_max.Y;
else
continue;
} else {
continue;
}
- u32 vi = vm->m_area.index(x, y_start, z);
+ vi = vm->m_area.index(x, y_start, z);
for (s16 y = y_start; y >= node_min.Y - 1; y--) {
if (vm->m_data[vi].getContent() != CONTENT_AIR)
break;
u32 index2d = 0;
for (s16 z = node_min.Z; z <= node_max.Z; z++) {
- for (s16 y = node_min.Y; y <= node_max.Y; y++) {
+ for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) {
u32 i = vm->m_area.index(node_min.X, y, z);
for (s16 x = node_min.X; x <= node_max.X;
x++, i++, index++, index2d++) {