1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 12:32:36 +00:00
OpenMW/apps/openmw/mwrender/rotatecontroller.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.0 KiB
C++
Raw Normal View History

2015-05-31 18:53:16 +02:00
#ifndef OPENMW_MWRENDER_ROTATECONTROLLER_H
#define OPENMW_MWRENDER_ROTATECONTROLLER_H
#include <components/sceneutil/nodecallback.hpp>
2015-05-31 18:53:16 +02:00
#include <osg/Quat>
namespace osg
{
class MatrixTransform;
}
2015-05-31 18:53:16 +02:00
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.
class RotateController : public SceneUtil::NodeCallback<RotateController, osg::MatrixTransform*>
2015-05-31 18:53:16 +02:00
{
public:
RotateController(osg::Node* relativeTo);
2022-09-22 21:26:05 +03:00
2015-05-31 18:53:16 +02:00
void setEnabled(bool enabled);
void setOffset(const osg::Vec3f& offset);
2015-05-31 18:53:16 +02:00
void setRotate(const osg::Quat& rotate);
2022-09-22 21:26:05 +03:00
void operator()(osg::MatrixTransform* node, osg::NodeVisitor* nv);
2022-09-22 21:26:05 +03:00
2015-05-31 18:53:16 +02:00
protected:
osg::Quat getWorldOrientation(osg::Node* node);
2022-09-22 21:26:05 +03:00
2015-05-31 18:53:16 +02:00
bool mEnabled;
osg::Vec3f mOffset;
2015-05-31 18:53:16 +02:00
osg::Quat mRotate;
2015-11-11 16:04:17 +01:00
osg::Node* mRelativeTo;
2015-05-31 18:53:16 +02:00
};
}
#endif