feat: noise height bases on 0 if height infinite
This commit is contained in:
parent
cc3d7d335d
commit
1641080ff6
|
|
@ -117,6 +117,9 @@ void NoisePrimitive::_bind_methods() {
|
||||||
|
|
||||||
void NoisePrimitive::evaluate(Vector2 at, float &io_height) const {
|
void NoisePrimitive::evaluate(Vector2 at, float &io_height) const {
|
||||||
if (this->noise.is_valid()) {
|
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) };
|
float noise_sample{ this->noise->get_noise_2dv(at / this->noise_scale) };
|
||||||
noise_sample *= this->noise_amplitude;
|
noise_sample *= this->noise_amplitude;
|
||||||
io_height = blend(io_height, io_height + noise_sample);
|
io_height = blend(io_height, io_height + noise_sample);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue