mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-25 00:57:36 +02:00
Merge the track layout editor into cpp20-modules, ported to modules
The editor branch was written against headers and the PCH, both of which this
branch has done away with, so its own files were ported rather than merged: the
five headers it added are now interface units and their .cpp files module
implementation units.
- editor/{puwg1992,polandmap,turnouts,orthophoto} become eu07.editor.* modules,
application/planpanel becomes eu07.application.planpanel. The plan tool keeps
to its own module rather than joining the eu07.simcore partitions: it stands on
the editor's libraries and eu07.application.uilayer, not on the simulation core,
so :editoruilayer can export import it without a cycle.
- glm arrives by import eu07.glm, never by include, as the rest of the tree does.
maj0sted is header-only and glm-free, so its headers stay includes in the global
module fragment - every unit that names those types includes them itself, since
a global fragment is not visible across units.
- the one textual conflict was :editoruilayer's include block against this
branch's imports; resolved this branch's way plus the planpanel import.
Builds with clang 22 (-DWITH_BETTER_RENDERER=OFF) and starts into the editor on
empty ground with -editor alone.
This commit is contained in:
@@ -373,9 +373,26 @@ bool NvRenderer::Render() {
|
||||
|
||||
double fov = glm::radians(static_cast<double>(Global.FieldOfView) /
|
||||
Global.ZoomFactor);
|
||||
glm::dmat4 projection = glm::perspectiveFovRH_ZO(
|
||||
fov, static_cast<double>(Global.window_size.x),
|
||||
static_cast<double>(Global.window_size.y), pass.m_draw_range, .1);
|
||||
|
||||
// the track plan is drawn on a distortion-free view from above, so the whole pass switches to
|
||||
// an orthographic projection. everything downstream - the mouse ray below, the frustum test,
|
||||
// the shadow fitting - reads this matrix, so nothing else needs to know which one it is
|
||||
double const orthoheight = Global.editor_ortho_extent;
|
||||
double const orthowidth =
|
||||
orthoheight * static_cast<double>(Global.window_size.x) /
|
||||
std::max(1., static_cast<double>(Global.window_size.y));
|
||||
glm::dmat4 projection =
|
||||
Global.editor_ortho
|
||||
? glm::orthoRH_ZO(-orthowidth, orthowidth, -orthoheight,
|
||||
orthoheight, pass.m_draw_range, .1)
|
||||
: glm::perspectiveFovRH_ZO(
|
||||
fov, static_cast<double>(Global.window_size.x),
|
||||
static_cast<double>(Global.window_size.y),
|
||||
pass.m_draw_range, .1);
|
||||
|
||||
m_camera_view = transform;
|
||||
m_camera_projection = projection;
|
||||
m_camera_position = pass.m_origin;
|
||||
|
||||
SingleFrustumTester frustum_tester{projection, transform};
|
||||
DrawConstants draw_constants{};
|
||||
@@ -492,11 +509,15 @@ bool NvRenderer::Render() {
|
||||
|
||||
glm::vec3 light_color, light_direction;
|
||||
m_sky->CalcLighting(light_direction, light_color);
|
||||
// cascades are fitted to what the camera actually sees, so they follow the plan view too
|
||||
m_shadow_map->CalcCascades(
|
||||
glm::perspectiveFovRH_ZO(fov,
|
||||
static_cast<double>(Global.window_size.x),
|
||||
static_cast<double>(Global.window_size.y),
|
||||
.1, pass.m_draw_range),
|
||||
Global.editor_ortho
|
||||
? glm::orthoRH_ZO(-orthowidth, orthowidth, -orthoheight,
|
||||
orthoheight, .1, pass.m_draw_range)
|
||||
: glm::perspectiveFovRH_ZO(
|
||||
fov, static_cast<double>(Global.window_size.x),
|
||||
static_cast<double>(Global.window_size.y), .1,
|
||||
pass.m_draw_range),
|
||||
transform, -light_direction);
|
||||
m_shadow_map->UpdateConstants(command_list);
|
||||
m_gbuffer_shadow->Clear(command_list);
|
||||
|
||||
Reference in New Issue
Block a user