]> git.lizzy.rs Git - minetest.git/commitdiff
Fix code quality in new files
authorElias Fleckenstein <eliasfleckenstein@web.de>
Tue, 2 Mar 2021 12:34:37 +0000 (13:34 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Fri, 5 Mar 2021 08:45:58 +0000 (09:45 +0100)
src/splinesequence.h
src/wieldanimation.cpp

index e1163e1555f2888831d17e905d28560c4f032656..2ba40ca8f33fc9ca0d5087319de86fd57c60cb13 100644 (file)
@@ -28,7 +28,8 @@ struct SplineIndex
        unsigned int length;
 };
 
-template <typename T> class SplineSequence
+template <typename T>
+class SplineSequence
 {
 private:
        std::vector<T> nodes;
@@ -55,17 +56,20 @@ template <typename T> class SplineSequence
        T _interpolate(T &bottom, T &top, float alpha) const;
 };
 
-template <typename T> SplineSequence<T>::SplineSequence() : m_totalDuration(0.0f)
+template <typename T>
+SplineSequence<T>::SplineSequence() : m_totalDuration(0.0f)
 {
        // noop
 }
 
-template <typename T> SplineSequence<T>::~SplineSequence()
+template <typename T>
+SplineSequence<T>::~SplineSequence()
 {
        // noop
 }
 
-template <typename T> inline std::vector<T> SplineSequence<T>::getNodes()
+template <typename T>
+inline std::vector<T> SplineSequence<T>::getNodes()
 {
        return this->nodes;
 }
@@ -76,7 +80,8 @@ inline std::vector<SplineIndex> SplineSequence<T>::getIndices()
        return this->indices;
 }
 
-template <typename T> SplineSequence<T> &SplineSequence<T>::addNode(T node)
+template <typename T>
+SplineSequence<T> &SplineSequence<T>::addNode(T node)
 {
        nodes.push_back(node);
        return *this;
@@ -126,7 +131,8 @@ SplineSequence<T> &SplineSequence<T>::normalizeDurations(float target)
        return *this;
 }
 
-template <typename T> void SplineSequence<T>::interpolate(T &result, float alpha) const
+template <typename T>
+void SplineSequence<T>::interpolate(T &result, float alpha) const
 {
 
        // find the index
@@ -153,8 +159,8 @@ template <typename T> void SplineSequence<T>::interpolate(T &result, float alpha
        typename std::vector<T>::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 <typename T> void SplineSequence<T>::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);
index f1ff51a7593b3765022b1744863b3d7163a5128b..10e744623d4c7833f90357a6bf7987c6035f3cdc 100644 (file)
@@ -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++) {