mirror of
https://github.com/orange-cpp/omath.git
synced 2026-06-08 16:24:35 +00:00
windows fix
This commit is contained in:
@@ -107,7 +107,8 @@ namespace omath::projection
|
||||
// m[1,1] == 1 / tan(fov/2) => fov = 2 * atan(1 / m[1,1])
|
||||
const auto f = proj_matrix.at(1, 1);
|
||||
// m[0,0] == m[1,1] / aspect_ratio => aspect = m[1,1] / m[0,0]
|
||||
return {FieldOfView::from_radians(NumericType{2} * std::atan(NumericType{1} / f)),
|
||||
const auto fov_radians = NumericType{2} * std::atan(NumericType{1} / f);
|
||||
return {FieldOfView::from_radians(static_cast<typename FieldOfView::ArithmeticType>(fov_radians)),
|
||||
f / proj_matrix.at(0, 0)};
|
||||
}
|
||||
|
||||
|
||||
+10
-3
@@ -14,6 +14,13 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
[[noreturn]]
|
||||
void throw_lua_error(sol::protected_function_result& result)
|
||||
{
|
||||
sol::error err = result;
|
||||
throw err;
|
||||
}
|
||||
|
||||
class LuaHudRenderer final : public omath::hud::HudRendererInterface
|
||||
{
|
||||
public:
|
||||
@@ -82,7 +89,7 @@ namespace
|
||||
|
||||
auto result = (*callback)(texture, min, max, tint);
|
||||
if (!result.valid())
|
||||
throw sol::error(result);
|
||||
throw_lua_error(result);
|
||||
}
|
||||
|
||||
void add_text(const omath::Vector2<float>& position, const omath::Color& color,
|
||||
@@ -100,7 +107,7 @@ namespace
|
||||
|
||||
auto result = (*callback)(std::string{text});
|
||||
if (!result.valid())
|
||||
throw sol::error(result);
|
||||
throw_lua_error(result);
|
||||
|
||||
return result.get<omath::Vector2<float>>();
|
||||
}
|
||||
@@ -126,7 +133,7 @@ namespace
|
||||
|
||||
auto result = (*callback)(std::forward<Args>(args)...);
|
||||
if (!result.valid())
|
||||
throw sol::error(result);
|
||||
throw_lua_error(result);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
|
||||
Reference in New Issue
Block a user