#pragma once
#include "EmberDefines.h"
namespace EmberNs
{
///
/// Thin derivation of pair for the element type
/// of EmberMotion::m_MotionParams to allow for copying vectors
/// of different types of T.
/// Template argument expected to be float or double.
///
template
class EMBER_API MotionParam : public pair
{
public:
///
/// Default constructor, which calls the base, which sets first and second to their defaults.
///
MotionParam()
{
}
///
/// Member-wise constructor.
///
/// The eEmberMotionParam value to assign to first
/// The T value to assign to second
MotionParam(eEmberMotionParam e, T t)
: pair(e, t)
{
}
///
/// Default copy constructor.
///
/// The MotionParam object to copy
MotionParam(const MotionParam& other)
: pair ()
{
operator=(other);
}
///
/// Copy constructor to copy a MotionParam object of type U.
///
/// The MotionParam object to copy
template
MotionParam(const MotionParam& other)
{
operator=(other);
}
///
/// Default assignment operator.
///
/// The MotionParam object to copy
MotionParam& operator = (const MotionParam& other)
{
if (this != &other)
MotionParam::operator=(other);
return *this;
}
///
/// Assignment operator to assign a MotionParam object of type U.
///
/// The MotionParam object to copy.
/// Reference to updated self
template
MotionParam &operator = (const MotionParam& other)
{
this->first = other.first;
this->second = T(other.second);
return *this;
}
};
///
/// EmberMotion elements allow for motion of the flame parameters such as zoom, yaw, pitch and friends
/// The values in these elements can be used to modify flame parameters during rotation in much the same
/// way as motion elements on xforms do.
/// Template argument expected to be float or double.
///
template
class EMBER_API EmberMotion
{
public:
///
/// Default constructor to initialize motion freq and offset to 0 and the motion func to SIN.
///
EmberMotion()
{
m_MotionFreq = 0;
m_MotionFunc = MOTION_SIN;
m_MotionOffset = 0;
}
///
/// Default copy constructor.
///
/// The EmberMotion object to copy
EmberMotion(const EmberMotion& other)
{
operator=(other);
}
///
/// Copy constructor to copy a EmberMotion object of type U.
///
/// The EmberMotion object to copy
template
EmberMotion(const EmberMotion& other)
{
operator=(other);
}
///
/// Default assignment operator.
///
/// The EmberMotion object to copy
EmberMotion& operator = (const EmberMotion& other)
{
if (this != &other)
EmberMotion::operator=(other);
return *this;
}
///
/// Assignment operator to assign a EmberMotion object of type U.
///
/// The EmberMotion object to copy.
/// Reference to updated self
template
EmberMotion &operator = (const EmberMotion& other)
{
CopyVec(m_MotionParams, other.m_MotionParams);
m_MotionFunc = other.m_MotionFunc;
m_MotionFreq = T(other.m_MotionFreq);
m_MotionOffset = T(other.m_MotionOffset);
return *this;
}
T m_MotionFreq;
T m_MotionOffset;
eMotion m_MotionFunc;
vector> m_MotionParams;
};
}