You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
Fixed int interpolation issue, closes #22763
When interpolating between two equal int values a and b, floating point calculation imprecisions can result in different values depending on the interpolation factor.
This commit is contained in:
@@ -3542,7 +3542,10 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant &
|
|||||||
case INT: {
|
case INT: {
|
||||||
int64_t va = a._data._int;
|
int64_t va = a._data._int;
|
||||||
int64_t vb = b._data._int;
|
int64_t vb = b._data._int;
|
||||||
r_dst = int((1.0 - c) * va + vb * c);
|
if (va != vb)
|
||||||
|
r_dst = int((1.0 - c) * va + vb * c);
|
||||||
|
else //avoid int casting issues
|
||||||
|
r_dst = a;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case REAL: {
|
case REAL: {
|
||||||
|
|||||||
Reference in New Issue
Block a user