mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 07:48:08 +02:00
libraries/animation: cppcheck fixes
* Fix for potential bug in AnimLoop due to _maxFrameIndexHint being uninitialized. * made more single argument constructors explicit.
This commit is contained in:
parent
11fcf00b2a
commit
9f30556084
9 changed files with 14 additions and 21 deletions
|
@ -21,7 +21,7 @@
|
|||
class AnimExpression {
|
||||
public:
|
||||
friend class AnimTests;
|
||||
AnimExpression(const QString& str);
|
||||
explicit AnimExpression(const QString& str);
|
||||
protected:
|
||||
struct Token {
|
||||
enum Type {
|
||||
|
@ -49,8 +49,8 @@ protected:
|
|||
Comma,
|
||||
Error
|
||||
};
|
||||
Token(Type type) : type {type} {}
|
||||
Token(const QStringRef& strRef) : type {Type::Identifier}, strVal {strRef.toString()} {}
|
||||
explicit Token(Type type) : type {type} {}
|
||||
explicit Token(const QStringRef& strRef) : type {Type::Identifier}, strVal {strRef.toString()} {}
|
||||
explicit Token(int val) : type {Type::Int}, intVal {val} {}
|
||||
explicit Token(bool val) : type {Type::Bool}, intVal {val} {}
|
||||
explicit Token(float val) : type {Type::Float}, floatVal {val} {}
|
||||
|
@ -82,7 +82,7 @@ protected:
|
|||
Modulus,
|
||||
UnaryMinus
|
||||
};
|
||||
OpCode(Type type) : type {type} {}
|
||||
explicit OpCode(Type type) : type {type} {}
|
||||
explicit OpCode(const QStringRef& strRef) : type {Type::Identifier}, strVal {strRef.toString()} {}
|
||||
explicit OpCode(const QString& str) : type {Type::Identifier}, strVal {str} {}
|
||||
explicit OpCode(int val) : type {Type::Int}, intVal {val} {}
|
||||
|
|
|
@ -25,7 +25,7 @@ class RotationConstraint;
|
|||
class AnimInverseKinematics : public AnimNode {
|
||||
public:
|
||||
|
||||
AnimInverseKinematics(const QString& id);
|
||||
explicit AnimInverseKinematics(const QString& id);
|
||||
virtual ~AnimInverseKinematics() override;
|
||||
|
||||
void loadDefaultPoses(const AnimPoseVec& poses);
|
||||
|
|
|
@ -25,7 +25,7 @@ class AnimNodeLoader : public QObject {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AnimNodeLoader(const QUrl& url);
|
||||
explicit AnimNodeLoader(const QUrl& url);
|
||||
|
||||
signals:
|
||||
void success(AnimNode::Pointer node);
|
||||
|
|
|
@ -110,7 +110,7 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
AnimStateMachine(const QString& id);
|
||||
explicit AnimStateMachine(const QString& id);
|
||||
virtual ~AnimStateMachine() override;
|
||||
|
||||
virtual const AnimPoseVec& evaluate(const AnimVariantMap& animVars, float dt, Triggers& triggersOut) override;
|
||||
|
|
|
@ -38,7 +38,7 @@ protected:
|
|||
virtual QSharedPointer<Resource> createResource(const QUrl& url,
|
||||
const QSharedPointer<Resource>& fallback, bool delayLoad, const void* extra);
|
||||
private:
|
||||
AnimationCache(QObject* parent = NULL);
|
||||
explicit AnimationCache(QObject* parent = NULL);
|
||||
virtual ~AnimationCache() { }
|
||||
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ class Animation : public Resource {
|
|||
|
||||
public:
|
||||
|
||||
Animation(const QUrl& url);
|
||||
explicit Animation(const QUrl& url);
|
||||
|
||||
const FBXGeometry& getGeometry() const { return *_geometry; }
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ AnimationLoop::AnimationLoop(const AnimationDetails& animationDetails) :
|
|||
_lastFrame(animationDetails.lastFrame),
|
||||
_running(animationDetails.running),
|
||||
_currentFrame(animationDetails.currentFrame),
|
||||
_maxFrameIndexHint(MAXIMUM_POSSIBLE_FRAME),
|
||||
_resetOnRunning(true),
|
||||
_lastSimulated(usecTimestampNow())
|
||||
{
|
||||
|
@ -55,6 +56,7 @@ AnimationLoop::AnimationLoop(float fps, bool loop, bool hold, bool startAutomati
|
|||
_lastFrame(lastFrame),
|
||||
_running(running),
|
||||
_currentFrame(currentFrame),
|
||||
_maxFrameIndexHint(MAXIMUM_POSSIBLE_FRAME),
|
||||
_resetOnRunning(true),
|
||||
_lastSimulated(usecTimestampNow())
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
static const float MAXIMUM_POSSIBLE_FRAME;
|
||||
|
||||
AnimationLoop();
|
||||
AnimationLoop(const AnimationDetails& animationDetails);
|
||||
explicit AnimationLoop(const AnimationDetails& animationDetails);
|
||||
AnimationLoop(float fps, bool loop, bool hold, bool startAutomatically, float firstFrame,
|
||||
float lastFrame, bool running, float currentFrame);
|
||||
|
||||
|
|
|
@ -37,17 +37,7 @@ static bool isEqual(const glm::quat& p, const glm::quat& q) {
|
|||
return 1.0f - fabsf(glm::dot(p, q)) <= EPSILON;
|
||||
}
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define ASSERT(cond)
|
||||
#else
|
||||
#define ASSERT(cond) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
int* ptr = nullptr; \
|
||||
*ptr = 10; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
#define ASSERT(cond) assert(cond)
|
||||
|
||||
// 2 meter tall dude
|
||||
const glm::vec3 DEFAULT_RIGHT_EYE_POS(-0.3f, 0.9f, 0.0f);
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
Hover
|
||||
};
|
||||
|
||||
Rig() {}
|
||||
virtual ~Rig() {}
|
||||
|
||||
void destroyAnimGraph();
|
||||
|
|
Loading…
Reference in a new issue