Commit a922437c authored by Jan Möbius's avatar Jan Möbius

Merge branch 'warnings' into 'master'

Warnings

See merge request !193
parents d2966516 b3ef320b
Pipeline #3588 passed with stage
in 42 minutes and 1 second
......@@ -863,7 +863,7 @@ void CoordsysNode::boundingCircle(std::vector<Vec2f> &_in, Vec2f &_center, float
for (unsigned int i = 0; i < _in.size () - 1; i++)
for (unsigned int j = i + 1; j < _in.size (); j++)
{
Vec2f cen = (_in[i] + _in[j]) * 0.5;
Vec2f cen = (_in[i] + _in[j]) * 0.5f;
float rad = (_in[i] - cen).length ();
bool allin = true;
......
......@@ -301,9 +301,9 @@ add_primitive(GlutPrimitiveType _type, Vec3d _pos, Vec3d _axis, ACG::Vec4f _colo
//----------------------------------------------------------------------------
void
GlutPrimitiveNode::draw_obj(int _idx) const
GlutPrimitiveNode::draw_obj(size_t _idx) const
{
if (_idx < 0 || _idx >= (int)primitives_.size()) // range check
if ( _idx >= primitives_.size()) // range check
return;
Vec3d axis = primitives_[_idx].axis;
......@@ -390,7 +390,7 @@ pick(GLState& _state , PickTarget _target)
case PICK_ANYTHING:
case PICK_FACE:
{
for (int i = 0; i < (int)primitives_.size(); ++i)
for (size_t i = 0; i < primitives_.size(); ++i)
{
_state.pick_set_name(i);
glPushMatrix();
......
......@@ -217,7 +217,7 @@ public:
/// drawing the primitive
void draw(GLState& _state, const DrawModes::DrawMode& _drawMode);
void draw_obj(int _idx) const;
void draw_obj(size_t _idx) const;
/// picking
void pick(GLState& _state, PickTarget _target);
......
......@@ -372,7 +372,7 @@ void LineNode::pick(GLState& _state , PickTarget _target)
ACG::GLState::vertexPointer( &(points_)[0] );
ACG::GLState::enableClientState(GL_VERTEX_ARRAY);
const unsigned int n_edges = n_points() - 1;
const size_t n_edges = n_points() - 1;
switch (_target)
{
......@@ -414,25 +414,25 @@ void LineNode::pick_edges(GLState& _state, unsigned int _offset)
if (line_mode_ == PolygonMode)
{
const unsigned int n_edges = n_points() - 1;
for (unsigned int i = 0; i < n_edges; ++i)
const size_t n_edges = n_points() - 1;
for (size_t i = 0; i < n_edges; ++i)
{
_state.pick_set_name(i + _offset);
glBegin(GL_LINES);
glArrayElement(i);
glArrayElement(i + 1);
glArrayElement(static_cast<GLint>(i));
glArrayElement(static_cast<GLint>(i + 1));
glEnd();
}
}
else if (line_mode_ == LineSegmentsMode)
{
const unsigned int n_edges = n_points() / 2;
for (unsigned int i = 0; i < n_edges; ++i)
const size_t n_edges = n_points() / 2;
for (size_t i = 0; i < n_edges; ++i)
{
_state.pick_set_name(i + _offset);
glBegin(GL_LINES);
glArrayElement(2*i);
glArrayElement(2*i + 1);
glArrayElement(static_cast<GLint>(2*i));
glArrayElement(static_cast<GLint>(2*i + 1));
glEnd();
}
}
......
......@@ -266,7 +266,7 @@ enter(GLState& _state, const DrawModes::DrawMode& /*_drawmode*/) {
ACG::GLState::enable(GL_TEXTURE_2D);
ACG::GLState::enable(GL_BLEND);
ACG::GLState::enable(GL_ALPHA_TEST);
ACG::GLState::alphaFunc(GL_GREATER, 0.2);
ACG::GLState::alphaFunc(GL_GREATER, 0.2f);
ACG::GLState::blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (alwaysOnTop_)
ACG::GLState::disable(GL_DEPTH_TEST);
......
......@@ -106,8 +106,8 @@ class DLLEXPORT QtPlaneSelect : public QObject
public:
ACG::Vec3d getNormal( ) { return normal; }
ACG::Vec3d getSourcePoint( ) { return sourcePoint3D; }
unsigned int getNode() { return nodeIdx_; };
unsigned int getTargetIndex() { return targetIdx_; };
size_t getNode() { return nodeIdx_; };
size_t getTargetIndex() { return targetIdx_; };
/*******************************************************************************
......@@ -117,8 +117,8 @@ class DLLEXPORT QtPlaneSelect : public QObject
ACG::GLState& glState;
ACG::Vec3d sourcePoint3D;
ACG::Vec3d normal;
unsigned int nodeIdx_;
unsigned int targetIdx_;
size_t nodeIdx_;
size_t targetIdx_;
bool isDragging;
PlaneNode* planeNode_;
......
......@@ -59,16 +59,16 @@ public:
/// Constructs an invalid animation handle (interpreted as handle of the reference pose)
AnimationHandle() : idAnimation(0), iFrame(0) {};
/// Constructs a valid handle for the given animation and frame
AnimationHandle(unsigned int idAnimation, unsigned int iFrame = 0) : idAnimation(idAnimation + 1), iFrame(iFrame) {};
AnimationHandle(size_t idAnimation, size_t iFrame = 0) : idAnimation(idAnimation + 1), iFrame(iFrame) {};
/// Returns true if the handle is valid
inline bool isValid() const { return idAnimation > 0; }
/// Returns the animation index (zero based)
inline unsigned int animationIndex() const { return idAnimation - 1; }
inline size_t animationIndex() const { return idAnimation - 1; }
/// Returns the selected frame (zero based)
inline unsigned int frame() const { return iFrame; }
inline size_t frame() const { return iFrame; }
/// Sets the current animation frame (not failsafe)
inline void setFrame(unsigned int _iFrame) { iFrame = _iFrame; }
inline void setFrame(size_t _iFrame) { iFrame = _iFrame; }
/// Returns to the first frame
inline void firstFrame() { iFrame = 0; }
......@@ -82,9 +82,9 @@ public:
private:
/// The one based index of the animation, set to 0 for invalid (or reference pose)
unsigned int idAnimation;
size_t idAnimation;
/// The frame number
unsigned int iFrame;
size_t iFrame;
};
#endif // ANIMATIONHANDLE_HH
......@@ -82,7 +82,7 @@ void SkeletonTransform::scaleSkeleton(double _factor, Skeleton::Pose* _pose) {
// if given pose is refPose
if ( _pose == refPose_){
//scale bones in the animations
for (unsigned int a=0; a < skeleton_.animationCount(); a++)
for (size_t a=0; a < skeleton_.animationCount(); a++)
for (unsigned int iFrame = 0; iFrame < skeleton_.animation(a)->frameCount(); iFrame++){
Skeleton::Pose* pose = skeleton_.animation(a)->pose( iFrame );
......
......@@ -100,7 +100,7 @@ JointT<PointT>::~JointT()
* not to change, unless joints are deleted from the skeleton.
*/
template <class PointT>
inline unsigned int JointT<PointT>::id()
inline size_t JointT<PointT>::id() const
{
return id_;
}
......@@ -108,7 +108,7 @@ inline unsigned int JointT<PointT>::id()
//-----------------------------------------------------------------------------------------------------
template <class PointT>
inline void JointT<PointT>::setId(unsigned int _id)
inline void JointT<PointT>::setId(const size_t _id)
{
id_ = _id;
}
......@@ -167,9 +167,9 @@ inline JointT<PointT> *JointT<PointT>::parent()
//-----------------------------------------------------------------------------------------------------
template <class PointT>
inline bool JointT<PointT>::isRoot()
inline bool JointT<PointT>::isRoot() const
{
return parent_ == NULL;
return (parent_ == NULL);
}
//-----------------------------------------------------------------------------------------------------
......@@ -200,7 +200,7 @@ inline typename JointT<PointT>::ChildIter JointT<PointT>::end()
* @brief Returns the number of children
*/
template<typename PointT>
inline size_t JointT<PointT>::size()
inline size_t JointT<PointT>::size() const
{
return children_.size();
}
......@@ -230,7 +230,7 @@ inline JointT<PointT> *JointT<PointT>::child(size_t _index)
*
*/
template <class PointT>
inline bool JointT<PointT>::selected()
inline bool JointT<PointT>::selected() const
{
return selected_;
}
......@@ -250,14 +250,14 @@ inline void JointT<PointT>::setSelected(bool _selected)
//-----------------------------------------------------------------------------------------------------
template<typename PointT>
inline std::string JointT<PointT>::name() {
inline std::string JointT<PointT>::name() const {
return name_;
}
//-----------------------------------------------------------------------------------------------------
template<typename PointT>
inline void JointT<PointT>::setName(std::string _name) {
inline void JointT<PointT>::setName(const std::string _name) {
name_ = _name;
}
......
......@@ -82,13 +82,13 @@ public:
~JointT();
/// returns the joint id
inline unsigned int id();
inline size_t id() const;
/// access parent of the joint
inline void setParent(Joint *_newParent, SkeletonT<PointT> &_skeleton);
inline Joint *parent();
inline bool isRoot();
inline bool isRoot() const;
public:
/**
......@@ -98,7 +98,7 @@ public:
//@{
inline ChildIter begin();
inline ChildIter end();
inline size_t size();
inline size_t size() const;
inline Joint *child(size_t _index);
//@}
......@@ -107,21 +107,21 @@ public:
* change and access selection state
*/
//@{
inline bool selected();
inline bool selected() const;
inline void setSelected(bool _selected);
//@}
/// Access the name of the joint
inline std::string name();
inline void setName(std::string _name);
inline std::string name() const;
inline void setName(const std::string _name);
private:
/// An unique identifier, guaranteed to be part of a continuous sequence starting from 0
unsigned int id_;
size_t id_;
bool selected_;
protected:
inline void setId(unsigned int _id);
inline void setId(const size_t _id);
/// The parent joint; this joint is in its parents JointT::children_ vector. It's 0 for the root node.
Joint *parent_;
......
......@@ -284,7 +284,7 @@ typename PoseT<PointT>::Matrix PoseT<PointT>::globalMatrixInv(unsigned int _join
//-----------------------------------------------------------------------------
template<typename PointT>
void PoseT<PointT>::insertJointAt(unsigned int _index)
void PoseT<PointT>::insertJointAt(size_t _index)
{
Matrix id;
id.identity();
......@@ -301,7 +301,7 @@ void PoseT<PointT>::insertJointAt(unsigned int _index)
//-----------------------------------------------------------------------------
template<typename PointT>
void PoseT<PointT>::removeJointAt(unsigned int _index)
void PoseT<PointT>::removeJointAt(size_t _index)
{
local_.erase(local_.begin() + _index);
global_.erase(global_.begin() + _index);
......@@ -318,7 +318,7 @@ void PoseT<PointT>::removeJointAt(unsigned int _index)
* @param _keepChildPositions Do the children stay at the same position or do they move with their parent joint
*/
template<typename PointT>
void PoseT<PointT>::updateFromLocal(unsigned int _joint, bool _keepChildPositions)
void PoseT<PointT>::updateFromLocal(size_t _joint, bool _keepChildPositions)
{
// first update the global coordinate system
if(skeleton_->parent(_joint) == -1)
......@@ -336,7 +336,7 @@ void PoseT<PointT>::updateFromLocal(unsigned int _joint, bool _keepChildPosition
// update children
if (_keepChildPositions) {
// finally update all children as well
for(unsigned int i = 0; i < skeleton_->childCount(_joint); ++i) {
for(size_t i = 0; i < skeleton_->childCount(_joint); ++i) {
updateFromLocal(skeleton_->child(_joint, i));
}
} else {
......@@ -356,7 +356,7 @@ void PoseT<PointT>::updateFromLocal(unsigned int _joint, bool _keepChildPosition
* @param _keepChildPositions Do the children stay at the same global position or do they move with their parent joint
*/
template<typename PointT>
void PoseT<PointT>::updateFromGlobal(unsigned int _joint, bool _keepChildPositions)
void PoseT<PointT>::updateFromGlobal(size_t _joint, bool _keepChildPositions)
{
// first update the local coordinate system
if(skeleton_->parent(_joint) == -1)
......@@ -373,7 +373,7 @@ void PoseT<PointT>::updateFromGlobal(unsigned int _joint, bool _keepChildPositio
// update children
if (_keepChildPositions) {
for(unsigned int i = 0; i < skeleton_->childCount(_joint); ++i) {
for(size_t i = 0; i < skeleton_->childCount(_joint); ++i) {
updateFromGlobal(skeleton_->child(_joint, i));
}
} else {
......@@ -400,7 +400,7 @@ void PoseT<PointT>::updateFromGlobal(unsigned int _joint, bool _keepChildPositio
* @param _joint The joints index, same as for SkeletonT<>::joint
*/
template<typename PointT>
inline const typename PoseT<PointT>::Matrix& PoseT<PointT>::unifiedMatrix(unsigned int _joint)
inline const typename PoseT<PointT>::Matrix& PoseT<PointT>::unifiedMatrix(size_t _joint)
{
return unified_[_joint];
}
......@@ -418,7 +418,7 @@ inline const typename PoseT<PointT>::Matrix& PoseT<PointT>::unifiedMatrix(unsign
* @return The rotational part of the unified matrix
*/
template<typename PointT>
inline const typename PoseT<PointT>::Quaternion& PoseT<PointT>::unifiedRotation(unsigned int _joint)
inline const typename PoseT<PointT>::Quaternion& PoseT<PointT>::unifiedRotation(size_t _joint)
{
return unifiedDualQuaternion_[_joint].real();
}
......@@ -434,7 +434,7 @@ inline const typename PoseT<PointT>::Quaternion& PoseT<PointT>::unifiedRotation(
* @return The rotational part of the unified matrix
*/
template<typename PointT>
inline const typename PoseT<PointT>::DualQuaternion& PoseT<PointT>::unifiedDualQuaternion(unsigned int _joint)
inline const typename PoseT<PointT>::DualQuaternion& PoseT<PointT>::unifiedDualQuaternion(size_t _joint)
{
return unifiedDualQuaternion_[_joint];
}
......
......@@ -135,7 +135,7 @@ public:
* @param _index The new joint is inserted at this position. Insert new joints at the end by passing
* SkeletonT<>::jointCount() as parameter.
*/
virtual void insertJointAt(unsigned int _index);
virtual void insertJointAt(size_t _index);
/**
* \brief Called by the skeleton/animation as a joint is removed
......@@ -148,7 +148,7 @@ public:
* @param _index The new joint is inserted at this position. Insert new joints at the end by passing
* SkeletonT<>::jointCount() as parameter.
*/
virtual void removeJointAt(unsigned int _index);
virtual void removeJointAt(size_t _index);
/** @} */
......@@ -161,8 +161,8 @@ protected:
* @{ */
// =======================================================================================
void updateFromLocal(unsigned int _joint, bool _keepChildPositions=true);
void updateFromGlobal(unsigned int _joint, bool _keepChildPositions=true);
void updateFromLocal(size_t _joint, bool _keepChildPositions=true);
void updateFromGlobal(size_t _joint, bool _keepChildPositions=true);
/** @} */
......@@ -175,9 +175,9 @@ public:
* @{ */
// =======================================================================================
inline const Matrix& unifiedMatrix(unsigned int _joint);
inline const Quaternion& unifiedRotation(unsigned int _joint);
inline const DualQuaternion& unifiedDualQuaternion(unsigned int _joint);
inline const Matrix& unifiedMatrix(size_t _joint);
inline const Quaternion& unifiedRotation(size_t _joint);
inline const DualQuaternion& unifiedDualQuaternion(size_t _joint);
/** @} */
......
......@@ -860,7 +860,7 @@ void SkeletonNodeT<SkeletonType>::getRenderObjects(IRenderer* _renderer,
_state));
GLMatrixf modelview = ro.modelview;
modelview.translate(globalPosD[0], globalPosD[1], globalPosD[2]);
modelview.translate(static_cast<float>(globalPosD[0]), static_cast<float>(globalPosD[1]), static_cast<float>(globalPosD[2]));
modelview.scale(sphereSize, sphereSize, sphereSize);
// store matrix
......
......@@ -308,7 +308,7 @@ SkeletonT<PointT>::AnimationIterator::AnimationIterator(std::vector<Animation*>&
*
*/
template<typename PointT>
SkeletonT<PointT>::AnimationIterator::AnimationIterator(std::vector<Animation*>& _animations, unsigned int _animationIndex ) :
SkeletonT<PointT>::AnimationIterator::AnimationIterator(std::vector<Animation*>& _animations, size_t _animationIndex ) :
animations_(_animations)
{
currentIndex_ = _animationIndex;
......@@ -493,7 +493,7 @@ SkeletonT<PointT>::~SkeletonT( )
template<typename PointT>
void SkeletonT<PointT>::addJoint(typename SkeletonT<PointT>::Joint *_pParent, typename SkeletonT<PointT>::Joint *_pJoint)
{
unsigned int newJointID;
size_t newJointID;
if(_pParent == 0)
{
......@@ -639,7 +639,7 @@ inline typename SkeletonT<PointT>::Joint *SkeletonT<PointT>::root()
* @return Returns a pointer to the joint or 0 if the index does not exist.
*/
template<typename PointT>
inline typename SkeletonT<PointT>::Joint *SkeletonT<PointT>::joint(const unsigned int& _index)
inline typename SkeletonT<PointT>::Joint *SkeletonT<PointT>::joint(const size_t& _index)
{
if(_index >= joints_.size())
return 0;
......@@ -655,7 +655,7 @@ inline typename SkeletonT<PointT>::Joint *SkeletonT<PointT>::joint(const unsigne
* @return The parent nodes index or -1 if \e _joint is the root node
*/
template<typename PointT>
int SkeletonT<PointT>::parent(unsigned int _joint)
int SkeletonT<PointT>::parent(size_t _joint)
{
if(joints_[_joint]->parent() == 0)
return -1;
......@@ -668,7 +668,7 @@ int SkeletonT<PointT>::parent(unsigned int _joint)
* @brief Returns the number of children of the given node
*/
template<typename PointT>
unsigned int SkeletonT<PointT>::childCount(unsigned int _joint)
size_t SkeletonT<PointT>::childCount(size_t _joint)
{
if ( _joint >= joints_.size() ){
std::cerr << "SkeletonT : childCount() called with non-existing joint " << _joint << std::endl;
......@@ -687,7 +687,7 @@ unsigned int SkeletonT<PointT>::childCount(unsigned int _joint)
* @param _child An index identifying a child of that joint
*/
template<typename PointT>
unsigned int SkeletonT<PointT>::child(unsigned int _joint, unsigned int _child)
size_t SkeletonT<PointT>::child(size_t _joint, size_t _child)
{
return joints_[_joint]->child(_child)->id();
}
......@@ -698,7 +698,7 @@ unsigned int SkeletonT<PointT>::child(unsigned int _joint, unsigned int _child)
* @brief Returns the number of joints
*/
template<typename PointT>
unsigned int SkeletonT<PointT>::jointCount()
size_t SkeletonT<PointT>::jointCount()
{
return joints_.size();
}
......@@ -783,11 +783,11 @@ AnimationHandle SkeletonT<PointT>::addAnimation(std::string _name, Animation *_a
if(f == animations_.end())
{
// all in use, append
names_.insert( std::pair<std::string, unsigned int>(_name, animations_.size()) );
names_.insert( std::pair<std::string, size_t>(_name, animations_.size()) );
animations_.push_back(_animation);
}else{
// found an empty one, use it
names_.insert( std::pair<std::string, unsigned int>(_name, f - animations_.begin()) );
names_.insert( std::pair<std::string, size_t>(_name, f - animations_.begin()) );
*f = _animation;
}
......@@ -817,14 +817,14 @@ AnimationHandle SkeletonT<PointT>::cloneAnimation(std::string _name, const Anima
if(f == animations_.end())
{
// all in use, append
names_.insert( std::pair<std::string, unsigned int>(_name, animations_.size()) );
names_.insert( std::pair<std::string, size_t>(_name, animations_.size()) );
if(animation(_hAni) != 0)
animations_.push_back((*animation(_hAni)).copy());
else
animations_.push_back(new FrameAnimationT<Point>(referencePose_));
}else{
// found an empty one, use it
names_.insert( std::pair<std::string, unsigned int>(_name, f - animations_.begin()) );
names_.insert( std::pair<std::string, size_t>(_name, f - animations_.begin()) );
if(animation(_hAni) != 0)
*f = (*animation(_hAni)).copy();
else
......@@ -842,7 +842,7 @@ AnimationHandle SkeletonT<PointT>::cloneAnimation(std::string _name, const Anima
template<typename PointT>
AnimationHandle SkeletonT<PointT>::animationHandle(std::string _name)
{
std::map<std::string, unsigned int>::iterator f = names_.find(_name);
std::map<std::string, size_t>::iterator f = names_.find(_name);
if(f == names_.end())
return AnimationHandle();
......@@ -857,7 +857,7 @@ AnimationHandle SkeletonT<PointT>::animationHandle(std::string _name)
template<typename PointT>
typename SkeletonT<PointT>::Animation *SkeletonT<PointT>::animation(std::string _name)
{
std::map<std::string, unsigned int>::iterator f = names_.find(_name);
std::map<std::string, size_t>::iterator f = names_.find(_name);
if(f == names_.end())
return 0;
......@@ -886,7 +886,7 @@ template<typename PointT>
void SkeletonT<PointT>::removeAnimation(std::string _name)
{
// get an iterator for the animation
std::map<std::string, unsigned int>::iterator f = names_.find(_name);
std::map<std::string, size_t>::iterator f = names_.find(_name);
if(f == names_.end())
return;
......@@ -910,7 +910,7 @@ void SkeletonT<PointT>::removeAnimation(const AnimationHandle &_hAni)
animations_[_hAni.animationIndex()] = 0;
// remove the name entry
for(typename std::map<std::string, unsigned int>::iterator it = names_.begin(); it != names_.end(); ++it)
for(typename std::map<std::string, size_t>::iterator it = names_.begin(); it != names_.end(); ++it)
{
if(it->second == _hAni.animationIndex())
{
......@@ -968,7 +968,7 @@ typename SkeletonT<PointT>::AnimationIterator SkeletonT<PointT>::animationsEnd()
* @see animationName
*/
template<typename PointT>
unsigned int SkeletonT<PointT>::animationCount()
size_t SkeletonT<PointT>::animationCount()
{
return names_.size();
}
......@@ -981,14 +981,12 @@ unsigned int SkeletonT<PointT>::animationCount()
* @see animationCount
*/
template<typename PointT>
const std::string &SkeletonT<PointT>::animationName(unsigned int _index)
const std::string &SkeletonT<PointT>::animationName(size_t _index)
{
unsigned int i = 0;
std::map<std::string, unsigned int>::iterator pos = names_.begin();
std::map<std::string, size_t>::iterator pos = names_.begin();
while(pos->second != _index && pos != names_.end())
{
++i;
++pos;
}
......@@ -1003,7 +1001,7 @@ const std::string &SkeletonT<PointT>::animationName(unsigned int _index)
* @param _idJoint The joints index
*/
template<typename PointT>
void SkeletonT<PointT>::updateFromGlobal(unsigned int _idJoint)
void SkeletonT<PointT>::updateFromGlobal(size_t _idJoint)
{
referencePose_.updateFromGlobal(_idJoint);
for(typename std::vector<Animation*>::iterator it = animations_.begin(); it != animations_.end(); ++it) {
......@@ -1029,7 +1027,7 @@ void SkeletonT<PointT>::insertJoint(typename SkeletonT<PointT>::Joint *_pChild,
Joint* parent = _pChild->parent();
//update IDs of our joints
unsigned int childID = _pChild->id();
size_t childID = _pChild->id();
for(typename std::vector<Joint*>::iterator it = joints_.begin() + childID; it != joints_.end(); ++it)
(*it)->setId((*it)->id() + 1);
......
......@@ -120,7 +120,7 @@ public:
class AnimationIterator {
public:
AnimationIterator(std::vector<Animation*>& _animations );
AnimationIterator(std::vector<Animation*>& _animations, unsigned int _animationIndex );
AnimationIterator(std::vector<Animation*>& _animations, size_t _animationIndex );
public:
AnimationIterator &operator++();
......@@ -129,7 +129,7 @@ public:
operator bool() const;
private:
unsigned int currentIndex_;
size_t currentIndex_;
std::vector<Animation*>& animations_;
};
......@@ -164,11 +164,11 @@ public:
*/
///@{
inline Joint *root();
inline Joint *joint(const unsigned int &_index);
int parent(unsigned int _joint);
unsigned int childCount(unsigned int _joint);
unsigned int child(unsigned int _joint, unsigned