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