From 10a73e07d1f80b29f3db90ab5dfc93d4619f78d9 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 14 Jun 2021 16:07:24 +0200 Subject: [PATCH] Cleaning u --- lib/Ray/sources/Model/ModelAnimation.cpp | 5 ----- lib/Ray/sources/Model/ModelAnimation.hpp | 5 +---- sources/Component/Animation/AnimationsComponent.cpp | 7 ++++--- sources/Component/Animation/AnimationsComponent.hpp | 4 ++-- sources/Runner/GameScene.cpp | 2 +- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/Ray/sources/Model/ModelAnimation.cpp b/lib/Ray/sources/Model/ModelAnimation.cpp index 043f57e3..c74707a5 100644 --- a/lib/Ray/sources/Model/ModelAnimation.cpp +++ b/lib/Ray/sources/Model/ModelAnimation.cpp @@ -42,9 +42,4 @@ RAY::ModelAnimation &RAY::ModelAnimation::incrementFrameCounter() RAY::ModelAnimation::operator ::ModelAnimation() const { return *this->_animation; -} - -RAY::ModelAnimation::operator ::ModelAnimation *() -{ - return this->_animation; } \ No newline at end of file diff --git a/lib/Ray/sources/Model/ModelAnimation.hpp b/lib/Ray/sources/Model/ModelAnimation.hpp index 5386fec2..63de25d6 100644 --- a/lib/Ray/sources/Model/ModelAnimation.hpp +++ b/lib/Ray/sources/Model/ModelAnimation.hpp @@ -17,7 +17,7 @@ namespace RAY { public: //! @brief A Model animation constructor //! @param animationPtr an animation pointer, returned by the nimation-loading function - ModelAnimation(::ModelAnimation *animationPtr); + explicit ModelAnimation(::ModelAnimation *animationPtr); //! @brief A default copy-constructor ModelAnimation(const ModelAnimation &) = default; @@ -45,9 +45,6 @@ namespace RAY { size_t _frameCounter; INTERNAL: - //! @brief Castin Object to raw model animation pointer - operator ::ModelAnimation *(); - //! @brief Castin Object to raw model animation pointer operator ::ModelAnimation() const; }; diff --git a/sources/Component/Animation/AnimationsComponent.cpp b/sources/Component/Animation/AnimationsComponent.cpp index 4acf5041..4461cc8e 100644 --- a/sources/Component/Animation/AnimationsComponent.cpp +++ b/sources/Component/Animation/AnimationsComponent.cpp @@ -8,9 +8,9 @@ namespace BBM { - AnimationsComponent::AnimationsComponent(WAL::Entity &entity, int animIndex, bool play) + AnimationsComponent::AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex, bool play) : WAL::Component(entity), - _modelAnimation("assets/player/player.iqm"), + _modelAnimation(std::move(modelAnimation)), _currentAnimIndex(animIndex), _animDisabled(play) { @@ -20,6 +20,7 @@ namespace BBM WAL::Component *AnimationsComponent::clone(WAL::Entity &entity) const { return new AnimationsComponent(entity, + RAY::ModelAnimations(this->_modelAnimation.getFilePath()), this->_currentAnimIndex); } @@ -28,7 +29,7 @@ namespace BBM return this->_modelAnimation.at(this->_currentAnimIndex).getFrameCounter(); } - RAY::ModelAnimation &AnimationsComponent::getCurrentModelAnim() + RAY::ModelAnimation AnimationsComponent::getCurrentModelAnim() { return this->_modelAnimation[this->_currentAnimIndex]; } diff --git a/sources/Component/Animation/AnimationsComponent.hpp b/sources/Component/Animation/AnimationsComponent.hpp index 8f4e6a6e..463f241f 100644 --- a/sources/Component/Animation/AnimationsComponent.hpp +++ b/sources/Component/Animation/AnimationsComponent.hpp @@ -34,7 +34,7 @@ namespace BBM size_t getCurrentAnimFrameCounter() const; //! @brief get the current - RAY::ModelAnimation &getCurrentModelAnim(); + RAY::ModelAnimation getCurrentModelAnim(); //! @brief set the anim frame counter void setCurrentAnimFrameCounter(size_t animFrameCounter); @@ -52,7 +52,7 @@ namespace BBM bool isAnimDisabled() const; //! @brief ctor entity and the path of the animation file - AnimationsComponent(WAL::Entity &entity, int animIndex, bool play = true); + explicit AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex, bool play = true); //! @brief copy ctor AnimationsComponent(const AnimationsComponent &) = default; //! @brief dtor diff --git a/sources/Runner/GameScene.cpp b/sources/Runner/GameScene.cpp index 55f2f28c..ca6961ff 100644 --- a/sources/Runner/GameScene.cpp +++ b/sources/Runner/GameScene.cpp @@ -49,7 +49,7 @@ namespace BBM .addComponent() // .addComponent("assets/shaders/glsl330/predator.fs") .addComponent>() - .addComponent(3) + .addComponent(RAY::ModelAnimations("assets/player/player.iqm"), 3) .addComponent(BBM::Vector3f{0.25, 0, 0.25}, BBM::Vector3f{.75, 2, .75}) .addComponent() .addComponent(soundPath)