Variant::blend: add Quat, fix Vector3.

This commit is contained in:
Josh Grams 2016-03-08 06:38:19 -05:00
parent 20308c0475
commit f7fad32188
1 changed files with 7 additions and 1 deletions

View File

@ -3461,12 +3461,18 @@ void Variant::blend(const Variant& a, const Variant& b, float c, Variant &r_dst)
const Rect2 *rb = reinterpret_cast<const Rect2*>(b._data._mem); const Rect2 *rb = reinterpret_cast<const Rect2*>(b._data._mem);
r_dst=Rect2(ra->pos + rb->pos * c, ra->size + rb->size * c); r_dst=Rect2(ra->pos + rb->pos * c, ra->size + rb->size * c);
} return; } return;
case VECTOR3:{ r_dst=*reinterpret_cast<const Vector2*>(a._data._mem)+*reinterpret_cast<const Vector2*>(b._data._mem)*c; } return; case VECTOR3:{ r_dst=*reinterpret_cast<const Vector3*>(a._data._mem)+*reinterpret_cast<const Vector3*>(b._data._mem)*c; } return;
case _AABB:{ case _AABB:{
const AABB *ra = reinterpret_cast<const AABB*>(a._data._mem); const AABB *ra = reinterpret_cast<const AABB*>(a._data._mem);
const AABB *rb = reinterpret_cast<const AABB*>(b._data._mem); const AABB *rb = reinterpret_cast<const AABB*>(b._data._mem);
r_dst=AABB(ra->pos + rb->pos * c, ra->size + rb->size * c); r_dst=AABB(ra->pos + rb->pos * c, ra->size + rb->size * c);
} return; } return;
case QUAT:{
Quat empty_rot;
const Quat *qa = reinterpret_cast<const Quat*>(a._data._mem);
const Quat *qb = reinterpret_cast<const Quat*>(b._data._mem);
r_dst=*qa * empty_rot.slerp(*qb,c);
} return;
case COLOR:{ case COLOR:{
const Color *ca = reinterpret_cast<const Color*>(a._data._mem); const Color *ca = reinterpret_cast<const Color*>(a._data._mem);
const Color *cb = reinterpret_cast<const Color*>(b._data._mem); const Color *cb = reinterpret_cast<const Color*>(b._data._mem);