Cleaning u

This commit is contained in:
Zoe Roux
2021-06-14 16:07:24 +02:00
parent 9b385349dc
commit 10a73e07d1
5 changed files with 8 additions and 15 deletions

View File

@@ -42,9 +42,4 @@ RAY::ModelAnimation &RAY::ModelAnimation::incrementFrameCounter()
RAY::ModelAnimation::operator ::ModelAnimation() const RAY::ModelAnimation::operator ::ModelAnimation() const
{ {
return *this->_animation; return *this->_animation;
}
RAY::ModelAnimation::operator ::ModelAnimation *()
{
return this->_animation;
} }

View File

@@ -17,7 +17,7 @@ namespace RAY {
public: public:
//! @brief A Model animation constructor //! @brief A Model animation constructor
//! @param animationPtr an animation pointer, returned by the nimation-loading function //! @param animationPtr an animation pointer, returned by the nimation-loading function
ModelAnimation(::ModelAnimation *animationPtr); explicit ModelAnimation(::ModelAnimation *animationPtr);
//! @brief A default copy-constructor //! @brief A default copy-constructor
ModelAnimation(const ModelAnimation &) = default; ModelAnimation(const ModelAnimation &) = default;
@@ -45,9 +45,6 @@ namespace RAY {
size_t _frameCounter; size_t _frameCounter;
INTERNAL: INTERNAL:
//! @brief Castin Object to raw model animation pointer
operator ::ModelAnimation *();
//! @brief Castin Object to raw model animation pointer //! @brief Castin Object to raw model animation pointer
operator ::ModelAnimation() const; operator ::ModelAnimation() const;
}; };

View File

@@ -8,9 +8,9 @@
namespace BBM 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), : WAL::Component(entity),
_modelAnimation("assets/player/player.iqm"), _modelAnimation(std::move(modelAnimation)),
_currentAnimIndex(animIndex), _currentAnimIndex(animIndex),
_animDisabled(play) _animDisabled(play)
{ {
@@ -20,6 +20,7 @@ namespace BBM
WAL::Component *AnimationsComponent::clone(WAL::Entity &entity) const WAL::Component *AnimationsComponent::clone(WAL::Entity &entity) const
{ {
return new AnimationsComponent(entity, return new AnimationsComponent(entity,
RAY::ModelAnimations(this->_modelAnimation.getFilePath()),
this->_currentAnimIndex); this->_currentAnimIndex);
} }
@@ -28,7 +29,7 @@ namespace BBM
return this->_modelAnimation.at(this->_currentAnimIndex).getFrameCounter(); return this->_modelAnimation.at(this->_currentAnimIndex).getFrameCounter();
} }
RAY::ModelAnimation &AnimationsComponent::getCurrentModelAnim() RAY::ModelAnimation AnimationsComponent::getCurrentModelAnim()
{ {
return this->_modelAnimation[this->_currentAnimIndex]; return this->_modelAnimation[this->_currentAnimIndex];
} }

View File

@@ -34,7 +34,7 @@ namespace BBM
size_t getCurrentAnimFrameCounter() const; size_t getCurrentAnimFrameCounter() const;
//! @brief get the current //! @brief get the current
RAY::ModelAnimation &getCurrentModelAnim(); RAY::ModelAnimation getCurrentModelAnim();
//! @brief set the anim frame counter //! @brief set the anim frame counter
void setCurrentAnimFrameCounter(size_t animFrameCounter); void setCurrentAnimFrameCounter(size_t animFrameCounter);
@@ -52,7 +52,7 @@ namespace BBM
bool isAnimDisabled() const; bool isAnimDisabled() const;
//! @brief ctor entity and the path of the animation file //! @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 //! @brief copy ctor
AnimationsComponent(const AnimationsComponent &) = default; AnimationsComponent(const AnimationsComponent &) = default;
//! @brief dtor //! @brief dtor

View File

@@ -49,7 +49,7 @@ namespace BBM
.addComponent<AnimatorComponent>() .addComponent<AnimatorComponent>()
// .addComponent<ShaderComponentModel>("assets/shaders/glsl330/predator.fs") // .addComponent<ShaderComponentModel>("assets/shaders/glsl330/predator.fs")
.addComponent<TagComponent<Blowable>>() .addComponent<TagComponent<Blowable>>()
.addComponent<AnimationsComponent>(3) .addComponent<AnimationsComponent>(RAY::ModelAnimations("assets/player/player.iqm"), 3)
.addComponent<CollisionComponent>(BBM::Vector3f{0.25, 0, 0.25}, BBM::Vector3f{.75, 2, .75}) .addComponent<CollisionComponent>(BBM::Vector3f{0.25, 0, 0.25}, BBM::Vector3f{.75, 2, .75})
.addComponent<MovableComponent>() .addComponent<MovableComponent>()
.addComponent<SoundComponent>(soundPath) .addComponent<SoundComponent>(soundPath)