From 9d5f3e85784dd804ad371708e1a4dd25124cfefc Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Wed, 24 Jun 2015 11:23:17 +0100 Subject: [PATCH] Add new class to store flame motion parameters --- Builds/QtCreator/Ember/Ember.pro | 3 +- Source/Ember/Ember.h | 9 +++++ Source/Ember/EmberDefines.h | 6 +++ Source/Ember/FlameMotion.h | 63 ++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 Source/Ember/FlameMotion.h diff --git a/Builds/QtCreator/Ember/Ember.pro b/Builds/QtCreator/Ember/Ember.pro index 58cf2c0..b0e57e1 100644 --- a/Builds/QtCreator/Ember/Ember.pro +++ b/Builds/QtCreator/Ember/Ember.pro @@ -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 diff --git a/Source/Ember/Ember.h b/Source/Ember/Ember.h index da0726e..06426ce 100644 --- a/Source/Ember/Ember.h +++ b/Source/Ember/Ember.h @@ -5,6 +5,7 @@ #include "PaletteList.h" #include "SpatialFilter.h" #include "TemporalFilter.h" +#include "FlameMotion.h" /// /// 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> m_FlameMotionElements; + private: /// /// The type of scaling used when resizing. diff --git a/Source/Ember/EmberDefines.h b/Source/Ember/EmberDefines.h index cd619be..92e69ae 100644 --- a/Source/Ember/EmberDefines.h +++ b/Source/Ember/EmberDefines.h @@ -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 +}; } diff --git a/Source/Ember/FlameMotion.h b/Source/Ember/FlameMotion.h new file mode 100644 index 0000000..6700f42 --- /dev/null +++ b/Source/Ember/FlameMotion.h @@ -0,0 +1,63 @@ +#pragma once + +#include "EmberDefines.h" + +namespace EmberNs +{ + +/// +/// 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. +/// +template +class EMBER_API FlameMotion +{ +public: + + FlameMotion() + { + m_MotionFreq = 0; + m_MotionFunc = MOTION_SIN; + } + + FlameMotion(const FlameMotion &other) + { + operator=(other); + } + + template + FlameMotion(const FlameMotion &other) + { + operator=(other); + } + + FlameMotion& operator = (const FlameMotion& other) + { + if (this != &other) + FlameMotion::operator=(other); + + return *this; + } + + template + FlameMotion &operator = (const FlameMotion &other) + { + m_MotionParams.clear(); + + for (int i = 0; i < other.m_MotionParams.size(); ++i) + m_MotionParams.push_back(pair(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> m_MotionParams; + +}; + +}