17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 07:29:20 +02:00

feat(editor): add orthographic top view toggle

This commit is contained in:
maj00r
2026-10-02 22:47:29 +02:00
parent b19f3de0d4
commit 78c4b9f6df
5 changed files with 77 additions and 19 deletions

View File

@@ -1593,6 +1593,13 @@ void opengl33_renderer::setup_pass(viewport_config &Viewport, renderpass_config
auto const znear = ( Znear > 1.f ? Znear : Znear > 0.f ? Znear * zfar : 0.1f * Global.ZoomFactor);
camera.projection() = perspective_projection(Viewport.projection, znear, zfar, frustumtest_proj);
if (EditorModeFlag && Global.EditorOrtho && Viewport.main)
{
auto const height{Global.EditorOrthoExtent};
auto const width{height * Global.window_size.x / std::max(1.f, static_cast<float>(Global.window_size.y))};
camera.projection() = ortho_projection(-width, width, -height, height, -zfar, zfar);
frustumtest_proj = ortho_frustumtest_projection(-width, width, -height, height, -zfar, zfar);
}
break;
}
case rendermode::shadows:
@@ -1692,6 +1699,13 @@ void opengl33_renderer::setup_pass(viewport_config &Viewport, renderpass_config
}
camera.projection() = perspective_projection(proj, znear, zfar, frustumtest_proj);
if (EditorModeFlag && Global.EditorOrtho && Viewport.main)
{
auto const height{Global.EditorOrthoExtent};
auto const width{height * Global.window_size.x / std::max(1.f, static_cast<float>(Global.window_size.y))};
camera.projection() = ortho_projection(-width, width, -height, height, -zfar, zfar);
frustumtest_proj = ortho_frustumtest_projection(-width, width, -height, height, -zfar, zfar);
}
break;
}
case rendermode::reflections: