Add OpenMW commits up to 1 Dec 2019
# Conflicts: # CMakeLists.txt # apps/openmw/mwscript/aiextensions.cpp # apps/openmw/mwscript/statsextensions.cpppull/556/head
commit
9d6f3fdd09
@ -0,0 +1,16 @@
|
||||
#ifndef GAME_MWBASE_ROTATIONFLAGS_H
|
||||
#define GAME_MWBASE_ROTATIONFLAGS_H
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
using RotationFlags = unsigned short;
|
||||
|
||||
enum RotationFlag : RotationFlags
|
||||
{
|
||||
RotationFlag_none = 0,
|
||||
RotationFlag_adjust = 1,
|
||||
RotationFlag_inverseOrder = 1 << 1,
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,38 @@
|
||||
#ifndef OPENMW_COMPONENTS_BULLETHELPERS_TRANSFORMBOUNDINGBOX_H
|
||||
#define OPENMW_COMPONENTS_BULLETHELPERS_TRANSFORMBOUNDINGBOX_H
|
||||
|
||||
#include <LinearMath/btVector3.h>
|
||||
#include <LinearMath/btTransform.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace BulletHelpers
|
||||
{
|
||||
inline btVector3 min(const btVector3& a, const btVector3& b)
|
||||
{
|
||||
return btVector3(std::min(a.x(), b.x()), std::min(a.y(), b.y()), std::min(a.z(), b.z()));
|
||||
}
|
||||
|
||||
inline btVector3 max(const btVector3& a, const btVector3& b)
|
||||
{
|
||||
return btVector3(std::max(a.x(), b.x()), std::max(a.y(), b.y()), std::max(a.z(), b.z()));
|
||||
}
|
||||
|
||||
// http://dev.theomader.com/transform-bounding-boxes/
|
||||
inline void transformBoundingBox(const btTransform& transform, btVector3& aabbMin, btVector3& aabbMax)
|
||||
{
|
||||
const btVector3 xa(transform.getBasis().getColumn(0) * aabbMin.x());
|
||||
const btVector3 xb(transform.getBasis().getColumn(0) * aabbMax.x());
|
||||
|
||||
const btVector3 ya(transform.getBasis().getColumn(1) * aabbMin.y());
|
||||
const btVector3 yb(transform.getBasis().getColumn(1) * aabbMax.y());
|
||||
|
||||
const btVector3 za(transform.getBasis().getColumn(2) * aabbMin.z());
|
||||
const btVector3 zb(transform.getBasis().getColumn(2) * aabbMax.z());
|
||||
|
||||
aabbMin = min(xa, xb) + min(ya, yb) + min(za, zb) + transform.getOrigin();
|
||||
aabbMax = max(xa, xb) + max(ya, yb) + max(za, zb) + transform.getOrigin();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue