diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-07-07 17:44:21 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-07-07 17:44:21 -0300 |
commit | 9ff6d55822647c87eef392147ea15641d0922d47 (patch) | |
tree | 4a132cccc1ecb9f7de27a94475363fcf527986c6 /core | |
parent | 3d68949a1cc41b4865618bddde23122f66764ee1 (diff) |
Polygon2D
-=-=-=-=-
Another gift for those who make 2D games:
-Edit polygons, concave or convex, color them, texture them and uv-map them
-Corresponding editor
-Can have a custom pivot, so they are compatible with bones and IK
Diffstat (limited to 'core')
-rw-r--r-- | core/variant_op.cpp | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 1f0f038d77..6c2667c7e9 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -3354,7 +3354,59 @@ void Variant::interpolate(const Variant& a, const Variant& b, float c,Variant &r case INT_ARRAY:{ r_dst=a; } return; case REAL_ARRAY:{ r_dst=a; } return; case STRING_ARRAY:{ r_dst=a; } return; - case VECTOR3_ARRAY:{ r_dst=a; } return; + case VECTOR2_ARRAY:{ + const DVector<Vector2> *arr_a=reinterpret_cast<const DVector<Vector2>* >(a._data._mem); + const DVector<Vector2> *arr_b=reinterpret_cast<const DVector<Vector2>* >(b._data._mem); + int sz = arr_a->size(); + if (sz==0 || arr_b->size()!=sz) { + + r_dst=a; + } else { + + DVector<Vector2> v; + v.resize(sz); + { + DVector<Vector2>::Write vw=v.write(); + DVector<Vector2>::Read ar=arr_a->read(); + DVector<Vector2>::Read br=arr_b->read(); + + for(int i=0;i<sz;i++) { + vw[i]=ar[i].linear_interpolate(br[i],c); + } + } + r_dst=v; + + } + + + } return; + case VECTOR3_ARRAY:{ + + + const DVector<Vector3> *arr_a=reinterpret_cast<const DVector<Vector3>* >(a._data._mem); + const DVector<Vector3> *arr_b=reinterpret_cast<const DVector<Vector3>* >(b._data._mem); + int sz = arr_a->size(); + if (sz==0 || arr_b->size()!=sz) { + + r_dst=a; + } else { + + DVector<Vector3> v; + v.resize(sz); + { + DVector<Vector3>::Write vw=v.write(); + DVector<Vector3>::Read ar=arr_a->read(); + DVector<Vector3>::Read br=arr_b->read(); + + for(int i=0;i<sz;i++) { + vw[i]=ar[i].linear_interpolate(br[i],c); + } + } + r_dst=v; + + } + + } return; case COLOR_ARRAY:{ r_dst=a; } return; default: { |