Removed the usage of assert to prevent associated compile warnings and to clean up code
This commit is contained in:
@@ -247,7 +247,6 @@ int main (int argc, char* argv[])
|
||||
osg::ref_ptr<osg::Vec3Array> src = dynamic_cast<osg::Vec3Array*>(geom->getVertexArray());
|
||||
geom->getOrCreateStateSet()->setMode(GL_LIGHTING, false);
|
||||
geom->setDataVariance(osg::Object::DYNAMIC);
|
||||
OSGANIMATION_ASSERT(src);
|
||||
|
||||
initVertexMap(root.get(), right0.get(), right1.get(), geom, src.get());
|
||||
|
||||
|
||||
@@ -40,10 +40,10 @@ namespace osgAnimation
|
||||
}
|
||||
|
||||
#ifdef OSGANIMATION_ASSERT_THROW
|
||||
#define OSGANIMATION_ASSERT(a) if (!(a)) throw osgAnimation::ThrowAssert(std::string(#a),__FILE__,__LINE__);
|
||||
//#define OSGANIMATION_ASSERT(a) if (!(a)) throw osgAnimation::ThrowAssert(std::string(#a),__FILE__,__LINE__);
|
||||
|
||||
#else
|
||||
#define OSGANIMATION_ASSERT(a) {if (!(a)) *((int*)0) = 0;}
|
||||
//#define OSGANIMATION_ASSERT(a) {if (!(a)) *((int*)0) = 0;}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <osgAnimation/Export>
|
||||
#include <osgAnimation/Sampler>
|
||||
#include <osgAnimation/Target>
|
||||
#include <osgAnimation/Assert>
|
||||
#include <osg/Referenced>
|
||||
#include <string>
|
||||
|
||||
@@ -107,8 +106,8 @@ namespace osgAnimation
|
||||
TargetType* getTargetTyped() { return _target.get(); }
|
||||
void setTarget(TargetType* target) { _target = target; }
|
||||
|
||||
virtual float getStartTime() const { OSGANIMATION_ASSERT(_sampler.valid() && "no sampler attached to channel"); return _sampler->getStartTime(); }
|
||||
virtual float getEndTime() const { OSGANIMATION_ASSERT(_sampler.valid() && "no sampler attached to channel"); return _sampler->getEndTime(); }
|
||||
virtual float getStartTime() const { return _sampler->getStartTime(); }
|
||||
virtual float getEndTime() const { return _sampler->getEndTime(); }
|
||||
|
||||
protected:
|
||||
osg::ref_ptr<TargetType> _target;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#ifndef OSGANIMATION_INTERPOLATOR_H
|
||||
#define OSGANIMATION_INTERPOLATOR_H
|
||||
|
||||
#include <osgAnimation/Assert>
|
||||
#include <osgAnimation/Interpolator>
|
||||
#include <osgAnimation/Keyframe>
|
||||
|
||||
@@ -37,9 +36,6 @@ namespace osgAnimation
|
||||
void reset() { _lastKeyAccess = -1; }
|
||||
int getKeyIndexFromTime(const TemplateKeyframeContainer<KEY>& keys, float time) const
|
||||
{
|
||||
OSGANIMATION_ASSERT(!keys.empty() && "no keys");
|
||||
OSGANIMATION_ASSERT(time >= keys.front().getTime() && time <= keys.back().getTime() && "bad range");
|
||||
|
||||
// todo use a cache
|
||||
int key_size = keys.size();
|
||||
const TemplateKeyframe<KeyframeType>* keysVector = &keys.front();
|
||||
@@ -47,10 +43,7 @@ namespace osgAnimation
|
||||
{
|
||||
float time0 = keysVector[i].getTime();
|
||||
float time1 = keysVector[i+1].getTime();
|
||||
#ifndef OSGANIMATION_NO_EXTRA_CHECK
|
||||
if ( time0>time1 )
|
||||
OSGANIMATION_ASSERT(0 && "invalid input data");
|
||||
#endif
|
||||
|
||||
if ( time >= time0 && time < time1 )
|
||||
{
|
||||
_lastKeyAccess = i;
|
||||
@@ -59,7 +52,7 @@ namespace osgAnimation
|
||||
}
|
||||
std::cout << time << " first key " << keysVector[0].getTime() << " last key " << keysVector[key_size-1].getTime() << std::endl;
|
||||
*((int *)0) = 0;
|
||||
OSGANIMATION_ASSERT(0 && "impossible has happened");
|
||||
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <osg/ref_ptr>
|
||||
#include <osgAnimation/Keyframe>
|
||||
#include <osgAnimation/Interpolator>
|
||||
#include <osgAnimation/Assert>
|
||||
|
||||
namespace osgAnimation
|
||||
{
|
||||
@@ -65,13 +64,11 @@ namespace osgAnimation
|
||||
|
||||
float getStartTime() const
|
||||
{
|
||||
OSGANIMATION_ASSERT(_keyframes.valid() && !_keyframes->empty() && "no keyframes");
|
||||
return _keyframes->front().getTime();
|
||||
}
|
||||
|
||||
float getEndTime() const
|
||||
{
|
||||
OSGANIMATION_ASSERT(_keyframes.valid() && !_keyframes->empty() && "no keyframes");
|
||||
return _keyframes->back().getTime();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <osgAnimation/Assert>
|
||||
#include <osgAnimation/VertexInfluence>
|
||||
#include <osgAnimation/Bone>
|
||||
#include <osg/Matrix>
|
||||
@@ -163,7 +162,6 @@ namespace osgAnimation
|
||||
|
||||
template <class V> void compute(const V* src, V* dst)
|
||||
{
|
||||
OSGANIMATION_ASSERT(src != dst);
|
||||
int size = _boneSetVertexSet.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
@@ -183,7 +181,6 @@ namespace osgAnimation
|
||||
|
||||
template <class V> void compute(const MatrixType& transform, const MatrixType& invTransform, const V* src, V* dst)
|
||||
{
|
||||
OSGANIMATION_ASSERT(src != dst);
|
||||
int size = _boneSetVertexSet.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include <osgAnimation/AnimationManager>
|
||||
#include <osgAnimation/LinkVisitor>
|
||||
#include <osgAnimation/Assert>
|
||||
|
||||
using namespace osgAnimation;
|
||||
|
||||
@@ -40,8 +39,10 @@ AnimationManager::AnimationManager()
|
||||
}
|
||||
void AnimationManager::playAnimation(Animation* pAnimation, int priority, float weight)
|
||||
{
|
||||
bool r = findAnimation(pAnimation);
|
||||
OSGANIMATION_ASSERT(r && "This animation is not registered");
|
||||
if (!findAnimation(pAnimation))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isPlaying(pAnimation) )
|
||||
stopAnimation(pAnimation);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include <osgAnimation/AnimationManagerBase>
|
||||
#include <osgAnimation/LinkVisitor>
|
||||
#include <osgAnimation/Assert>
|
||||
|
||||
using namespace osgAnimation;
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include <osgAnimation/BasicAnimationManager>
|
||||
#include <osgAnimation/LinkVisitor>
|
||||
#include <osgAnimation/Assert>
|
||||
|
||||
using namespace osgAnimation;
|
||||
|
||||
@@ -38,8 +37,10 @@ BasicAnimationManager::BasicAnimationManager()
|
||||
}
|
||||
void BasicAnimationManager::playAnimation(Animation* pAnimation, int priority, float weight)
|
||||
{
|
||||
bool r = findAnimation(pAnimation);
|
||||
OSGANIMATION_ASSERT(r && "This animation is not registered");
|
||||
if (!findAnimation(pAnimation))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isPlaying(pAnimation) )
|
||||
stopAnimation(pAnimation);
|
||||
|
||||
Reference in New Issue
Block a user