feat: implemented point primitive gizmo
This commit is contained in:
parent
60865b74c7
commit
dfbe37a2e7
15 changed files with 330 additions and 60 deletions
|
|
@ -31,8 +31,8 @@ float TerrainPrimitive::blend(float under, float over) const {
|
|||
return over + smooth_center_distance;
|
||||
} else {
|
||||
return (this->blend_mode == Peak
|
||||
? (under >= over ? under : over) + smooth_center_distance
|
||||
: (under >= over ? over : under) - smooth_center_distance);
|
||||
? (under > over ? under : over) + smooth_center_distance
|
||||
: (under > over ? over : under) - smooth_center_distance);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -118,16 +118,7 @@ void NoisePrimitive::_bind_methods() {
|
|||
void NoisePrimitive::evaluate(Vector2 at, float &io_height) const {
|
||||
if (this->noise.is_valid()) {
|
||||
float noise_sample{ this->noise->get_noise_2dv(at / this->noise_scale) };
|
||||
switch (this->get_blend_mode()) {
|
||||
case Peak:
|
||||
noise_sample = Math::remap(noise_sample, -1.f, 1.f, 0.f, this->noise_amplitude);
|
||||
break;
|
||||
case Valley:
|
||||
noise_sample = Math::remap(noise_sample, -1.f, 1.f, -this->noise_amplitude, 0.f);
|
||||
break;
|
||||
case Both:
|
||||
noise_sample *= this->noise_amplitude;
|
||||
}
|
||||
noise_sample *= this->noise_amplitude;
|
||||
io_height = blend(io_height, io_height + noise_sample);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue