1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00
OpenMW/components/esm/util.hpp

63 lines
973 B
C++
Raw Normal View History

#ifndef OPENMW_ESM_UTIL_H
#define OPENMW_ESM_UTIL_H
#include <string>
2015-06-01 21:41:13 +02:00
#include <osg/Vec3f>
#include <osg/Quat>
#include "esmreader.hpp"
#include "esmwriter.hpp"
#include "loadbsgn.hpp"
namespace ESM
{
// format 0, savegames only
struct Quaternion
{
float mValues[4];
Quaternion() {}
2015-06-03 21:37:21 +02:00
2015-06-01 21:41:13 +02:00
Quaternion(const osg::Quat& q)
{
mValues[0] = q.w();
mValues[1] = q.x();
mValues[2] = q.y();
mValues[3] = q.z();
}
2015-06-01 21:41:13 +02:00
operator osg::Quat () const
{
return osg::Quat(mValues[1], mValues[2], mValues[3], mValues[0]);
}
};
struct Vector3
{
float mValues[3];
Vector3() {}
2015-06-03 21:37:21 +02:00
2015-06-01 21:41:13 +02:00
Vector3(const osg::Vec3f& v)
{
mValues[0] = v.x();
mValues[1] = v.y();
mValues[2] = v.z();
}
2015-06-01 21:41:13 +02:00
operator osg::Vec3f () const
{
return osg::Vec3f(mValues[0], mValues[1], mValues[2]);
}
};
bool readDeleSubRecord(ESMReader &esm);
void writeDeleSubRecord(ESMWriter &esm);
}
#endif