mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-08 19:52:47 +01:00
Merge remote-tracking branch 'origin/feat/switch-blades' into feat/renderers-cleanup
This commit is contained in:
@@ -14,6 +14,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "application/application.h"
|
||||
#include "application/editoruilayer.h"
|
||||
#include "application/editorprojection.h"
|
||||
#include "application/editorgestures.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
#include "simulation/simulation.h"
|
||||
#include "simulation/simulationtime.h"
|
||||
@@ -54,6 +56,9 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c
|
||||
for (auto const group : {&editor_mode::selftest_scene, &editor_mode::selftest_sleepers, &editor_mode::selftest_sweep, &editor_mode::selftest_track, &editor_mode::selftest_switch, &editor_mode::selftest_rails, &editor_mode::selftest_join, &editor_mode::selftest_signal, &editor_mode::selftest_terrain, &editor_mode::selftest_props, &editor_mode::selftest_monkey})
|
||||
if (auto const result{(this->*group)(command, words)}; result != selftest_result::unhandled)
|
||||
return result;
|
||||
for (auto *tool : m_tools)
|
||||
if (auto const result{tool->selftest(command, words)}; result != selftest_result::unhandled)
|
||||
return result;
|
||||
return selftest_result::unhandled;
|
||||
}
|
||||
|
||||
@@ -62,12 +67,15 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c
|
||||
// camera <x> <y> <z> <x> <y> <z> from the first point, looking at the second
|
||||
// select <track name>
|
||||
// selectat <x> <z> the path nearest the point, within 3 m, as a click on it
|
||||
// trackends <name> logs the ends of the first path of the track against the ground under them
|
||||
// kbreak <x> <z> K on the track nearest the point: split there, a break of the grade at the height of the ground
|
||||
// blade [name] logs the blades of each switch cut from the rails: tip, 50 mm head, full head, heel, drop of the head, open flangeway, the gauge lines apart against x^2/2R, vertices in both positions
|
||||
// frog [name] logs where the inner rails of each switch cross: distance on both paths, 1:n, throat, nose, check rails
|
||||
// guards [name] logs each guard rail and what each of its ends and breaks is cut along; a fault when a cut is not along a rail or a glued end not on the guard rail of the other track
|
||||
// railtime lays out the rails of every track, as when its geometry is made, and logs how long it took
|
||||
// throw <0|1> sets every switch to the path and moves its blades there at once
|
||||
// crossings [name] logs where rails of tracks cross rails of other tracks and of what kind (acute, obtuse, middle acute or obtuse, wide), checks that each acute crossing has one partner and one nose
|
||||
// switchtimbers <model|none> the model of the timbers set on all the switches and crossings, as the buttons of the switch tool do it
|
||||
// frogkey name [on|off] sets or clears the frogs key of a switch (one undo step); logs the key, whether it is written, the frog and the crossings
|
||||
// geomhash [name] logs the number of vertices and a hash of the drawn geometry of each rail track (rails, trackbed, cut faces), to compare builds; exact: the bits of every value, userdata and tread materials too
|
||||
// sweep <key>=<value>... model, params (separated by commas), lateral, height, side (origin, near, far,
|
||||
@@ -121,9 +129,28 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c
|
||||
// terraincursor logs the point of the ground under the cursor, found along the ray (over holes too)
|
||||
// terraintool <holes|grass|paint|sculpt|none> the tool the left button works on the terrain, with a brush of 3 m
|
||||
// orthophoto <north> <east> <radius> <fit 0|1> [in scene 0|1] the imagery layer on, placed and fitted as given
|
||||
// orthoarea <x> <z>... | clear the download area through the points of the world, as drawn on the map; orthoareapause 0|1
|
||||
// orthohires 0|1 the 4K tiles on or off; orthostats logs the tiles, the area and the requests made
|
||||
// orthosettings [on|radius|opacity|lift|height|year|hires|drape|scene <value>]... the settings of the orthophoto changed as its
|
||||
// panel and its checkbox change them, kept with the editor, and logged with the origin of the scenery
|
||||
// nmtsettings [band|around|shape|follow|grow|offset|fitted <value>]... the settings of the terrain model changed as the terrain
|
||||
// panel changes them, and logged with the offset of the model to the scenery
|
||||
// join <x> <z> <x> <z> [radius] [variant] [transitions 0|1] the free ends at the points joined, as a drag from one to the other
|
||||
// layto <x> <z> <x> <z> <layout 0..3> <radius> from the free end at the first point towards the second, as a drag in the layout
|
||||
// layclicks <layout 0..3> <radius> <x> <z>... clicks of the lay tool at the points, a free end within 3 m joined
|
||||
// layspeed <km/h> <own 0|1> the speed set for the laying, and whether it goes also on from a track with its own
|
||||
// laymode <straights|curve>, layradius <R from> <R to>, laytrace <radii 0..3> <straights between 0|1> as the panel of the laying sets them
|
||||
// endcurves logs every free end of the rails: where, the way out and the curvature its track goes on with
|
||||
// curvejoint <x> <z> logs the paths meeting at the end nearest the point, the curvature of each and its jump from the ones before to the ones after
|
||||
// laywalk <from|into> <x> <z> <spacing> <noise> <k0> <k1> <L>... a line of known curves on from the free end nearest the point,
|
||||
// the points along it clicked in the mode of a curve, from the end or towards it (see the command)
|
||||
// laybends <x> <z> <distance> <degrees> ... <distance> the bends of straights clicked from the free end nearest the point
|
||||
// layp <x> <z>... the points clicked in the mode set, on the ground, a free end within 3 m reached
|
||||
// layreport <label> logs the line the points clicked make, as Enter would lay it: its bends and curves, warnings, traces
|
||||
// layenter, layback, laycancel as Enter, Backspace and Esc while laying
|
||||
// laysample <x> <z> <heading> <spacing> <noise> <deflection> <R> [<from the first vertex to the second, m> <deflection> <R>]
|
||||
// a line of known curves, the points along them clicked as a curve traced, the line they make logged
|
||||
// laychain <layout> <R> <x> <z> | b | u | r | e | t | p... the points clicked, Backspace, undo, redo, Enter, Tab, the line logged
|
||||
// joints <x> <z>... the joints check over the scenery, the issues around the points logged, every issue with free ends without points
|
||||
// route <x> <z> <single 0|1> the route design of the path nearest the point, a curve or the whole line
|
||||
// routevertex <i> <R> <L in> <L out> <cant>, routearc <i> <R> <L> <share>, routeshare <i> <share>, routekm <km>
|
||||
@@ -151,7 +178,16 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c
|
||||
// screenshot
|
||||
// save
|
||||
// log <text>
|
||||
// perf <label> the frames drawn since the last perf and the time per frame logged, with the timings and counts of the renderer
|
||||
// perf <label> the frames drawn since the last perf and the time per frame logged, the longest frame and those over 33 ms,
|
||||
// with the timings and counts of the renderer
|
||||
// fittime <metres>... the grade line of a straight over rolling ground of each length fitted, as at a click, and the time the
|
||||
// frame waits for it while the track is laid, the line fitted on the thread of the fitter
|
||||
// nmtauto [unfitted] the tracks put onto the terrain model, all or the ones whose grade line isn't fitted yet
|
||||
// turntables the height of each turntable and of the model in its pit, and the heights of the tracks running up
|
||||
// to it out along their lines from the rim, against the model there
|
||||
// fittedstate [reload] logs how many tracks have their grade line fitted, and which; reload: read again from the //$f lines
|
||||
// trackterrain <pull|restore> <track>... the terrain drawn to the tracks, or their formations taken out of it, as the panel of the tracks
|
||||
// terrainhash a hash of the heights of the terrain chunks in memory, to compare the ground two builds made
|
||||
// rebuildall the geometry of every path in the sections made already laid anew, the time it took logged,
|
||||
// and the 3d sleepers of all the tracks laid anew, timed apart
|
||||
// sleepercheck the 3d sleepers of all the tracks checked for beams over each other and rails without enough under them
|
||||
@@ -175,6 +211,27 @@ void editor_mode::selftest_step()
|
||||
WriteLog("SELFTEST: " + std::to_string(test.lines.size()) + " steps from " + file);
|
||||
}
|
||||
++editor_selftest::frames();
|
||||
// how long each frame took, for the longest one perf tells
|
||||
{
|
||||
static auto last{std::chrono::steady_clock::now()};
|
||||
auto const now{std::chrono::steady_clock::now()};
|
||||
auto const frame{std::chrono::duration<double, std::milli>(now - last).count()};
|
||||
last = now;
|
||||
editor_selftest::frame_longest() = std::max(editor_selftest::frame_longest(), frame);
|
||||
if (frame > 33.0)
|
||||
++editor_selftest::frames_slow();
|
||||
}
|
||||
// the gesture of the clip being recorded, its bottom left corner where the clip has it
|
||||
if (false == test.badge.empty())
|
||||
{
|
||||
auto const words{gesture_picture(test.badge)};
|
||||
auto const height{std::round(ImGui::GetTextLineHeight() * 1.6f)};
|
||||
auto const pad{std::round(height * 0.25f)};
|
||||
ImVec2 const at{test.badge_at.x + pad, test.badge_at.y - pad - height};
|
||||
auto &list{*ImGui::GetForegroundDrawList(ImGui::GetMainViewport())};
|
||||
list.AddRectFilled(ImVec2(at.x - pad, at.y - pad), ImVec2(at.x + gesture_width(height, words) + pad, at.y + height + pad), IM_COL32(16, 20, 26, 225), pad);
|
||||
gesture_draw(list, at, height, words, IM_COL32(235, 235, 235, 255));
|
||||
}
|
||||
if (test.wait > 0)
|
||||
{
|
||||
--test.wait;
|
||||
@@ -190,8 +247,12 @@ void editor_mode::selftest_step()
|
||||
words >> test.wait;
|
||||
return;
|
||||
}
|
||||
if (selftest_dispatch(command, words) == selftest_result::pause)
|
||||
if (auto const result{selftest_dispatch(command, words)}; result == selftest_result::pause || result == selftest_result::again)
|
||||
{
|
||||
if (result == selftest_result::again)
|
||||
--test.next;
|
||||
return;
|
||||
}
|
||||
if (command == "quit")
|
||||
{
|
||||
if (false == test.quitting)
|
||||
|
||||
Reference in New Issue
Block a user