From d75a15136d6214d698c8c00deca47250c2537431 Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Wed, 24 Jun 2015 10:52:21 +0100 Subject: [PATCH] Convert motion_frequency to floating point --- Source/Ember/Xform.h | 4 ++-- Source/Ember/XmlToEmber.h | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Source/Ember/Xform.h b/Source/Ember/Xform.h index 4e94319..cffc862 100644 --- a/Source/Ember/Xform.h +++ b/Source/Ember/Xform.h @@ -731,7 +731,7 @@ public: { //Original only pulls these from the first motion xform which is a bug. Want to pull it from each one. Xform& currentMot = xform.m_Motion[i]; - intmax_t freq = currentMot.m_MotionFreq; + T freq = currentMot.m_MotionFreq; eMotion func = currentMot.m_MotionFunc; //Clamp these to the appropriate range after all are applied. @@ -1232,7 +1232,7 @@ public: T m_Animate;//Whether or not this xform rotates during animation. 0 means stationary, > 0 means rotate. Use T instead of bool so it can be interpolated. T m_Wind[2]; eMotion m_MotionFunc; - intmax_t m_MotionFreq; + T m_MotionFreq; vector> m_Motion; string m_Name; diff --git a/Source/Ember/XmlToEmber.h b/Source/Ember/XmlToEmber.h index 0a92ab4..8293598 100644 --- a/Source/Ember/XmlToEmber.h +++ b/Source/Ember/XmlToEmber.h @@ -971,7 +971,7 @@ private: if (theXform) { //Check for non-zero motion params. - if (theXform->m_MotionFreq != 0)//Original checked for motion func being non-zero, but it was set to MOTION_SIN (1) in Xform::Init(), so don't check for 0 here. + if (abs(theXform->m_MotionFreq) > 0.0)//Original checked for motion func being non-zero, but it was set to MOTION_SIN (1) in Xform::Init(), so don't check for 0 here. { m_ErrorReport.push_back(string(loc) + " : Motion parameters should not be specified in regular, non-motion xforms"); } @@ -1047,9 +1047,7 @@ private: else if (ParseAndAssignFloat(curAtt->name, attStr, "animate", xform.m_Animate, success)) { } else if (ParseAndAssignFloat(curAtt->name, attStr, "opacity", xform.m_Opacity, success)) { } else if (ParseAndAssignFloat(curAtt->name, attStr, "var_color", xform.m_DirectColor, success)) { } - - //Parse simple int reads. - else if (ParseAndAssignInt(curAtt->name, attStr, "motion_frequency", xform.m_MotionFreq, success)) { } + else if (ParseAndAssignFloat(curAtt->name, attStr, "motion_frequency", xform.m_MotionFreq, success)) { } //Parse more complicated reads that have multiple possible values. else if (!Compare(curAtt->name, "name"))