diff --git a/world/blocky/terrain_2d_world_blocky.cpp b/world/blocky/terrain_2d_world_blocky.cpp index a486d33..42824f4 100644 --- a/world/blocky/terrain_2d_world_blocky.cpp +++ b/world/blocky/terrain_2d_world_blocky.cpp @@ -46,7 +46,6 @@ Ref Terrain2DWorldBlocky::_create_chunk(int x, int z, Ref liquid_mesher; liquid_mesher.instance(); liquid_mesher->set_channel_index_type(Terrain2DChunkDefault::DEFAULT_CHANNEL_LIQUID_TYPE); - liquid_mesher->set_channel_index_isolevel(Terrain2DChunkDefault::DEFAULT_CHANNEL_LIQUID_ISOLEVEL); tj->set_liquid_mesher(liquid_mesher); Ref pj; diff --git a/world/default/terrain_2d_chunk_default.cpp b/world/default/terrain_2d_chunk_default.cpp index fb8f90e..a2c7e69 100644 --- a/world/default/terrain_2d_chunk_default.cpp +++ b/world/default/terrain_2d_chunk_default.cpp @@ -652,7 +652,7 @@ void Terrain2DChunkDefault::draw_debug_voxels(int max, Color color) { continue; } - draw_cross_voxels_fill(Vector3(x, get_voxel(x, z, Terrain2DChunkDefault::DEFAULT_CHANNEL_ISOLEVEL), z), get_voxel(x, z, Terrain2DChunkDefault::DEFAULT_CHANNEL_ISOLEVEL) / 255.0 * get_voxel_scale() * 2.0); + draw_cross_voxels_fill(Vector3(x, 0, z), 1); ++a; @@ -970,9 +970,7 @@ void Terrain2DChunkDefault::_bind_methods() { ClassDB::bind_method(D_METHOD("_finalize_build"), &Terrain2DChunkDefault::_finalize_build); BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_TYPE); - BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_ISOLEVEL); BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_LIQUID_TYPE); - BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_LIQUID_ISOLEVEL); BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_LIGHT_COLOR_R); BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_LIGHT_COLOR_G); BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_LIGHT_COLOR_B); diff --git a/world/default/terrain_2d_chunk_default.h b/world/default/terrain_2d_chunk_default.h index 77eb314..a8c0b8a 100644 --- a/world/default/terrain_2d_chunk_default.h +++ b/world/default/terrain_2d_chunk_default.h @@ -64,9 +64,7 @@ public: enum DefaultChannels { DEFAULT_CHANNEL_TYPE = 0, - DEFAULT_CHANNEL_ISOLEVEL, DEFAULT_CHANNEL_LIQUID_TYPE, - DEFAULT_CHANNEL_LIQUID_ISOLEVEL, DEFAULT_CHANNEL_LIGHT_COLOR_R, DEFAULT_CHANNEL_LIGHT_COLOR_G, DEFAULT_CHANNEL_LIGHT_COLOR_B, diff --git a/world/default/terrain_2d_world_default.cpp b/world/default/terrain_2d_world_default.cpp index 46bd954..6a18fed 100644 --- a/world/default/terrain_2d_world_default.cpp +++ b/world/default/terrain_2d_world_default.cpp @@ -219,7 +219,7 @@ int Terrain2DWorldDefault::_get_channel_index_info(const Terrain2DWorld::Channel case CHANNEL_TYPE_INFO_TYPE: return Terrain2DChunkDefault::DEFAULT_CHANNEL_TYPE; case CHANNEL_TYPE_INFO_ISOLEVEL: - return Terrain2DChunkDefault::DEFAULT_CHANNEL_ISOLEVEL; + return -1; case CHANNEL_TYPE_INFO_LIQUID_FLOW: return -1; default: diff --git a/world/jobs/terrain_2d_job.cpp b/world/jobs/terrain_2d_job.cpp index 93c49af..b79ba23 100644 --- a/world/jobs/terrain_2d_job.cpp +++ b/world/jobs/terrain_2d_job.cpp @@ -103,41 +103,6 @@ void Terrain2DJob::physics_process(const float delta) { //Data Management functions void Terrain2DJob::generate_ao() { - ERR_FAIL_COND(!_chunk.is_valid()); - - int data_size_x = _chunk->get_data_size_x(); - int data_size_z = _chunk->get_data_size_z(); - - ERR_FAIL_COND(data_size_x == 0 || data_size_z == 0); - - int margin_start = _chunk->get_margin_start(); - int margin_end = _chunk->get_margin_end(); - - int ssize_x = _chunk->get_size_x(); - int ssize_z = _chunk->get_size_z(); - - int size_x = ssize_x + margin_end; - int size_z = ssize_z + margin_end; - - for (int z = margin_start - 1; z < size_z - 1; ++z) { - for (int x = margin_start - 1; x < size_x - 1; ++x) { - int current = _chunk->get_voxel(x, z, Terrain2DChunkDefault::DEFAULT_CHANNEL_ISOLEVEL); - - int sum = _chunk->get_voxel(x + 1, z, Terrain2DChunkDefault::DEFAULT_CHANNEL_ISOLEVEL); - sum += _chunk->get_voxel(x - 1, z, Terrain2DChunkDefault::DEFAULT_CHANNEL_ISOLEVEL); - sum += _chunk->get_voxel(x, z + 1, Terrain2DChunkDefault::DEFAULT_CHANNEL_ISOLEVEL); - sum += _chunk->get_voxel(x, z - 1, Terrain2DChunkDefault::DEFAULT_CHANNEL_ISOLEVEL); - - sum /= 6; - - sum -= current; - - if (sum < 0) - sum = 0; - - _chunk->set_voxel(sum, x, z, Terrain2DChunkDefault::DEFAULT_CHANNEL_AO); - } - } } void Terrain2DJob::generate_random_ao(int seed, int octaves, int period, float persistence, float scale_factor) { @@ -163,7 +128,7 @@ void Terrain2DJob::generate_random_ao(int seed, int octaves, int period, float p for (int x = -margin_start; x < size_x + margin_end; ++x) { for (int z = -margin_start; z < size_z + margin_end; ++z) { - float val = noise->get_noise_3d(x + (position_x * size_x), 0, z + (position_z * size_z)); + float val = noise->get_noise_2d(x + (position_x * size_x), z + (position_z * size_z)); val *= scale_factor;