feat: noise height bases on 0 if height infinite

This commit is contained in:
Sara Gerretsen 2025-12-08 16:08:43 +01:00
parent cc3d7d335d
commit 1641080ff6

View file

@ -117,6 +117,9 @@ void NoisePrimitive::_bind_methods() {
void NoisePrimitive::evaluate(Vector2 at, float &io_height) const {
if (this->noise.is_valid()) {
if (Math::is_nan(io_height) || Math::is_inf(io_height)) {
io_height = 0;
}
float noise_sample{ this->noise->get_noise_2dv(at / this->noise_scale) };
noise_sample *= this->noise_amplitude;
io_height = blend(io_height, io_height + noise_sample);