mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2026-05-18 13:50:14 -04:00
Add new class to store flame motion parameters
This commit is contained in:
63
Source/Ember/FlameMotion.h
Normal file
63
Source/Ember/FlameMotion.h
Normal file
@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#include "EmberDefines.h"
|
||||
|
||||
namespace EmberNs
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// FlameMotion 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.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class EMBER_API FlameMotion
|
||||
{
|
||||
public:
|
||||
|
||||
FlameMotion()
|
||||
{
|
||||
m_MotionFreq = 0;
|
||||
m_MotionFunc = MOTION_SIN;
|
||||
}
|
||||
|
||||
FlameMotion(const FlameMotion<T> &other)
|
||||
{
|
||||
operator=<T>(other);
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
FlameMotion(const FlameMotion<U> &other)
|
||||
{
|
||||
operator=<U>(other);
|
||||
}
|
||||
|
||||
FlameMotion<T>& operator = (const FlameMotion<T>& other)
|
||||
{
|
||||
if (this != &other)
|
||||
FlameMotion<T>::operator=<T>(other);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
FlameMotion &operator = (const FlameMotion<U> &other)
|
||||
{
|
||||
m_MotionParams.clear();
|
||||
|
||||
for (int i = 0; i < other.m_MotionParams.size(); ++i)
|
||||
m_MotionParams.push_back(pair<eFlameMotionParam, T>(other.m_MotionParams[i].first, T(other.m_MotionParams[i].second)));
|
||||
|
||||
m_MotionFunc = other.m_MotionFunc;
|
||||
m_MotionFreq = T(other.m_MotionFreq);
|
||||
return *this;
|
||||
}
|
||||
|
||||
T m_MotionFreq;
|
||||
eMotion m_MotionFunc;
|
||||
vector<pair<eFlameMotionParam, T>> m_MotionParams;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user