mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-26 00:01:15 +01:00
Today's work on the binary scene format plan (binary-scene-format-plan.md), from the first measurement to a terrain that bakes itself on first run and streams from a thread. The step-by-step history is kept on backup/scene-streaming-format-presquash-0916. Measuring first. -loadprofile times a scenery load by stage and by node kind and reports node counts and resident memory. On l204 terrain is 95% of the bytes and 99.8% of the nodes; on quarkmce2007 vehicles, not models, dominate what is left. The terrain turned out to be a heightfield in all but name, a ribbon covering 12% of its bounding box. The heightfield. scene/heightfieldformat.h is the .ehf layout: Morton-ordered tiles of 128 samples with one shared edge sample, a point-sampled mip chain, zstd per tile, a nodata sentinel, a material palette with a measured tiling per material, and a stamp of the rules that decided what counted as terrain. scene/heightfieldreader.h reads it for the tool, the renderer and the loader alike, and scene/terraincooker.h writes it, shared by the terraincook tool and the engine so a first-run bake is the file the tool would have made. The cooker rasterises every triangle where it is drawn (through scene::place_in_world, the placement the region applies too), keeps an upper surface laid within half a metre over another and the lower of two further apart, and then asks each triangle whether the heightfield shows it: laid, reaching a sample, keeping nearly all it claimed, and with the ground around it drawn at every level out to 2 km. Baking on first run. simulation/terrainbake bakes <scenario>.ehf the first time a scenery is opened, choosing the grid step from the first 200,000 vertices, and on later loads leaves out the triangles its node table says the heightfield shows. Everything else - trees, grass tufts, gantries, bridge decks - is drawn as written, so a bad bake can at worst draw something twice, and the heightfield sits 2 cm under the triangles so the original wins there. Nodes are keyed by file, line, include parameters and placement; an edited file changes its keys and those nodes are drawn again. A bake under older rules, or without its table, is thrown away and redone. A launcher copy named $scenario shares the scenario's files. -nobaketerrain shows the triangles as written. A scenery can still name hand-cooked fields, several at different steps. Drawing and streaming. rendering/terrainclipmap draws resident tiles at the mip level their distance earns, deriving the grid from gl_VertexID and texturing in world space with the scenery's own materials. rendering/terraintileloader reads and decodes tiles on a thread of its own; the renderer rescans what is in range only after moving a quarter of a tile, asks for what is missing nearest first, uploads at most 32 tiles a frame, drops arrivals the camera has moved past, and keeps drawing a tile at the level it has until the right one arrives. The terrain has its own range, terrainrange in the ini and a slider in the debug panel, 20 km by default and independent of basedrawrange; the far plane of an ordinary view is pushed out to it. The debug panel shows the range, tiles in view, on the gpu, wanted and queued, and how many sit at each level. Events. The event queue moved out of the events into a binary heap with a deterministic tie-break, and an event is handed its activator instead of storing it, so basic_event is a definition and nothing else. The logic container. scene/logicformat.h and scene/logiccontainer write a scenery's events, their targets and sibling chains as flat, deterministic arrays with a schema hash that refuses a mismatched build. simulation/logiccook cooks it from the loaded state whenever it is missing, stale or unreadable, reads it straight back to check it, and resolves each target to a position in the registry its event kind searches. -cooklogic forces a cook, -verifylogic only checks. Nothing reads it at load yet. Prefabs. scene/prefab describes a signal by the aspects it can show - lights, speeds, animation channels, a sound - instead of pasting an .inc per variant, and expands an instance to ordinary scenery text. Tried on a light signal and a shape signal. Screenshots without a person present: -shot x,y,z[,yaw[,pitch]], -shotsettle, -shotstay.
451 lines
18 KiB
C++
451 lines
18 KiB
C++
/*
|
|
This Source Code Form is subject to the
|
|
terms of the Mozilla Public License, v.
|
|
2.0. If a copy of the MPL was not
|
|
distributed with this file, You can
|
|
obtain one at
|
|
http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
module;
|
|
#include <cstddef>
|
|
#include <deque>
|
|
#include <mutex>
|
|
#include <sstream>
|
|
#include <type_traits>
|
|
#include <cstdint>
|
|
#include <array>
|
|
#include <chrono>
|
|
#include <limits>
|
|
#include <ostream>
|
|
#include <string>
|
|
#include <utility>
|
|
#include <vector>
|
|
#include <optional>
|
|
#include <unordered_map>
|
|
#include "utilities/Globals_macros.h"
|
|
#include "utilities/utilities_macros.h"
|
|
#include <map>
|
|
#include "glad/glad.h"
|
|
#include <random>
|
|
#include <thread>
|
|
|
|
export module eu07.utilities.globals;
|
|
import eu07.glm;
|
|
import eu07.utilities.motiontelemetry;
|
|
import eu07.utilities.parser;
|
|
import eu07.utilities.classes;
|
|
import eu07.vehicle.camera;
|
|
import eu07.utilities.float3d;
|
|
import eu07.rendering.light;
|
|
import eu07.utilities.utilities;
|
|
#ifdef WITH_UART
|
|
import eu07.utilities.uart;
|
|
#endif
|
|
#ifdef WITH_ZMQ
|
|
#endif
|
|
|
|
export {
|
|
|
|
|
|
|
|
#ifdef WITH_UART
|
|
#endif
|
|
#ifdef WITH_ZMQ
|
|
#endif
|
|
|
|
struct global_settings {
|
|
// members
|
|
// data items
|
|
// TODO: take these out of the settings
|
|
|
|
std::chrono::steady_clock::time_point startTimestamp;
|
|
|
|
/// <summary>
|
|
/// Mapa z watkami w formacie <std::string nazwa, std::thread watek>
|
|
/// </summary>
|
|
std::map<std::string, std::thread> threads = {};
|
|
bool shiftState{ false }; //m7todo: brzydko
|
|
bool ctrlState{ false };
|
|
bool altState{ false };
|
|
std::mt19937 random_engine;
|
|
std::mt19937 local_random_engine;
|
|
bool ready_to_load{ false };
|
|
std::time_t starting_timestamp = 0; // starting time, in local timezone
|
|
uint32_t random_seed = 0;
|
|
TCamera pCamera; // parametry kamery
|
|
TCamera pDebugCamera;
|
|
std::array<glm::dvec3, 10> FreeCameraInit; // pozycje kamery
|
|
std::array<glm::vec3, 10> FreeCameraInitAngle;
|
|
int iCameraLast{ -1 };
|
|
int iSlowMotion{ 0 }; // info o malym FPS: 0-OK, 1-wyłączyć multisampling, 3-promień 1.5km, 7-1km
|
|
basic_light DayLight;
|
|
float SunAngle{ 0.f }; // angle of the sun relative to horizon
|
|
int trainThreads{0};
|
|
double fLuminance{ 1.0 }; // jasność światła do automatycznego zapalania // TODO: Why double?
|
|
double fTimeAngleDeg{ 0.0 }; // godzina w postaci kąta
|
|
float fClockAngleDeg[ 6 ]; // kąty obrotu cylindrów dla zegara cyfrowego
|
|
std::string LastGLError;
|
|
float ZoomFactor{ 1.f }; // determines current camera zoom level. TODO: move it to the renderer
|
|
bool CabWindowOpen{ false }; // controls sound attenuation between cab and outside
|
|
bool ControlPicking{ true }; // indicates controls pick mode is active
|
|
bool DLFont{ false }; // switch indicating presence of basic font
|
|
bool bActive{ true }; // czy jest aktywnym oknem
|
|
int iPause{ 0 }; // globalna pauza ruchu: b0=start,b1=klawisz,b2=tło,b3=lagi,b4=wczytywanie
|
|
float AirTemperature{ 15.f };
|
|
std::string asCurrentSceneryPath{ "scenery/" };
|
|
std::string asCurrentTexturePath{ paths::textures };
|
|
std::string asCurrentDynamicPath;
|
|
int CurrentMaxTextureSize{ 4096 };
|
|
bool UpdateMaterials{ true };
|
|
// settings
|
|
// filesystem
|
|
bool bLoadTraction{ true };
|
|
bool bSmoothTraction{ true };
|
|
bool CreateSwitchTrackbeds{ true };
|
|
std::string szTexturesTGA{ ".tga" }; // lista tekstur od TGA
|
|
std::string szTexturesDDS{ ".dds" }; // lista tekstur od DDS
|
|
std::string szDefaultExt{ szTexturesDDS };
|
|
std::string SceneryFile;
|
|
// uruchomienie prosto do edytora, z pominięciem symulacji; edytor jest wtedy trybem podstawowym
|
|
bool editor_startup{ false };
|
|
// rzut z góry bez perspektywy, do kreślenia planu torowiska na tle wczytanej scenerii
|
|
bool editor_ortho{ false };
|
|
float editor_ortho_extent{ 250.f }; // połowa wysokości widoku w metrach, czyli zoom rzutu
|
|
// punkt EPSG:2180 odpowiadający zeru scenerii. Bez tego sceneria jest fikcyjna i jej współrzędne
|
|
// nie znaczą nic poza nią samą
|
|
bool scenery_georeferenced{ false };
|
|
glm::dvec2 scenery_origin{ 0.0, 0.0 };
|
|
// prośba o zrzucenie wczytanej scenerii i zaczęcie na pustym terenie; obsługiwana na początku
|
|
// klatki, bo zmiana trybu w środku rysowania panelu wyrwałaby grunt spod niego samego
|
|
bool editor_reset_scenery{ false };
|
|
std::string local_start_vehicle{ "EU07-424" };
|
|
int iConvertModels{ 0 }; // tworzenie plików binarnych
|
|
int iConvertIndexRange{ 1000 }; // range of duplicate vertex scan
|
|
bool file_binary_terrain{ true }; // enable binary terrain (de)serialization
|
|
// -cooklogic: write the scenery's LOGIC container once it has loaded, then read it back
|
|
// and check it against what was loaded
|
|
bool cook_logic{ false };
|
|
// -verifylogic: read the container that is already there and check it against the
|
|
// scenery, without writing anything. this is how a stale container gets caught
|
|
bool verify_logic{ false };
|
|
// bake a heightfield for a scenery that has none, the first time it is opened, and use
|
|
// it from then on. -nobaketerrain turns it off
|
|
bool bake_terrain{ true };
|
|
// cooked heightfields drawn in place of the legacy terrain geometry, coarsest first
|
|
// once sorted. a scenery needs several: a regional elevation model sampled every
|
|
// hundred metres, and a corridor of its own for each line, sampled every two
|
|
std::vector<std::string> terrain_heightfields;
|
|
bool file_binary_terrain_state{true};
|
|
// logs
|
|
bool priorityLoadText3D{false}; // ladowanie T3D priorytetowo
|
|
int iWriteLogEnabled{ 3 }; // maska bitowa: 1-zapis do pliku, 2-okienko, 4-nazwy torów
|
|
bool MultipleLogs{ false };
|
|
bool ShowSystemConsole{ false }; // toggle visibility of the OS console window with log output
|
|
unsigned int DisabledLogTypes{ 0 };
|
|
bool ParserLogIncludes{ true };
|
|
// simulation
|
|
bool RealisticControlMode{ false }; // controls ability to steer the vehicle from outside views
|
|
bool bEnableTraction{ true };
|
|
float fFriction{ 1.f }; // mnożnik tarcia - KURS90
|
|
float FrictionWeatherFactor{ 1.f };
|
|
bool bLiveTraction{ true };
|
|
float Overcast{ 0.1f }; // NOTE: all this weather stuff should be moved elsewhere
|
|
glm::vec3 FogColor = { 0.6f, 0.7f, 0.8f };
|
|
float fFogEnd{ 7500 };
|
|
float fTurbidity{ 128 };
|
|
std::string Season{}; // season of the year, based on simulation date
|
|
std::string Weather{ "cloudy:" }; // current weather
|
|
std::string Period{}; // time of the day, based on sun position
|
|
bool FullPhysics{ true }; // full calculations performed for each simulation step
|
|
bool bnewAirCouplers{ true };
|
|
float fMoveLight{ 0.f }; // numer dnia w roku albo -1
|
|
bool FakeLight{ false }; // toggle between fixed and dynamic daylight
|
|
double fTimeSpeed{ 1.0 }; // przyspieszenie czasu, zmienna do testów
|
|
double default_timespeed { 1.0 }; // timescale loaded from config
|
|
double fLatitudeDeg{ 52.0 }; // szerokość geograficzna
|
|
float ScenarioTimeOverride{ std::numeric_limits<float>::quiet_NaN() }; // requested scenario start time
|
|
float ScenarioTimeOffset{ 0.f }; // time shift (in hours) applied to train timetables
|
|
bool ScenarioTimeCurrent{ false }; // automatic time shift to match scenario time with local clock
|
|
bool bInactivePause{ true }; // automatyczna pauza, gdy okno nieaktywne
|
|
int iSlowMotionMask{ -1 }; // maska wyłączanych właściwości
|
|
bool bHideConsole{ false }; // hunter-271211: ukrywanie konsoli
|
|
bool bRollFix{ true }; // czy wykonać przeliczanie przechyłki
|
|
bool bJoinEvents{ false }; // czy grupować eventy o tych samych nazwach
|
|
int iHiddenEvents{ 1 }; // czy łączyć eventy z torami poprzez nazwę toru
|
|
bool AITrainman{ true }; // virtual assistant performing consist coupling/decoupling and other maintenance tasks
|
|
// ui
|
|
int PythonScreenUpdateRate{ 200 }; // delay between python-based screen updates, in milliseconds
|
|
int iTextMode{ 0 }; // tryb pracy wyświetlacza tekstowego
|
|
glm::vec4 UITextColor{ glm::vec4( 225.f / 255.f, 225.f / 255.f, 225.f / 255.f, 1.f ) }; // base color of UI text
|
|
float UIBgOpacity{ 0.94f }; // opacity of ui windows
|
|
std::string asLang{ "pl" }; // domyślny język - http://tools.ietf.org/html/bcp47
|
|
// gfx
|
|
glm::ivec2 window_size; // main window size in platform-specific virtual pixels
|
|
glm::ivec2 cursor_pos; // cursor position in platform-specific virtual pixels
|
|
glm::ivec2 fb_size; // main window framebuffer size
|
|
float ShakingMultiplierBF {1.f}; // mnożnik bujania kamera przod/tyl
|
|
float ShakingMultiplierRL {1.f}; // mnożnik bujania kamera lewo/prawo
|
|
float ShakingMultiplierUD {1.f}; // mnożnik bujania kamera gora/dol
|
|
float fDistanceFactor{ 1.f }; // baza do przeliczania odległości dla LoD
|
|
float targetfps{ 60.0f };
|
|
bool bFullScreen{ false };
|
|
bool VSync{ false };
|
|
bool bWireFrame{ false };
|
|
bool bAdjustScreenFreq{ true };
|
|
float BaseDrawRange{ 2500.f };
|
|
// how far terrain tiles are streamed and drawn, independent of BaseDrawRange: a baked
|
|
// heightfield is cheap far out, and seeing it to the horizon is the point of having it
|
|
float TerrainRange{ 20000.f };
|
|
int DynamicLightCount{ 7 };
|
|
bool ScaleSpecularValues{ true };
|
|
std::string GfxRenderer{ "default" };
|
|
bool LegacyRenderer{ false };
|
|
bool NvRenderer{ false };
|
|
bool BasicRenderer{ false };
|
|
bool RenderShadows{ true };
|
|
bool applicationQuitOrder{false};
|
|
int RenderCabShadowsRange{ 0 };
|
|
struct shadowtune_t {
|
|
unsigned int map_size{ 2048 };
|
|
float range{ 250.f };
|
|
} shadowtune;
|
|
struct reflectiontune_t {
|
|
double update_interval{ 300.0 };
|
|
int fidelity{ 0 }; // 0: sections, 1: +static models, 2: +vehicles
|
|
float range_instances{ 750.f };
|
|
float range_vehicles{ 250.f };
|
|
} reflectiontune;
|
|
bool bUseVBO{ true }; // czy jest VBO w karcie graficznej (czy użyć)
|
|
float AnisotropicFiltering{ 8.f }; // requested level of anisotropic filtering. TODO: move it to renderer object
|
|
float FieldOfView{ 45.f }; // vertical field of view for the camera. TODO: move it to the renderer
|
|
GLint iMaxTextureSize{ 4096 }; // maksymalny rozmiar tekstury
|
|
GLint iMaxCabTextureSize{ 4096 }; // largest allowed texture in vehicle cab
|
|
int iMultisampling{ 2 }; // tryb antyaliasingu: 0=brak,1=2px,2=4px,3=8px,4=16px
|
|
float SplineFidelity{ 1.f }; // determines segment size during conversion of splines to geometry
|
|
float SleeperDistance{ 250.f }; // max distance (in meters) at which per-track sleeper models are still drawn; 0 disables sleeper rendering entirely
|
|
bool Smoke{ true }; // toggles smoke simulation and visualization
|
|
float SmokeFidelity{ 1.f }; // determines amount of generated smoke particles
|
|
bool ResourceSweep{ true }; // gfx resource garbage collection
|
|
bool ResourceMove{ false }; // gfx resources are moved between cpu and gpu side instead of sending a copy
|
|
bool compress_tex{ true }; // all textures are compressed on gpu side
|
|
std::string asSky{ "1" };
|
|
float fFpsAverage{ 0.f }; // oczekiwana wartosć FPS
|
|
float fFpsDeviation{ 5.f }; // odchylenie standardowe FPS
|
|
double fFpsMin{ 30.0 }; // dolna granica FPS, przy której promień scenerii będzie zmniejszany
|
|
double fFpsMax{ 65.0 }; // górna granica FPS, przy której promień scenerii będzie zwiększany
|
|
// audio
|
|
bool bSoundEnabled{ true };
|
|
float AudioVolume{ 1.f };
|
|
float DefaultRadioVolume{ 0.75f };
|
|
float VehicleVolume{ 1.0f };
|
|
float EnvironmentPositionalVolume{ 1.0f };
|
|
float EnvironmentAmbientVolume{ 1.0f };
|
|
int audio_max_sources = 30;
|
|
std::string AudioRenderer;
|
|
// input
|
|
float fMouseXScale{ 1.5f };
|
|
float fMouseYScale{ 0.2f };
|
|
int iFeedbackMode{ 1 }; // tryb pracy informacji zwrotnej
|
|
int iFeedbackPort{ 0 }; // dodatkowy adres dla informacji zwrotnych
|
|
bool InputGamepad{ true }; // whether gamepad support is enabled
|
|
bool InputMouse{ true }; // whether control pick mode can be activated
|
|
double fBrakeStep { 1.0 }; // krok zmiany hamulca innych niż FV4a dla klawiszy [Num3] i [Num9]
|
|
double brake_speed { 3.0 }; // prędkość przesuwu hamulca dla FV4a
|
|
// parametry kalibracyjne wejść z pulpitu
|
|
double fCalibrateIn[ 6 ][ 6 ] = {
|
|
{ 0, 0, 0, 0, 0, 0 },
|
|
{ 0, 0, 0, 0, 0, 0 },
|
|
{ 0, 0, 0, 0, 0, 0 },
|
|
{ 0, 0, 0, 0, 0, 0 },
|
|
{ 0, 0, 0, 0, 0, 0 },
|
|
{ 0, 0, 0, 0, 0, 0 } };
|
|
// parametry kalibracyjne wyjść dla pulpitu
|
|
double fCalibrateOut[ 7 ][ 6 ] = {
|
|
{ 0, 1, 0, 0, 0, 0 },
|
|
{ 0, 1, 0, 0, 0, 0 },
|
|
{ 0, 1, 0, 0, 0, 0 },
|
|
{ 0, 1, 0, 0, 0, 0 },
|
|
{ 0, 1, 0, 0, 0, 0 },
|
|
{ 0, 1, 0, 0, 0, 0 },
|
|
{ 0, 1, 0, 0, 0, 0 } };
|
|
// wartości maksymalne wyjść dla pulpitu
|
|
double fCalibrateOutMax[ 7 ] = {
|
|
0, 0, 0, 0, 0, 0, 0 };
|
|
int iCalibrateOutDebugInfo{ -1 }; // numer wyjścia kalibrowanego dla którego wyświetlać informacje podczas kalibracji
|
|
int iPoKeysPWM[ 7 ] = { 0, 1, 2, 3, 4, 5, 6 }; // numery wejść dla PWM
|
|
#ifdef WITH_UART
|
|
uart_input::conf_t uart_conf;
|
|
std::map<std::string, bool *> uartfeatures_map = {
|
|
{"main", &uart_conf.mainenable},
|
|
{"scnd", &uart_conf.scndenable},
|
|
{"train", &uart_conf.trainenable},
|
|
{"local", &uart_conf.localenable},
|
|
{"radiovolume", &uart_conf.radiovolumeenable},
|
|
{"radiochannel", &uart_conf.radiochannelenable},
|
|
{"dynamicbrake", &uart_conf.dynamicenable},
|
|
};
|
|
#endif
|
|
#ifdef WITH_ZMQ
|
|
std::string zmq_address;
|
|
#endif
|
|
// multiplayer
|
|
int iMultiplayer{ 0 }; // blokada działania niektórych eventów na rzecz kominikacji
|
|
bool bIsolatedTrainName{ false }; //wysyłanie zajęcia odcinka izolowanego z nazwą pociągu
|
|
// other
|
|
std::string AppName{ "MaSzyna" };
|
|
std::string asVersion; // z opisem
|
|
motiontelemetry::conf_t motiontelemetry_conf;
|
|
std::string screenshot_dir;
|
|
bool loading_log = false;
|
|
bool dds_upper_origin = false;
|
|
bool captureonstart = true;
|
|
bool render_cab = true;
|
|
bool crash_damage = true;
|
|
bool gui_defaultwindows = true;
|
|
bool gui_showtranscripts = true;
|
|
bool gui_trainingdefault = false;
|
|
|
|
std::string extcam_cmd;
|
|
std::string extcam_rec;
|
|
glm::ivec2 extcam_res{800, 600};
|
|
|
|
std::chrono::duration<float> minframetime {0.0f};
|
|
std::string fullscreen_monitor;
|
|
bool fullscreen_windowed{ false };
|
|
|
|
bool python_enabled = true;
|
|
bool python_mipmaps = true;
|
|
bool python_displaywindows = false;
|
|
bool python_threadedupload = true;
|
|
bool python_vsync = true;
|
|
bool python_sharectx = true;
|
|
bool python_uploadmain = true;
|
|
std::chrono::duration<float> python_minframetime {0.01f};
|
|
|
|
bool gfx_skiprendering = false;
|
|
int gfx_framebuffer_width = -1;
|
|
int gfx_framebuffer_height = -1;
|
|
bool gfx_shadowmap_enabled = true;
|
|
bool gfx_envmap_enabled = true;
|
|
bool gfx_postfx_motionblur_enabled = true;
|
|
float gfx_postfx_motionblur_shutter = 0.01f;
|
|
GLenum gfx_postfx_motionblur_format = GL_RG16F;
|
|
GLenum gfx_format_color = GL_RGB16F;
|
|
GLenum gfx_format_depth = GL_DEPTH_COMPONENT32F;
|
|
bool gfx_postfx_chromaticaberration_enabled = true;
|
|
bool gfx_skippipeline = false;
|
|
bool gfx_extraeffects = true;
|
|
bool gfx_shadergamma = false;
|
|
bool gfx_usegles = false;
|
|
std::string gfx_angleplatform;
|
|
bool gfx_gldebug = false;
|
|
bool vr = false;
|
|
std::string vr_backend;
|
|
|
|
float gfx_distance_factor_max { 3.f };
|
|
float gfx_shadow_angle_min { -0.2f };
|
|
int gfx_shadow_rank_cutoff { 3 };
|
|
|
|
float ui_fontsize = 13.0f;
|
|
float ui_scale = 1.0f;
|
|
|
|
float map_highlight_distance = 3000.0f;
|
|
|
|
std::string exec_on_exit;
|
|
std::string prepend_scn;
|
|
bool gfx_postfx_ssao_enabled {false};
|
|
|
|
struct extraviewport_config {
|
|
std::string monitor;
|
|
|
|
int width, height;
|
|
float draw_range;
|
|
|
|
viewport_proj_config projection;
|
|
};
|
|
std::vector<extraviewport_config> extra_viewports;
|
|
|
|
struct pythonviewport_config {
|
|
std::string surface;
|
|
|
|
std::string monitor;
|
|
glm::ivec2 size;
|
|
|
|
glm::vec2 offset;
|
|
glm::vec2 scale;
|
|
};
|
|
std::vector<pythonviewport_config> python_viewports;
|
|
|
|
struct headtrack_config {
|
|
std::string joy;
|
|
|
|
bool magic_window = false;
|
|
|
|
glm::ivec3 move_axes;
|
|
glm::vec3 move_mul;
|
|
|
|
glm::ivec3 rot_axes;
|
|
glm::vec3 rot_mul;
|
|
};
|
|
headtrack_config headtrack_conf;
|
|
|
|
glm::vec3 viewport_move;
|
|
glm::mat3 viewport_rotate;
|
|
|
|
bool map_manualswitchcontrol = false;;
|
|
|
|
std::vector<std::pair<std::string, std::string>> network_servers;
|
|
std::optional<std::pair<std::string, std::string>> network_client;
|
|
float desync = 0.0f;
|
|
|
|
std::unordered_map<int, std::string> trainset_overrides;
|
|
|
|
float m_skysaturationcorrection{ 1.65f };
|
|
float m_skyhuecorrection{ 0.5f };
|
|
|
|
// methods
|
|
void LoadIniFile( std::string asFileName );
|
|
void FinalizeConfig();
|
|
void ConfigParse(cParser &parser);
|
|
bool ConfigParseGeneral(cParser& Parser, const std::string& token);
|
|
bool ConfigParseAudio(cParser& Parser, const std::string& token);
|
|
bool ConfigParseGraphics(cParser& Parser, const std::string& token);
|
|
bool ConfigParseInput(cParser& Parser, const std::string& token);
|
|
bool ConfigParseSimulation(cParser& Parser, const std::string& token);
|
|
bool ConfigParseUI(cParser& Parser, const std::string& token);
|
|
bool ConfigParsePython(cParser& Parser, const std::string& token);
|
|
bool ConfigParseNetwork(cParser& Parser, const std::string& token);
|
|
bool ConfigParseHardware(cParser& Parser, const std::string& token);
|
|
bool ConfigParseDebug(cParser& Parser, const std::string& token);
|
|
bool ConfigParse_gfx( cParser &parser, std::string_view const Token );
|
|
// sends basic content of the class in legacy (text) format to provided stream
|
|
void
|
|
export_as_text( std::ostream &Output ) const;
|
|
template <typename Type_>
|
|
void
|
|
export_as_text( std::ostream &Output, std::string const Key, Type_ const &Value ) const;
|
|
};
|
|
|
|
} // export -- out-of-line member definitions are not namespace-scope
|
|
// declarations, so they cannot carry `export`; the class itself is exported.
|
|
template <typename Type_>
|
|
void
|
|
global_settings::export_as_text( std::ostream &Output, std::string const Key, Type_ const &Value ) const {
|
|
|
|
Output << Key << " " << Value << "\n";
|
|
}
|
|
|
|
template <>
|
|
void
|
|
global_settings::export_as_text( std::ostream &Output, std::string const Key, std::string const &Value ) const;
|
|
|
|
template <>
|
|
void
|
|
global_settings::export_as_text( std::ostream &Output, std::string const Key, bool const &Value ) const;
|
|
export {
|
|
|
|
extern global_settings& GetGlobalSettings();
|
|
|
|
|
|
} // export
|