17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-30 09:40:29 +01:00

Put the editor viewport into a top-down orthographic plan view

Opening the Plan tool now switches the whole colour pass to an orthographic
projection and pins the camera looking straight down, so the plan is drawn
against the loaded scenery rather than in a window of its own. Closing the
tool hands the camera's orientation back; leaving the editor clears the view
outright. The wheel changes how much ground fits on screen instead of moving
the camera, which with no perspective would change nothing but the clipping.

Both configured backends follow: the experimental renderer swaps the pass
projection (and fits its shadow cascades to it), the modern GL renderer uses
its existing ortho helpers. Everything reading the pass projection - the
mouse ray, the frustum test - picks the change up on its own.

The experimental renderer also publishes its colour pass camera now, which
it previously left at the interface defaults, so overlays can place world
points on screen.
This commit is contained in:
maj00r
2026-07-31 19:15:17 +02:00
committed by maj00r
parent 4bef28cf94
commit db49039b9d
8 changed files with 109 additions and 12 deletions

View File

@@ -39,10 +39,7 @@ class editor_mode : public application_mode
void on_key(int Key, int Scancode, int Action, int Mods) override;
void on_cursor_pos(double Horizontal, double Vertical) override;
void on_mouse_button(int Button, int Action, int Mods) override;
void on_scroll(double const Xoffset, double const Yoffset) override
{
;
}
void on_scroll(double const Xoffset, double const Yoffset) override;
void on_window_resize(int w, int h) override
{
;
@@ -108,6 +105,10 @@ class editor_mode : public application_mode
editormode_input m_input;
static TCamera Camera;
// camera orientation from before the plan view took over, to be handed back when it is left
bool m_orthoactive{false};
glm::vec3 m_orthoangle{0.0f};
// focus (smooth camera fly-to) state
static bool m_focus_active;
glm::dvec3 m_focus_start_pos{0.0,0.0,0.0};