Add new class to store flame motion parameters

This commit is contained in:
Simon Detheridge 2015-06-24 11:23:17 +01:00
parent d75a15136d
commit 9d5f3e8578
4 changed files with 80 additions and 1 deletions

View File

@ -52,5 +52,6 @@ HEADERS += \
../../../Source/Ember/Variations05.h \
../../../Source/Ember/VariationsDC.h \
../../../Source/Ember/Xform.h \
../../../Source/Ember/XmlToEmber.h
../../../Source/Ember/XmlToEmber.h \
../../../Source/Ember/FlameMotion.h

View File

@ -5,6 +5,7 @@
#include "PaletteList.h"
#include "SpatialFilter.h"
#include "TemporalFilter.h"
#include "FlameMotion.h"
/// <summary>
/// Ember class.
@ -183,6 +184,11 @@ public:
if (ember.m_Edits != nullptr)
m_Edits = xmlCopyDoc(ember.m_Edits, 1);
m_FlameMotionElements.clear();
for(int i = 0; i < ember.m_FlameMotionElements.size(); ++i)
m_FlameMotionElements.push_back(ember.m_FlameMotionElements[i]);
return *this;
}
@ -1683,6 +1689,9 @@ public:
//The 0-based position of this ember in the file it was contained in.
size_t m_Index;
//The list of motion elements for the top-level flame params
vector<FlameMotion<T>> m_FlameMotionElements;
private:
/// <summary>
/// The type of scaling used when resizing.

View File

@ -120,4 +120,10 @@ enum eProcessState : uint { NONE = 0, ITER_STARTED = 1, ITER_DONE = 2, FILTER_DO
enum eInteractiveFilter : uint { FILTER_LOG = 0, FILTER_DE = 1 };
enum eScaleType : uint { SCALE_NONE = 0, SCALE_WIDTH = 1, SCALE_HEIGHT = 2 };
enum eRenderStatus : uint { RENDER_OK = 0, RENDER_ERROR = 1, RENDER_ABORT = 2 };
enum eFlameMotionParam : uint {
FLAME_MOTION_NONE = 0, FLAME_MOTION_ZOOM = 1, FLAME_MOTION_ZPOS = 2, FLAME_MOTION_PERSPECTIVE = 3, FLAME_MOTION_YAW = 4, FLAME_MOTION_PITCH = 5, FLAME_MOTION_DEPTH_BLUR = 6,
FLAME_MOTION_CENTER_X = 7, FLAME_MOTION_CENTER_Y = 8, FLAME_MOTION_ROTATE = 9, FLAME_MOTION_HUE = 10, FLAME_MOTION_BRIGHTNESS = 11, FLAME_MOTION_GAMMA = 12,
FLAME_MOTION_GAMMA_THRESH = 13, FLAME_MOTION_HIGHLIGHT_POWER = 14, FLAME_MOTION_BACKGROUND_R = 15, FLAME_MOTION_BACKGROUND_G = 16,
FLAME_MOTION_BACKGROUND_B = 17, FLAME_MOTION_VIBRANCY = 18
};
}

View 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;
};
}