unsigned int length;
};
-template <typename T> class SplineSequence
+template <typename T>
+class SplineSequence
{
private:
std::vector<T> nodes;
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;
}
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;
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
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++;
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);
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
#include "wieldanimation.h"
v3f WieldAnimation::getTranslationAt(float time) const
.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)
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++) {