From 4f66e718cc72eeb8c600a0809c260d8f9ed43ea0 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 2 Mar 2021 13:34:37 +0100 Subject: Fix code quality in new files --- src/splinesequence.h | 26 ++++++++++++++++---------- src/wieldanimation.cpp | 4 +--- 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/splinesequence.h b/src/splinesequence.h index e1163e155..2ba40ca8f 100644 --- a/src/splinesequence.h +++ b/src/splinesequence.h @@ -28,7 +28,8 @@ struct SplineIndex unsigned int length; }; -template class SplineSequence +template +class SplineSequence { private: std::vector nodes; @@ -55,17 +56,20 @@ public: T _interpolate(T &bottom, T &top, float alpha) const; }; -template SplineSequence::SplineSequence() : m_totalDuration(0.0f) +template +SplineSequence::SplineSequence() : m_totalDuration(0.0f) { // noop } -template SplineSequence::~SplineSequence() +template +SplineSequence::~SplineSequence() { // noop } -template inline std::vector SplineSequence::getNodes() +template +inline std::vector SplineSequence::getNodes() { return this->nodes; } @@ -76,7 +80,8 @@ inline std::vector SplineSequence::getIndices() return this->indices; } -template SplineSequence &SplineSequence::addNode(T node) +template +SplineSequence &SplineSequence::addNode(T node) { nodes.push_back(node); return *this; @@ -126,7 +131,8 @@ SplineSequence &SplineSequence::normalizeDurations(float target) return *this; } -template void SplineSequence::interpolate(T &result, float alpha) const +template +void SplineSequence::interpolate(T &result, float alpha) const { // find the index @@ -153,8 +159,8 @@ template void SplineSequence::interpolate(T &result, float alpha typename std::vector::const_iterator end = start; end += index->length; // std::cout << "Start: " << start->X << " " << start->Y << " " << start->Z << - // std::endl; std::cout << "End: " << end->X << " " << end->Y << " " << end->Z << - // std::endl; std::cout << "Ends: " << *start << " " << *end << std::endl; + // std::endl; std::cout << "End: " << end->X << " " << end->Y << " " << end->Z + // << std::endl; std::cout << "Ends: " << *start << " " << *end << std::endl; // these are both inclusive, but vector's range constructor // excludes the end -> advance by one end++; @@ -163,8 +169,8 @@ template void SplineSequence::interpolate(T &result, float alpha for (unsigned int degree = index->length; degree > 0; degree--) { for (unsigned int i = 0; i < degree; i++) { // std::cout << "Interpolating alpha " << alpha << ", degree " << - // degree << ", step " << i << std::endl; std::cout << "Before " << - // workspace[i] << " onto " << workspace[i+1] << std::endl; + // degree << ", step " << i << std::endl; std::cout << "Before " + // << workspace[i] << " onto " << workspace[i+1] << std::endl; workspace[i] = _interpolate( workspace[i], workspace[i + 1], alpha); //_interpolate(workspace[i], alpha, index->length); diff --git a/src/wieldanimation.cpp b/src/wieldanimation.cpp index f1ff51a75..10e744623 100644 --- a/src/wieldanimation.cpp +++ b/src/wieldanimation.cpp @@ -14,7 +14,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - #include "wieldanimation.h" v3f WieldAnimation::getTranslationAt(float time) const @@ -140,7 +139,6 @@ void WieldAnimation::fillRepository() .addNode(quatFromAngles(0.0f, 0.0f, 0.0f)); poke.m_rotationspline.addIndex(1.0, 0, 2).addIndex(1.0, 2, 2); poke.setDuration(0.5f); - } void WieldAnimation::serialize(std::ostream &os, u16 protocol_version) @@ -197,7 +195,7 @@ WieldAnimation WieldAnimation::deSerialize(std::istream &is) u32 rotationNodes_size = readU32(is); for (u32 i = 0; i < rotationNodes_size; i++) { v3f node = readV3F32(is); - anim.m_rotationspline.addNode(quatFromAngles(node.X,node.Y, node.Z)); + anim.m_rotationspline.addNode(quatFromAngles(node.X, node.Y, node.Z)); } u32 rotationIndex_size = readU32(is); for (u32 i = 0; i < rotationIndex_size; i++) { -- cgit v1.2.3