| … | … | @@ -60,6 +60,9 @@ void DCTerrainGeneratorProcNodes::_bind_methods() { |
| 60 | 60 | ClassDB::bind_method(D_METHOD("set_erosion_scale", "value"), &DCTerrainGeneratorProcNodes::set_erosion_scale); |
| 61 | 61 | ClassDB::bind_method(D_METHOD("get_erosion_scale"), &DCTerrainGeneratorProcNodes::get_erosion_scale); |
| 62 | 62 | ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "erosion_scale"), "set_erosion_scale", "get_erosion_scale"); |
| 63 | ClassDB::bind_method(D_METHOD("set_field_half_range", "value"), &DCTerrainGeneratorProcNodes::set_field_half_range); |
| 64 | ClassDB::bind_method(D_METHOD("get_field_half_range"), &DCTerrainGeneratorProcNodes::get_field_half_range); |
| 65 | ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "field_half_range"), "set_field_half_range", "get_field_half_range"); |
| 63 | 66 | ClassDB::bind_method(D_METHOD("set_input_height_amplitude", "value"), &DCTerrainGeneratorProcNodes::set_input_height_amplitude); |
| 64 | 67 | ClassDB::bind_method(D_METHOD("get_input_height_amplitude"), &DCTerrainGeneratorProcNodes::get_input_height_amplitude); |
| 65 | 68 | ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "input_height_amplitude"), "set_input_height_amplitude", "get_input_height_amplitude"); |
| … | … | @@ -246,6 +249,13 @@ void DCTerrainGeneratorProcNodes::set_erosion_scale(float p_val) { |
| 246 | 249 | emit_changed(); |
| 247 | 250 | } |
| 248 | 251 | |
| 252 | void DCTerrainGeneratorProcNodes::set_field_half_range(float p_val) { |
| 253 | if (field_half_range_ == p_val) return; |
| 254 | field_half_range_ = p_val; |
| 255 | _recompile_glsl(); |
| 256 | emit_changed(); |
| 257 | } |
| 258 | |
| 249 | 259 | void DCTerrainGeneratorProcNodes::set_input_height_amplitude(float p_val) { |
| 250 | 260 | if (input_height_amplitude_ == p_val) return; |
| 251 | 261 | input_height_amplitude_ = p_val; |
| … | … | @@ -889,6 +899,7 @@ void DCTerrainGeneratorProcNodes::_recompile_glsl() { |
| 889 | 899 | wp.detail_gain = detail_gain_; |
| 890 | 900 | wp.detail_octaves = detail_octaves_; |
| 891 | 901 | wp.en_erosion_scale = erosion_scale_; |
| 902 | wp.field_half_range = field_half_range_; |
| 892 | 903 | wp.voxel_size = 1.0f; |
| 893 | 904 | wp.heightmap_source = true; |
| 894 | 905 | wp.heightmap_step = hblk_mpp_; |
| … | … | @@ -1314,8 +1325,8 @@ float DCTerrainGeneratorProcNodes::ProcNodesBridge::evaluate( |
| 1314 | 1325 | }; |
| 1315 | 1326 | float oh, odx, odz; |
| 1316 | 1327 | erosion_heightmap_gn_cpu(x, z, floor_y, ceiling_y, terrain_height, |
| 1317 | | /* height_amp */ 0.25f, owner_->erosion_scale_, hmpp, sample, |
| 1318 | | oh, odx, odz); |
| 1328 | /* height_amp */ 0.25f, owner_->erosion_scale_, |
| 1329 | owner_->field_half_range_, hmpp, sample, oh, odx, odz); |
| 1319 | 1330 | terrain_offset = vec3(oh, odx, odz); |
| 1320 | 1331 | } |
| 1321 | 1332 | // THE SAME SUBSTITUTION THE GLSL MAKES, and it must stay the same one: |
| … | … | @@ -1342,8 +1353,8 @@ float DCTerrainGeneratorProcNodes::ProcNodesBridge::evaluate( |
| 1342 | 1353 | }; |
| 1343 | 1354 | float oh, odx, odz; |
| 1344 | 1355 | erosion_heightmap_gn_cpu(x, z, floor_y, ceiling_y, terrain_height, |
| 1345 | | /* height_amp */ 0.25f, owner_->erosion_scale_, hmpp, sample, |
| 1346 | | oh, odx, odz); |
| 1356 | /* height_amp */ 0.25f, owner_->erosion_scale_, |
| 1357 | owner_->field_half_range_, hmpp, sample, oh, odx, odz); |
| 1347 | 1358 | terrain_offset = vec3(oh, odx, odz); |
| 1348 | 1359 | } |
| 1349 | 1360 | // Detail rides on TOP and is NOT folded in — MUST stay identical to the GLSL. |