Fixed smaller issues in VariantOP.

This commit is contained in:
Relintai 2024-01-20 12:50:13 +01:00
parent c03536414c
commit 8ddf92681e

View File

@ -5382,7 +5382,7 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst)
case RECT2I: { case RECT2I: {
const Rect2i *ra = reinterpret_cast<const Rect2i *>(a._data._mem); const Rect2i *ra = reinterpret_cast<const Rect2i *>(a._data._mem);
const Rect2i *rb = reinterpret_cast<const Rect2i *>(b._data._mem); const Rect2i *rb = reinterpret_cast<const Rect2i *>(b._data._mem);
r_dst = Rect2(ra->position + rb->position * c, ra->size + rb->size * c); r_dst = Rect2i(ra->position + rb->position * c, ra->size + rb->size * c);
} }
return; return;
case VECTOR2: { case VECTOR2: {
@ -5523,7 +5523,7 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant &
} }
return; return;
case RECT2I: { case RECT2I: {
r_dst = Rect2(reinterpret_cast<const Rect2i *>(a._data._mem)->position.linear_interpolate(reinterpret_cast<const Rect2i *>(b._data._mem)->position, c), reinterpret_cast<const Rect2 *>(a._data._mem)->size.linear_interpolate(reinterpret_cast<const Rect2 *>(b._data._mem)->size, c)); r_dst = Rect2i(reinterpret_cast<const Rect2i *>(a._data._mem)->position.linear_interpolate(reinterpret_cast<const Rect2i *>(b._data._mem)->position, c), reinterpret_cast<const Rect2i *>(a._data._mem)->size.linear_interpolate(reinterpret_cast<const Rect2i *>(b._data._mem)->size, c));
} }
return; return;
case VECTOR2: { case VECTOR2: {
@ -5768,7 +5768,6 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant &
} }
return; return;
case POOL_VECTOR4I_ARRAY: { case POOL_VECTOR4I_ARRAY: {
/*
const PoolVector<Vector4i> *arr_a = reinterpret_cast<const PoolVector<Vector4i> *>(a._data._mem); const PoolVector<Vector4i> *arr_a = reinterpret_cast<const PoolVector<Vector4i> *>(a._data._mem);
const PoolVector<Vector4i> *arr_b = reinterpret_cast<const PoolVector<Vector4i> *>(b._data._mem); const PoolVector<Vector4i> *arr_b = reinterpret_cast<const PoolVector<Vector4i> *>(b._data._mem);
int sz = arr_a->size(); int sz = arr_a->size();
@ -5783,12 +5782,12 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant &
PoolVector<Vector4i>::Read br = arr_b->read(); PoolVector<Vector4i>::Read br = arr_b->read();
for (int i = 0; i < sz; i++) { for (int i = 0; i < sz; i++) {
vw[i] = ar[i].lerp(br[i], c); vw[i] = ar[i].linear_interpolate(br[i], c);
} }
} }
r_dst = v; r_dst = v;
} }
*/
r_dst = a; r_dst = a;
} }
return; return;