2014-12-31 20:27:19 +00:00
|
|
|
#ifndef OPENMW_ESM_UTIL_H
|
|
|
|
#define OPENMW_ESM_UTIL_H
|
|
|
|
|
2015-06-01 19:41:13 +00:00
|
|
|
#include <osg/Quat>
|
|
|
|
#include <osg/Vec3f>
|
|
|
|
|
2014-12-31 20:27:19 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
|
|
|
|
// format 0, savegames only
|
2015-06-03 19:37:21 +00:00
|
|
|
|
2015-06-01 19:41:13 +00:00
|
|
|
struct Quaternion
|
|
|
|
{
|
|
|
|
float mValues[4];
|
2014-12-31 20:27:19 +00:00
|
|
|
|
2015-06-01 19:41:13 +00:00
|
|
|
Quaternion() = default;
|
2014-12-31 20:27:19 +00:00
|
|
|
|
|
|
|
Quaternion(const osg::Quat& q)
|
|
|
|
{
|
2015-06-01 19:41:13 +00:00
|
|
|
mValues[0] = q.w();
|
|
|
|
mValues[1] = q.x();
|
|
|
|
mValues[2] = q.y();
|
2014-12-31 20:27:19 +00:00
|
|
|
mValues[3] = q.z();
|
2022-09-22 18:26:05 +00:00
|
|
|
}
|
2014-12-31 20:27:19 +00:00
|
|
|
|
2021-06-23 22:26:15 +00:00
|
|
|
operator osg::Quat() const { return osg::Quat(mValues[1], mValues[2], mValues[3], mValues[0]); }
|
2022-09-22 18:26:05 +00:00
|
|
|
};
|
2015-06-03 19:37:21 +00:00
|
|
|
|
2015-06-01 19:41:13 +00:00
|
|
|
struct Vector3
|
|
|
|
{
|
|
|
|
float mValues[3];
|
2014-12-31 20:27:19 +00:00
|
|
|
|
2015-06-01 19:41:13 +00:00
|
|
|
Vector3() = default;
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2015-06-01 19:41:13 +00:00
|
|
|
Vector3(const osg::Vec3f& v)
|
|
|
|
{
|
|
|
|
mValues[0] = v.x();
|
|
|
|
mValues[1] = v.y();
|
|
|
|
mValues[2] = v.z();
|
2022-09-22 18:26:05 +00:00
|
|
|
}
|
|
|
|
|
2015-06-01 19:41:13 +00:00
|
|
|
operator osg::Vec3f() const { return osg::Vec3f(mValues[0], mValues[1], mValues[2]); }
|
2014-12-31 20:27:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|