//********************************** Banshee Engine (www.banshee3d.com) **************************************************// //**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************// #include "Animation/BsMorphShapes.h" #include "RTTI/BsMorphShapesRTTI.h" namespace bs { MorphShape::MorphShape() { } MorphShape::MorphShape(const String& name, float weight, const Vector& vertices) :mName(name), mWeight(weight), mVertices(vertices) { } /** Creates a new morph shape from the provided set of vertices. */ SPtr MorphShape::create(const String& name, float weight, const Vector& vertices) { return bs_shared_ptr_new(name, weight, vertices); } RTTITypeBase* MorphShape::getRTTIStatic() { return MorphShapeRTTI::instance(); } RTTITypeBase* MorphShape::getRTTI() const { return getRTTIStatic(); } MorphChannel::MorphChannel() { } MorphChannel::MorphChannel(const String& name, const Vector>& shapes) :mName(name), mShapes(shapes) { std::sort(mShapes.begin(), mShapes.end(), [](auto& x, auto& y) { return x->getWeight() < y->getWeight(); }); } SPtr MorphChannel::create(const String& name, const Vector>& shapes) { MorphChannel* raw = new (bs_alloc()) MorphChannel(name, shapes); return bs_shared_ptr(raw); } SPtr MorphChannel::createEmpty() { MorphChannel* raw = new (bs_alloc()) MorphChannel(); return bs_shared_ptr(raw); } RTTITypeBase* MorphChannel::getRTTIStatic() { return MorphChannelRTTI::instance(); } RTTITypeBase* MorphChannel::getRTTI() const { return getRTTIStatic(); } MorphShapes::MorphShapes() { } MorphShapes::MorphShapes(const Vector>& channels, UINT32 numVertices) :mChannels(channels), mNumVertices(numVertices) { } SPtr MorphShapes::create(const Vector>& channels, UINT32 numVertices) { MorphShapes* raw = new (bs_alloc()) MorphShapes(channels, numVertices); return bs_shared_ptr(raw); } SPtr MorphShapes::createEmpty() { MorphShapes* raw = new (bs_alloc()) MorphShapes(); return bs_shared_ptr(raw); } RTTITypeBase* MorphShapes::getRTTIStatic() { return MorphShapesRTTI::instance(); } RTTITypeBase* MorphShapes::getRTTI() const { return getRTTIStatic(); } }