From Vladimir Cheaev, "

I worked with a osg::Constraint and found strange part of code:
class OSGMANIPULATOR_EXPORT Constraint : public osg::Referenced
{
    public:
...
        virtual bool constrain(ScaleUniformCommand& command) const     { return constrain((MotionCommand&)command); }
        virtual bool constrain(const Rotate3DCommand& command)         { return constrain((MotionCommand&)command); }
...

If i use osgManipulator::Rotate3DCommand then method Rotate3DCommand::accept(const Constraint& constraint) calls Constraint::constrain(MotionCommand&) instead Constraint:: constrain(const Rotate3DCommand&).

If you replace
        virtual bool constrain(const Rotate3DCommand& command)         { return constrain((MotionCommand&)command); }
on to
        virtual bool constrain(Rotate3DCommand& command) const         { return constrain((MotionCommand&)command); }
then all works correctly.
"
This commit is contained in:
Robert Osfield 2012-09-20 11:27:57 +00:00
parent 01c7d87b1a
commit f804d7dd81

View File

@ -66,7 +66,7 @@ class OSGMANIPULATOR_EXPORT Constraint : public osg::Referenced
virtual bool constrain(Scale1DCommand& command) const { return constrain((MotionCommand&)command); } virtual bool constrain(Scale1DCommand& command) const { return constrain((MotionCommand&)command); }
virtual bool constrain(Scale2DCommand& command) const { return constrain((MotionCommand&)command); } virtual bool constrain(Scale2DCommand& command) const { return constrain((MotionCommand&)command); }
virtual bool constrain(ScaleUniformCommand& command) const { return constrain((MotionCommand&)command); } virtual bool constrain(ScaleUniformCommand& command) const { return constrain((MotionCommand&)command); }
virtual bool constrain(const Rotate3DCommand& command) { return constrain((MotionCommand&)command); } virtual bool constrain(Rotate3DCommand& command) const { return constrain((MotionCommand&)command); }
protected: protected: