mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-18 19:03:28 +00:00
potential fix
This commit is contained in:
@@ -40,9 +40,9 @@ namespace omath::lua::detail
|
|||||||
|
|
||||||
omath_table.new_usertype<omath::Hsv>(
|
omath_table.new_usertype<omath::Hsv>(
|
||||||
"Hsv", sol::constructors<omath::Hsv()>(),
|
"Hsv", sol::constructors<omath::Hsv()>(),
|
||||||
"hue", &omath::Hsv::hue,
|
"hue", sol::property([](const omath::Hsv& h) { return h.hue; }, [](omath::Hsv& h, float val) { h.hue = val; }),
|
||||||
"saturation", &omath::Hsv::saturation,
|
"saturation", sol::property([](const omath::Hsv& h) { return h.saturation; }, [](omath::Hsv& h, float val) { h.saturation = val; }),
|
||||||
"value", &omath::Hsv::value);
|
"value", sol::property([](const omath::Hsv& h) { return h.value; }, [](omath::Hsv& h, float val) { h.value = val; }));
|
||||||
}
|
}
|
||||||
} // namespace omath::lua::detail
|
} // namespace omath::lua::detail
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -207,25 +207,25 @@ namespace omath::lua::detail
|
|||||||
t.new_usertype<omath::projection::ViewPort>(
|
t.new_usertype<omath::projection::ViewPort>(
|
||||||
"ViewPort",
|
"ViewPort",
|
||||||
sol::factories([](float w, float h) { return omath::projection::ViewPort{w, h}; }),
|
sol::factories([](float w, float h) { return omath::projection::ViewPort{w, h}; }),
|
||||||
"width", &omath::projection::ViewPort::m_width,
|
"width", sol::property([](const omath::projection::ViewPort& vp) { return vp.m_width; }, [](omath::projection::ViewPort& vp, float val) { vp.m_width = val; }),
|
||||||
"height", &omath::projection::ViewPort::m_height,
|
"height", sol::property([](const omath::projection::ViewPort& vp) { return vp.m_height; }, [](omath::projection::ViewPort& vp, float val) { vp.m_height = val; }),
|
||||||
"aspect_ratio", &omath::projection::ViewPort::aspect_ratio);
|
"aspect_ratio", &omath::projection::ViewPort::aspect_ratio);
|
||||||
|
|
||||||
t.new_usertype<ViewAngles90>(
|
t.new_usertype<ViewAngles90>(
|
||||||
"ViewAngles90",
|
"ViewAngles90",
|
||||||
sol::factories([](PitchAngle90 p, SharedYawRoll y, SharedYawRoll r)
|
sol::factories([](PitchAngle90 p, SharedYawRoll y, SharedYawRoll r)
|
||||||
{ return ViewAngles90{p, y, r}; }),
|
{ return ViewAngles90{p, y, r}; }),
|
||||||
"pitch", &ViewAngles90::pitch,
|
"pitch", sol::property([](const ViewAngles90& va) { return va.pitch; }, [](ViewAngles90& va, const PitchAngle90& val) { va.pitch = val; }),
|
||||||
"yaw", &ViewAngles90::yaw,
|
"yaw", sol::property([](const ViewAngles90& va) { return va.yaw; }, [](ViewAngles90& va, const SharedYawRoll& val) { va.yaw = val; }),
|
||||||
"roll", &ViewAngles90::roll);
|
"roll", sol::property([](const ViewAngles90& va) { return va.roll; }, [](ViewAngles90& va, const SharedYawRoll& val) { va.roll = val; }));
|
||||||
|
|
||||||
t.new_usertype<ViewAngles89>(
|
t.new_usertype<ViewAngles89>(
|
||||||
"ViewAngles89",
|
"ViewAngles89",
|
||||||
sol::factories([](PitchAngle89 p, SharedYawRoll y, SharedYawRoll r)
|
sol::factories([](PitchAngle89 p, SharedYawRoll y, SharedYawRoll r)
|
||||||
{ return ViewAngles89{p, y, r}; }),
|
{ return ViewAngles89{p, y, r}; }),
|
||||||
"pitch", &ViewAngles89::pitch,
|
"pitch", sol::property([](const ViewAngles89& va) { return va.pitch; }, [](ViewAngles89& va, const PitchAngle89& val) { va.pitch = val; }),
|
||||||
"yaw", &ViewAngles89::yaw,
|
"yaw", sol::property([](const ViewAngles89& va) { return va.yaw; }, [](ViewAngles89& va, const SharedYawRoll& val) { va.yaw = val; }),
|
||||||
"roll", &ViewAngles89::roll);
|
"roll", sol::property([](const ViewAngles89& va) { return va.roll; }, [](ViewAngles89& va, const SharedYawRoll& val) { va.roll = val; }));
|
||||||
}
|
}
|
||||||
|
|
||||||
void register_engines(sol::table& omath_table)
|
void register_engines(sol::table& omath_table)
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ namespace omath::lua::detail
|
|||||||
omath_table.new_usertype<Vec2f>(
|
omath_table.new_usertype<Vec2f>(
|
||||||
"Vec2", sol::constructors<Vec2f(), Vec2f(float, float)>(),
|
"Vec2", sol::constructors<Vec2f(), Vec2f(float, float)>(),
|
||||||
|
|
||||||
"x", &Vec2f::x, "y", &Vec2f::y,
|
"x", sol::property([](const Vec2f& v) { return v.x; }, [](Vec2f& v, float val) { v.x = val; }),
|
||||||
|
"y", sol::property([](const Vec2f& v) { return v.y; }, [](Vec2f& v, float val) { v.y = val; }),
|
||||||
|
|
||||||
sol::meta_function::addition, sol::resolve<Vec2f(const Vec2f&) const>(&Vec2f::operator+),
|
sol::meta_function::addition, sol::resolve<Vec2f(const Vec2f&) const>(&Vec2f::operator+),
|
||||||
sol::meta_function::subtraction, sol::resolve<Vec2f(const Vec2f&) const>(&Vec2f::operator-),
|
sol::meta_function::subtraction, sol::resolve<Vec2f(const Vec2f&) const>(&Vec2f::operator-),
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ namespace omath::lua::detail
|
|||||||
omath_table.new_usertype<Vec3f>(
|
omath_table.new_usertype<Vec3f>(
|
||||||
"Vec3", sol::constructors<Vec3f(), Vec3f(float, float, float)>(),
|
"Vec3", sol::constructors<Vec3f(), Vec3f(float, float, float)>(),
|
||||||
|
|
||||||
"x", &Vec3f::x, "y", &Vec3f::y, "z", &Vec3f::z,
|
"x", sol::property([](const Vec3f& v) { return v.x; }, [](Vec3f& v, float val) { v.x = val; }),
|
||||||
|
"y", sol::property([](const Vec3f& v) { return v.y; }, [](Vec3f& v, float val) { v.y = val; }),
|
||||||
|
"z", sol::property([](const Vec3f& v) { return v.z; }, [](Vec3f& v, float val) { v.z = val; }),
|
||||||
|
|
||||||
sol::meta_function::addition, sol::resolve<Vec3f(const Vec3f&) const>(&Vec3f::operator+),
|
sol::meta_function::addition, sol::resolve<Vec3f(const Vec3f&) const>(&Vec3f::operator+),
|
||||||
sol::meta_function::subtraction, sol::resolve<Vec3f(const Vec3f&) const>(&Vec3f::operator-),
|
sol::meta_function::subtraction, sol::resolve<Vec3f(const Vec3f&) const>(&Vec3f::operator-),
|
||||||
|
|||||||
@@ -14,7 +14,10 @@ namespace omath::lua::detail
|
|||||||
omath_table.new_usertype<Vec4f>(
|
omath_table.new_usertype<Vec4f>(
|
||||||
"Vec4", sol::constructors<Vec4f(), Vec4f(float, float, float, float)>(),
|
"Vec4", sol::constructors<Vec4f(), Vec4f(float, float, float, float)>(),
|
||||||
|
|
||||||
"x", &Vec4f::x, "y", &Vec4f::y, "z", &Vec4f::z, "w", &Vec4f::w,
|
"x", sol::property([](const Vec4f& v) { return v.x; }, [](Vec4f& v, float val) { v.x = val; }),
|
||||||
|
"y", sol::property([](const Vec4f& v) { return v.y; }, [](Vec4f& v, float val) { v.y = val; }),
|
||||||
|
"z", sol::property([](const Vec4f& v) { return v.z; }, [](Vec4f& v, float val) { v.z = val; }),
|
||||||
|
"w", sol::property([](const Vec4f& v) { return v.w; }, [](Vec4f& v, float val) { v.w = val; }),
|
||||||
|
|
||||||
sol::meta_function::addition, sol::resolve<Vec4f(const Vec4f&) const>(&Vec4f::operator+),
|
sol::meta_function::addition, sol::resolve<Vec4f(const Vec4f&) const>(&Vec4f::operator+),
|
||||||
sol::meta_function::subtraction, sol::resolve<Vec4f(const Vec4f&) const>(&Vec4f::operator-),
|
sol::meta_function::subtraction, sol::resolve<Vec4f(const Vec4f&) const>(&Vec4f::operator-),
|
||||||
|
|||||||
Reference in New Issue
Block a user