mirror of https://github.com/OpenMW/openmw.git
Merge branch 'split_esm_headers' into 'master'
Split ESM headers See merge request OpenMW/openmw!4071master
commit
c95bb4ce59
@ -0,0 +1,53 @@
|
||||
#ifndef OPENMW_COMPONENTS_ESM_EXTERIORCELLLOCATION_H
|
||||
#define OPENMW_COMPONENTS_ESM_EXTERIORCELLLOCATION_H
|
||||
|
||||
#include "refid.hpp"
|
||||
|
||||
#include <components/esm3/loadcell.hpp>
|
||||
|
||||
#include <tuple>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
struct ExteriorCellLocation
|
||||
{
|
||||
int mX = 0;
|
||||
int mY = 0;
|
||||
ESM::RefId mWorldspace = ESM::Cell::sDefaultWorldspaceId;
|
||||
|
||||
ExteriorCellLocation() = default;
|
||||
|
||||
ExteriorCellLocation(int x, int y, ESM::RefId worldspace)
|
||||
: mX(x)
|
||||
, mY(y)
|
||||
, mWorldspace(worldspace)
|
||||
{
|
||||
}
|
||||
|
||||
friend bool operator==(const ExteriorCellLocation& lhs, const ExteriorCellLocation& rhs) = default;
|
||||
|
||||
friend inline bool operator<(const ExteriorCellLocation& lhs, const ExteriorCellLocation& rhs)
|
||||
{
|
||||
return std::make_tuple(lhs.mX, lhs.mY, lhs.mWorldspace) < std::make_tuple(rhs.mX, rhs.mY, rhs.mWorldspace);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<ESM::ExteriorCellLocation>
|
||||
{
|
||||
std::size_t operator()(const ESM::ExteriorCellLocation& toHash) const
|
||||
{
|
||||
// Compute individual hash values for first,
|
||||
// second and third and combine them using XOR
|
||||
// and bit shifting:
|
||||
|
||||
return ((hash<int>()(toHash.mX) ^ (hash<int>()(toHash.mY) << 1)) >> 1)
|
||||
^ (hash<ESM::RefId>()(toHash.mWorldspace) << 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,29 @@
|
||||
#ifndef OPENMW_COMPONENTS_ESM_QUATERNION_H
|
||||
#define OPENMW_COMPONENTS_ESM_QUATERNION_H
|
||||
|
||||
#include <osg/Quat>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
// format 0, savegames only
|
||||
struct Quaternion
|
||||
{
|
||||
float mValues[4];
|
||||
|
||||
Quaternion() = default;
|
||||
|
||||
Quaternion(const osg::Quat& q)
|
||||
: mValues{
|
||||
static_cast<float>(q.w()),
|
||||
static_cast<float>(q.x()),
|
||||
static_cast<float>(q.y()),
|
||||
static_cast<float>(q.z()),
|
||||
}
|
||||
{
|
||||
}
|
||||
|
||||
operator osg::Quat() const { return osg::Quat(mValues[1], mValues[2], mValues[3], mValues[0]); }
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,24 @@
|
||||
#ifndef OPENMW_COMPONENTS_ESM_VECTOR3_H
|
||||
#define OPENMW_COMPONENTS_ESM_VECTOR3_H
|
||||
|
||||
#include <osg/Vec3f>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
// format 0, savegames only
|
||||
struct Vector3
|
||||
{
|
||||
float mValues[3];
|
||||
|
||||
Vector3() = default;
|
||||
|
||||
Vector3(const osg::Vec3f& v)
|
||||
: mValues{ v.x(), v.y(), v.z() }
|
||||
{
|
||||
}
|
||||
|
||||
operator osg::Vec3f() const { return osg::Vec3f(mValues[0], mValues[1], mValues[2]); }
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,11 @@
|
||||
#ifndef OPENMW_COMPONENTS_ESM3_REFNUM_H
|
||||
#define OPENMW_COMPONENTS_ESM3_REFNUM_H
|
||||
|
||||
#include <components/esm/formid.hpp>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
using RefNum = ESM::FormId;
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue