You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
851 B
C++
37 lines
851 B
C++
10 years ago
|
#ifndef OPENMW_MWRENDER_ROTATECONTROLLER_H
|
||
|
#define OPENMW_MWRENDER_ROTATECONTROLLER_H
|
||
|
|
||
|
#include <osg/NodeCallback>
|
||
|
#include <osg/Quat>
|
||
|
|
||
|
namespace MWRender
|
||
|
{
|
||
|
|
||
|
/// Applies a rotation in \a relativeTo's space.
|
||
|
/// @note Assumes that the node being rotated has its "original" orientation set every frame by a different controller.
|
||
|
/// The rotation is then applied on top of that orientation.
|
||
|
/// @note Must be set on a MatrixTransform.
|
||
|
class RotateController : public osg::NodeCallback
|
||
|
{
|
||
|
public:
|
||
|
RotateController(osg::Node* relativeTo);
|
||
|
|
||
|
void setEnabled(bool enabled);
|
||
|
|
||
|
void setRotate(const osg::Quat& rotate);
|
||
|
|
||
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
|
||
|
|
||
|
protected:
|
||
|
osg::Quat getWorldOrientation(osg::Node* node);
|
||
|
|
||
|
bool mEnabled;
|
||
|
osg::Quat mRotate;
|
||
|
osg::ref_ptr<osg::Node> mRelativeTo;
|
||
|
};
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif
|