Merge pull request #3973 from assimp/issue_3971_kkulling

closes https://github.com/assimp/assimp/issues/3971: fix wrong depend…
pull/3967/head^2
Kim Kulling 2021-06-30 00:23:35 +02:00 committed by GitHub
commit 1ea3cb545d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 11 deletions

View File

@ -39,9 +39,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "assimp_view.h" #include "AnimEvaluator.h"
#include <tuple> #include <assimp/anim.h>
#include <assimp/ai_assert.h>
using namespace AssimpView; using namespace AssimpView;

View File

@ -1,4 +1,3 @@
/** Calculates a pose for a given time of an animation */
/* /*
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
@ -40,11 +39,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#pragma once
#ifndef AV_ANIMEVALUATOR_H_INCLUDED #ifndef AV_ANIMEVALUATOR_H_INCLUDED
#define AV_ANIMEVALUATOR_H_INCLUDED #define AV_ANIMEVALUATOR_H_INCLUDED
/** Calculates a pose for a given time of an animation */
#include <tuple> #include <tuple>
#include <vector> #include <vector>
#include <assimp/matrix4x4.h>
struct aiAnimation;
namespace AssimpView { namespace AssimpView {
@ -63,18 +68,19 @@ public:
/// @brief The class destructor. /// @brief The class destructor.
~AnimEvaluator(); ~AnimEvaluator();
/** Evaluates the animation tracks for a given time stamp. The calculated pose can be retrieved as a /// @brief Evaluates the animation tracks for a given time stamp.
* array of transformation matrices afterwards by calling GetTransformations(). /// The calculated pose can be retrieved as an array of transformation
* @param pTime The time for which you want to evaluate the animation, in seconds. Will be mapped into the animation cycle, so /// matrices afterwards by calling GetTransformations().
* it can be an arbitrary value. Best use with ever-increasing time stamps. /// @param pTime The time for which you want to evaluate the animation, in seconds.
*/ /// Will be mapped into the animation cycle, so it can get an arbitrary
/// value. Best use with ever-increasing time stamps.
void Evaluate(double pTime); void Evaluate(double pTime);
/** Returns the transform matrices calculated at the last Evaluate() call. The array matches the mChannels array of /// @brief Returns the transform matrices calculated at the last Evaluate() call.
* the aiAnimation. */ /// The array matches the mChannels array of the aiAnimation.
const std::vector<aiMatrix4x4> &GetTransformations() const { return mTransforms; } const std::vector<aiMatrix4x4> &GetTransformations() const { return mTransforms; }
protected: private:
const aiAnimation *mAnim; const aiAnimation *mAnim;
double mLastTime; double mLastTime;
std::vector<std::tuple<unsigned int, unsigned int, unsigned int>> mLastPositions; std::vector<std::tuple<unsigned int, unsigned int, unsigned int>> mLastPositions;