chore: minor TerrainModifier::blend optimisation
This commit is contained in:
parent
65bf506f0b
commit
0ca27ed61e
2 changed files with 3 additions and 7 deletions
|
|
@ -28,12 +28,8 @@ float TerrainModifier::blend(float under, float over) {
|
||||||
float const difference{ under - over };
|
float const difference{ under - over };
|
||||||
float const distance{ Math::abs(difference) };
|
float const distance{ Math::abs(difference) };
|
||||||
// .25 because we need half of each half of the blend range to be used
|
// .25 because we need half of each half of the blend range to be used
|
||||||
float const center_distance{
|
float const center_distance{ this->blend_distance == 0.f ? 0.f : this->blend_distance * 0.25f - distance / this->blend_distance };
|
||||||
this->blend_distance == 0.f
|
if (center_distance <= 0.f) {
|
||||||
? 0.f
|
|
||||||
: this->blend_distance * 0.25f - distance / this->blend_distance
|
|
||||||
};
|
|
||||||
if (center_distance < 0.f) {
|
|
||||||
return over;
|
return over;
|
||||||
}
|
}
|
||||||
float const smooth_center_distance{ center_distance * center_distance };
|
float const smooth_center_distance{ center_distance * center_distance };
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ chunk_size = 100
|
||||||
thread_count = 5
|
thread_count = 5
|
||||||
|
|
||||||
[node name="TerrainModifierDistance2" type="TerrainModifierDistance" parent="Terrain" unique_id=2110821264]
|
[node name="TerrainModifierDistance2" type="TerrainModifierDistance" parent="Terrain" unique_id=2110821264]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 818.99365, -123.52425, 223.5953)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 818.99365, -136.41019, 223.5953)
|
||||||
blend_distance = 0.0
|
blend_distance = 0.0
|
||||||
distance_weight_curve = SubResource("Curve_nonsf")
|
distance_weight_curve = SubResource("Curve_nonsf")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue