2021-01-12 22:17:48 +00:00
|
|
|
#ifndef COMPONENTS_LUA_UTILPACKAGE_H
|
|
|
|
#define COMPONENTS_LUA_UTILPACKAGE_H
|
|
|
|
|
2021-09-19 12:43:15 +00:00
|
|
|
#include <osg/Vec2>
|
|
|
|
#include <osg/Vec3>
|
2022-01-17 22:35:06 +00:00
|
|
|
#include <osg/Vec4>
|
2021-09-19 12:43:15 +00:00
|
|
|
#include <osg/Matrix>
|
|
|
|
|
2021-01-12 22:17:48 +00:00
|
|
|
#include <sol/sol.hpp>
|
|
|
|
|
|
|
|
namespace LuaUtil
|
|
|
|
{
|
2021-09-19 12:43:15 +00:00
|
|
|
using Vec2 = osg::Vec2f;
|
|
|
|
using Vec3 = osg::Vec3f;
|
2022-01-17 22:35:06 +00:00
|
|
|
using Vec4 = osg::Vec4f;
|
2021-09-19 12:43:15 +00:00
|
|
|
|
|
|
|
// For performance reasons "Transform" is implemented as 2 types with the same interface.
|
|
|
|
// Transform supports only composition, inversion, and applying to a 3d vector.
|
|
|
|
struct TransformM { osg::Matrixf mM; };
|
|
|
|
struct TransformQ { osg::Quat mQ; };
|
|
|
|
|
|
|
|
inline TransformM asTransform(const osg::Matrixf& m) { return {m}; }
|
|
|
|
inline TransformQ asTransform(const osg::Quat& q) { return {q}; }
|
2021-01-12 22:17:48 +00:00
|
|
|
|
|
|
|
sol::table initUtilPackage(sol::state&);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // COMPONENTS_LUA_UTILPACKAGE_H
|