OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
userdata.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_COMPONENTS_NIFOSG_USERDATA_H
2 #define OPENMW_COMPONENTS_NIFOSG_USERDATA_H
3 
5 
6 #include <osg/Object>
7 
8 namespace NifOsg
9 {
10 
11  // Note if you are copying a scene graph with this user data you should use the DEEP_COPY_USERDATA copyop.
12  class NodeUserData : public osg::Object
13  {
14  public:
15  NodeUserData(int index, float scale, const Nif::Matrix3& rotationScale)
16  : mIndex(index), mScale(scale), mRotationScale(rotationScale)
17  {
18  }
20  : mIndex(0), mScale(0)
21  {
22  }
23  NodeUserData(const NodeUserData& copy, const osg::CopyOp& copyop)
24  : Object(copy, copyop)
25  , mIndex(copy.mIndex)
26  , mScale(copy.mScale)
28  {
29  }
30 
31  META_Object(NifOsg, NodeUserData)
32 
33  // NIF record index
34  int mIndex;
35 
36  // Hack: account for Transform differences between OSG and NIFs.
37  // OSG uses a 4x4 matrix, NIF's use a 3x3 rotationScale, float scale, and vec3 position.
38  // Decomposing the original components from the 4x4 matrix isn't possible, which causes
39  // problems when a KeyframeController wants to change only one of these components. So
40  // we store the scale and rotation components separately here.
41  // Note for a cleaner solution it would be possible to write a custom Transform node
42  float mScale;
43  Nif::Matrix3 mRotationScale;
44  };
45 
46 }
47 
48 #endif
Nif::Matrix3 mRotationScale
Definition: userdata.hpp:43
NodeUserData(int index, float scale, const Nif::Matrix3 &rotationScale)
Definition: userdata.hpp:15
NodeUserData(const NodeUserData &copy, const osg::CopyOp &copyop)
Definition: userdata.hpp:23
NodeUserData()
Definition: userdata.hpp:19
Definition: niftypes.hpp:35
Definition: userdata.hpp:12
META_Object(NifOsg, NodeUserData) int mIndex
float mScale
Definition: userdata.hpp:42