mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
reformat: remove redundant 'inline' specifier
This commit is contained in:
@@ -50,7 +50,7 @@ class Console
|
||||
static int On();
|
||||
static void Off();
|
||||
|
||||
inline static bool Pressed(int x)
|
||||
static bool Pressed(int x)
|
||||
{ // na razie tak - czyta się tylko klawiatura
|
||||
if (glfwGetKey(Application.window(), x) == GLFW_TRUE)
|
||||
return true;
|
||||
|
||||
166
McZapkie/MOVER.h
166
McZapkie/MOVER.h
@@ -1027,7 +1027,7 @@ struct TPowerParameters
|
||||
TPowerType PowerType;
|
||||
};
|
||||
};
|
||||
inline TPowerParameters()
|
||||
TPowerParameters()
|
||||
{
|
||||
MaxVoltage = 0.0;
|
||||
MaxCurrent = 0.0;
|
||||
@@ -1236,11 +1236,11 @@ struct TCoupling
|
||||
bool Render = false; /*ABu: czy rysowac jak zaczepiony sprzeg*/
|
||||
std::string control_type; // abstraction of control coupling interface and communication standard
|
||||
|
||||
inline bool has_adapter() const
|
||||
bool has_adapter() const
|
||||
{
|
||||
return adapter_type != TCouplerType::NoCoupler;
|
||||
}
|
||||
inline TCouplerType const type() const
|
||||
TCouplerType const type() const
|
||||
{
|
||||
return adapter_type == TCouplerType::NoCoupler ? CouplerType : adapter_type;
|
||||
}
|
||||
@@ -2090,7 +2090,7 @@ class TMoverParameters
|
||||
int CabActive = 0; // numer kabiny, z której jest sterowanie: 1 lub -1; w przeciwnym razie brak sterowania - rozrzad
|
||||
int CabOccupied = 0; // numer kabiny, w ktorej jest obsada (zwykle jedna na skład) // TODO: move to TController
|
||||
bool CabMaster = false; // czy pojazd jest nadrzędny w składzie
|
||||
inline bool IsCabMaster()
|
||||
bool IsCabMaster()
|
||||
{
|
||||
return CabActive == CabOccupied && CabMaster;
|
||||
} // czy aktualna kabina jest na pewno tą, z której można sterować
|
||||
@@ -2293,12 +2293,12 @@ class TMoverParameters
|
||||
bool Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Enforce = false, bool Audible = true);
|
||||
int DettachStatus(int ConnectNo);
|
||||
bool Dettach(int ConnectNo);
|
||||
void damage_coupler(int const End);
|
||||
void damage_coupler(int End);
|
||||
void Derail(DerailReason Reason);
|
||||
bool DirectionForward();
|
||||
bool DirectionBackward(void); /*! kierunek ruchu*/
|
||||
bool EIMDirectionChangeAllow(void) const;
|
||||
inline double IsVehicleEIMBrakingFactor()
|
||||
double IsVehicleEIMBrakingFactor()
|
||||
{
|
||||
return DynamicBrakeFlag && ResistorsFlag ? 0.0 : eimv[eimv_Ipoj] < 0 ? -1.0 : 1.0;
|
||||
}
|
||||
@@ -2307,19 +2307,19 @@ class TMoverParameters
|
||||
bool IncBrakeLevel(); // wersja na użytek AI
|
||||
bool DecBrakeLevel();
|
||||
bool ChangeCab(int direction);
|
||||
bool CurrentSwitch(bool const State);
|
||||
bool CurrentSwitch(bool State);
|
||||
bool IsMotorOverloadRelayHighThresholdOn() const;
|
||||
void UpdateBatteryVoltage(double dt);
|
||||
double ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam &Track, TTractionParam &ElectricTraction, TLocation const &NewLoc,
|
||||
TRotation const &NewRot); // oblicza przesuniecie pojazdu
|
||||
double FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track, TLocation const &NewLoc, TRotation const &NewRot); // oblicza przesuniecie pojazdu - wersja zoptymalizowana
|
||||
void compute_movement_(double const Deltatime);
|
||||
void compute_movement_(double Deltatime);
|
||||
double ShowEngineRotation(int VehN);
|
||||
|
||||
// Q *******************************************************************************************
|
||||
double GetTrainsetVoltage(int const Coupling = heating | highvoltage) const;
|
||||
double GetTrainsetVoltage(int Coupling = heating | highvoltage) const;
|
||||
double GetTrainsetHighVoltage() const;
|
||||
bool switch_physics(bool const State);
|
||||
bool switch_physics(bool State);
|
||||
double LocalBrakeRatio(void);
|
||||
double ManualBrakeRatio(void);
|
||||
double PipeRatio(void); /*ile napelniac*/
|
||||
@@ -2330,16 +2330,16 @@ class TMoverParameters
|
||||
double EngineMaxRPM() const;
|
||||
|
||||
/*! przesylanie komend sterujacych*/
|
||||
bool SendCtrlToNext(std::string const CtrlCommand, double const ctrlvalue, double const dir, int const Couplertype = control);
|
||||
bool SetInternalCommand(std::string NewCommand, double NewValue1, double NewValue2, int const Couplertype = control);
|
||||
bool SendCtrlToNext(std::string CtrlCommand, double ctrlvalue, double dir, int Couplertype = control);
|
||||
bool SetInternalCommand(std::string NewCommand, double NewValue1, double NewValue2, int Couplertype = control);
|
||||
double GetExternalCommand(std::string &Command);
|
||||
bool RunCommand(std::string Command, double CValue1, double CValue2, int const Couplertype = control);
|
||||
bool RunCommand(std::string Command, double CValue1, double CValue2, int Couplertype = control);
|
||||
bool RunInternalCommand();
|
||||
void PutCommand(std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation);
|
||||
bool CabActivisation(bool const Enforce = false);
|
||||
bool CabDeactivisation(bool const Enforce = false);
|
||||
bool CabActivisationAuto(bool const Enforce = false);
|
||||
bool CabDeactivisationAuto(bool const Enforce = false);
|
||||
bool CabActivisation(bool Enforce = false);
|
||||
bool CabDeactivisation(bool Enforce = false);
|
||||
bool CabActivisationAuto(bool Enforce = false);
|
||||
bool CabDeactivisationAuto(bool Enforce = false);
|
||||
|
||||
/*! funkcje zwiekszajace/zmniejszajace nastawniki*/
|
||||
/*! glowny nastawnik:*/
|
||||
@@ -2360,16 +2360,16 @@ class TMoverParameters
|
||||
|
||||
bool AddPulseForce(int Multipler); /*dla drezyny*/
|
||||
|
||||
bool SandboxManual(bool const State, range_t const Notify = range_t::consist); /*wlacza/wylacza reczne sypanie piasku*/
|
||||
bool SandboxAuto(bool const State, range_t const Notify = range_t::consist); /*wlacza/wylacza automatyczne sypanie piasku*/
|
||||
bool Sandbox(bool const State, range_t const Notify = range_t::consist); /*wlacza/wylacza sypanie piasku*/
|
||||
bool SandboxAutoAllow(bool const State); /*wlacza/wylacza zezwolenie na automatyczne sypanie piasku*/
|
||||
bool SandboxManual(bool State, range_t Notify = range_t::consist); /*wlacza/wylacza reczne sypanie piasku*/
|
||||
bool SandboxAuto(bool State, range_t Notify = range_t::consist); /*wlacza/wylacza automatyczne sypanie piasku*/
|
||||
bool Sandbox(bool State, range_t Notify = range_t::consist); /*wlacza/wylacza sypanie piasku*/
|
||||
bool SandboxAutoAllow(bool State); /*wlacza/wylacza zezwolenie na automatyczne sypanie piasku*/
|
||||
|
||||
/*! zbijanie czuwaka/SHP*/
|
||||
void SecuritySystemReset(void);
|
||||
void SecuritySystemCheck(double dt);
|
||||
|
||||
bool BatterySwitch(bool State, range_t const Notify = range_t::consist);
|
||||
bool BatterySwitch(bool State, range_t Notify = range_t::consist);
|
||||
bool EpFuseSwitch(bool State);
|
||||
bool SpringBrakeActivate(bool State);
|
||||
bool SpringBrakeShutOff(bool State);
|
||||
@@ -2378,20 +2378,20 @@ class TMoverParameters
|
||||
/*! stopnie hamowania - hamulec zasadniczy*/
|
||||
bool IncBrakeLevelOld(void);
|
||||
bool DecBrakeLevelOld(void);
|
||||
bool IncLocalBrakeLevel(float const CtrlSpeed);
|
||||
bool DecLocalBrakeLevel(float const CtrlSpeed);
|
||||
bool IncLocalBrakeLevel(float CtrlSpeed);
|
||||
bool DecLocalBrakeLevel(float CtrlSpeed);
|
||||
/*! ABu 010205: - skrajne polozenia ham. pomocniczego*/
|
||||
bool IncManualBrakeLevel(int CtrlSpeed);
|
||||
bool DecManualBrakeLevel(int CtrlSpeed);
|
||||
/*! oddzielny nastawnik hamulca elektrodynamicznego (gdy SplitEDPneumaticBrake)*/
|
||||
bool IncDynamicBrakeLevel(float const CtrlSpeed);
|
||||
bool DecDynamicBrakeLevel(float const CtrlSpeed);
|
||||
bool IncDynamicBrakeLevel(float CtrlSpeed);
|
||||
bool DecDynamicBrakeLevel(float CtrlSpeed);
|
||||
bool DynamicBrakeLevelSet(double Position);
|
||||
double DynamicBrakeRatio(void) const;
|
||||
bool DynamicBrakeAvailable(void) const; /*czy ED dostepny w aktualnym oknie predkosci Vh0..Vh1*/
|
||||
bool DynamicBrakeSwitch(bool Switch);
|
||||
bool RadiostopSwitch(bool Switch);
|
||||
bool AlarmChainSwitch(bool const State);
|
||||
bool AlarmChainSwitch(bool State);
|
||||
bool AntiSlippingBrake(void);
|
||||
bool BrakeReleaser(int state);
|
||||
bool UniversalBrakeButton(int button, int state); /*uniwersalny przycisk hamulca*/
|
||||
@@ -2423,54 +2423,54 @@ class TMoverParameters
|
||||
double BrakeForceR(double ratio, double velocity);
|
||||
double BrakeForceP(double press, double velocity);
|
||||
double BrakeForce(const TTrackParam &Track);
|
||||
double CouplerForce(int const End, double dt);
|
||||
void CollisionDetect(int const End, double const dt);
|
||||
double CouplerForce(int End, double dt);
|
||||
void CollisionDetect(int End, double dt);
|
||||
/*obrot kol uwzgledniajacy poslizg*/
|
||||
double ComputeRotatingWheel(double WForce, double dt, double n) const;
|
||||
|
||||
/*--funkcje dla lokomotyw*/
|
||||
bool WaterPumpBreakerSwitch(bool State, range_t const Notify = range_t::consist); // water pump breaker state toggle
|
||||
bool WaterPumpSwitch(bool State, range_t const Notify = range_t::consist); // water pump state toggle
|
||||
bool WaterPumpSwitchOff(bool State, range_t const Notify = range_t::consist); // water pump state toggle
|
||||
bool WaterHeaterBreakerSwitch(bool State, range_t const Notify = range_t::consist); // water heater breaker state toggle
|
||||
bool WaterHeaterSwitch(bool State, range_t const Notify = range_t::consist); // water heater state toggle
|
||||
bool WaterCircuitsLinkSwitch(bool State, range_t const Notify = range_t::consist); // water circuits link state toggle
|
||||
bool FuelPumpSwitch(bool State, range_t const Notify = range_t::consist); // fuel pump state toggle
|
||||
bool FuelPumpSwitchOff(bool State, range_t const Notify = range_t::consist); // fuel pump state toggle
|
||||
bool OilPumpSwitch(bool State, range_t const Notify = range_t::consist); // oil pump state toggle
|
||||
bool OilPumpSwitchOff(bool State, range_t const Notify = range_t::consist); // oil pump state toggle
|
||||
bool MotorBlowersSwitch(bool State, end const Side, range_t const Notify = range_t::consist); // traction motor fan state toggle
|
||||
bool MotorBlowersSwitchOff(bool State, end const Side, range_t const Notify = range_t::consist); // traction motor fan state toggle
|
||||
bool CompartmentLightsSwitch(bool State, range_t const Notify = range_t::consist); // compartment lights state toggle
|
||||
bool CompartmentLightsSwitchOff(bool State, range_t const Notify = range_t::consist); // compartment lights state toggle
|
||||
bool MainSwitch(bool const State, range_t const Notify = range_t::consist); /*! wylacznik glowny*/
|
||||
void MainSwitch_(bool const State);
|
||||
bool WaterPumpBreakerSwitch(bool State, range_t Notify = range_t::consist); // water pump breaker state toggle
|
||||
bool WaterPumpSwitch(bool State, range_t Notify = range_t::consist); // water pump state toggle
|
||||
bool WaterPumpSwitchOff(bool State, range_t Notify = range_t::consist); // water pump state toggle
|
||||
bool WaterHeaterBreakerSwitch(bool State, range_t Notify = range_t::consist); // water heater breaker state toggle
|
||||
bool WaterHeaterSwitch(bool State, range_t Notify = range_t::consist); // water heater state toggle
|
||||
bool WaterCircuitsLinkSwitch(bool State, range_t Notify = range_t::consist); // water circuits link state toggle
|
||||
bool FuelPumpSwitch(bool State, range_t Notify = range_t::consist); // fuel pump state toggle
|
||||
bool FuelPumpSwitchOff(bool State, range_t Notify = range_t::consist); // fuel pump state toggle
|
||||
bool OilPumpSwitch(bool State, range_t Notify = range_t::consist); // oil pump state toggle
|
||||
bool OilPumpSwitchOff(bool State, range_t Notify = range_t::consist); // oil pump state toggle
|
||||
bool MotorBlowersSwitch(bool State, end Side, range_t Notify = range_t::consist); // traction motor fan state toggle
|
||||
bool MotorBlowersSwitchOff(bool State, end Side, range_t Notify = range_t::consist); // traction motor fan state toggle
|
||||
bool CompartmentLightsSwitch(bool State, range_t Notify = range_t::consist); // compartment lights state toggle
|
||||
bool CompartmentLightsSwitchOff(bool State, range_t Notify = range_t::consist); // compartment lights state toggle
|
||||
bool MainSwitch(bool State, range_t Notify = range_t::consist); /*! wylacznik glowny*/
|
||||
void MainSwitch_(bool State);
|
||||
bool MainSwitchCheck() const; // checks conditions for closing the line breaker
|
||||
bool ConverterSwitch(bool State, range_t const Notify = range_t::consist); /*! wl/wyl przetwornicy*/
|
||||
bool CompressorSwitch(bool State, range_t const Notify = range_t::consist); /*! wl/wyl sprezarki*/
|
||||
bool ChangeCompressorPreset(int const Change, range_t const Notify = range_t::consist);
|
||||
bool HeatingSwitch(bool const State, range_t const Notify = range_t::consist);
|
||||
void HeatingSwitch_(bool const State);
|
||||
bool ConverterSwitch(bool State, range_t Notify = range_t::consist); /*! wl/wyl przetwornicy*/
|
||||
bool CompressorSwitch(bool State, range_t Notify = range_t::consist); /*! wl/wyl sprezarki*/
|
||||
bool ChangeCompressorPreset(int Change, range_t Notify = range_t::consist);
|
||||
bool HeatingSwitch(bool State, range_t Notify = range_t::consist);
|
||||
void HeatingSwitch_(bool State);
|
||||
double EnginePowerSourceVoltage() const; // returns voltage of defined main engine power source
|
||||
|
||||
/*-funkcje typowe dla lokomotywy elektrycznej*/
|
||||
void LowVoltagePowerCheck(double const Deltatime);
|
||||
void MainsCheck(double const Deltatime);
|
||||
void PowerCouplersCheck(double const Deltatime, coupling const Coupling);
|
||||
void ConverterCheck(double const Timestep); // przetwornica
|
||||
void HeatingCheck(double const Timestep);
|
||||
void WaterPumpCheck(double const Timestep);
|
||||
void WaterHeaterCheck(double const Timestep);
|
||||
void FuelPumpCheck(double const Timestep);
|
||||
void OilPumpCheck(double const Timestep);
|
||||
void MotorBlowersCheck(double const Timestep);
|
||||
void PantographsCheck(double const Timestep);
|
||||
void LightsCheck(double const Timestep);
|
||||
bool FuseOn(range_t const Notify = range_t::consist); // bezpiecznik nadamiary
|
||||
void LowVoltagePowerCheck(double Deltatime);
|
||||
void MainsCheck(double Deltatime);
|
||||
void PowerCouplersCheck(double Deltatime, coupling Coupling);
|
||||
void ConverterCheck(double Timestep); // przetwornica
|
||||
void HeatingCheck(double Timestep);
|
||||
void WaterPumpCheck(double Timestep);
|
||||
void WaterHeaterCheck(double Timestep);
|
||||
void FuelPumpCheck(double Timestep);
|
||||
void OilPumpCheck(double Timestep);
|
||||
void MotorBlowersCheck(double Timestep);
|
||||
void PantographsCheck(double Timestep);
|
||||
void LightsCheck(double Timestep);
|
||||
bool FuseOn(range_t Notify = range_t::consist); // bezpiecznik nadamiary
|
||||
bool FuseFlagCheck(void) const; // sprawdzanie flagi nadmiarowego
|
||||
void FuseOff(void); // wylaczenie nadmiarowego
|
||||
bool UniversalResetButton(int const Button, range_t const Notify = range_t::consist);
|
||||
bool RelayReset(int const Relays, range_t const Notify = range_t::consist); // resets specified relays
|
||||
bool UniversalResetButton(int Button, range_t Notify = range_t::consist);
|
||||
bool RelayReset(int Relays, range_t Notify = range_t::consist); // resets specified relays
|
||||
double ShowCurrent(int AmpN) const; // pokazuje bezwgl. wartosc pradu na wybranym amperomierzu
|
||||
double ShowCurrentP(int AmpN) const; // pokazuje bezwgl. wartosc pradu w wybranym pojezdzie //Q 20160722
|
||||
|
||||
@@ -2484,16 +2484,16 @@ class TMoverParameters
|
||||
|
||||
bool CutOffEngine(void); // odlaczenie udszkodzonych silnikow
|
||||
/*funkcje automatycznego rozruchu np EN57*/
|
||||
bool MaxCurrentSwitch(bool State, range_t const Notify = range_t::consist); // przelacznik pradu wysokiego rozruchu
|
||||
bool MaxCurrentSwitch(bool State, range_t Notify = range_t::consist); // przelacznik pradu wysokiego rozruchu
|
||||
bool MinCurrentSwitch(bool State); // przelacznik pradu automatycznego rozruchu
|
||||
bool AutoRelaySwitch(bool State); // przelacznik automatycznego rozruchu
|
||||
bool AutoRelayCheck(); // symulacja automatycznego rozruchu
|
||||
bool MotorConnectorsCheck();
|
||||
bool ResistorsFlagCheck(void) const; // sprawdzenie kontrolki oporow rozruchowych NBMX
|
||||
|
||||
bool OperatePantographsValve(operation_t const State, range_t const Notify = range_t::consist);
|
||||
bool OperatePantographValve(end const End, operation_t const State, range_t const Notify = range_t::consist);
|
||||
bool DropAllPantographs(bool const State, range_t const Notify = range_t::consist);
|
||||
bool OperatePantographsValve(operation_t State, range_t Notify = range_t::consist);
|
||||
bool OperatePantographValve(end End, operation_t State, range_t Notify = range_t::consist);
|
||||
bool DropAllPantographs(bool State, range_t Notify = range_t::consist);
|
||||
|
||||
void CheckEIMIC(double dt); // sprawdzenie i zmiana nastawy zintegrowanego nastawnika jazdy/hamowania
|
||||
void CheckSpeedCtrl(double dt);
|
||||
@@ -2510,23 +2510,23 @@ class TMoverParameters
|
||||
double dizel_fillcheck(int mcp, double dt);
|
||||
double dizel_Momentum(double dizel_fill, double n, double dt);
|
||||
double dizel_MomentumRetarder(double n, double dt); // moment hamowania retardera
|
||||
void dizel_HeatSet(float const Value);
|
||||
void dizel_Heat(double const dt);
|
||||
void dizel_HeatSet(float Value);
|
||||
void dizel_Heat(double dt);
|
||||
bool dizel_StartupCheck();
|
||||
bool dizel_Update(double dt);
|
||||
|
||||
/* funckje dla wagonow*/
|
||||
bool AssignLoad(std::string const &Name, float const Amount = 0.f);
|
||||
bool AssignLoad(std::string const &Name, float Amount = 0.f);
|
||||
bool LoadingDone(double LSpeed, std::string const &Loadname);
|
||||
bool PermitDoors(side const Door, bool const State = true, range_t const Notify = range_t::consist);
|
||||
void PermitDoors_(side const Door, bool const State = true);
|
||||
bool ChangeDoorPermitPreset(int const Change, range_t const Notify = range_t::consist);
|
||||
bool PermitDoorStep(bool const State, range_t const Notify = range_t::consist);
|
||||
bool ChangeDoorControlMode(bool const State, range_t const Notify = range_t::consist);
|
||||
bool OperateDoors(side const Door, bool const State, range_t const Notify = range_t::consist);
|
||||
bool LockDoors(bool const State, range_t const Notify = range_t::consist);
|
||||
bool signal_departure(bool const State, range_t const Notify = range_t::consist); // toggles departure warning
|
||||
void update_doors(double const Deltatime); // door controller update
|
||||
bool PermitDoors(side Door, bool State = true, range_t Notify = range_t::consist);
|
||||
void PermitDoors_(side Door, bool State = true);
|
||||
bool ChangeDoorPermitPreset(int Change, range_t Notify = range_t::consist);
|
||||
bool PermitDoorStep(bool State, range_t Notify = range_t::consist);
|
||||
bool ChangeDoorControlMode(bool State, range_t Notify = range_t::consist);
|
||||
bool OperateDoors(side Door, bool State, range_t Notify = range_t::consist);
|
||||
bool LockDoors(bool State, range_t Notify = range_t::consist);
|
||||
bool signal_departure(bool State, range_t Notify = range_t::consist); // toggles departure warning
|
||||
void update_doors(double Deltatime); // door controller update
|
||||
|
||||
/* funkcje dla samochodow*/
|
||||
bool ChangeOffsetH(double DeltaOffset);
|
||||
@@ -2543,7 +2543,7 @@ class TMoverParameters
|
||||
void LoadFIZ_Wheels(std::string const &line);
|
||||
void LoadFIZ_Brake(std::string const &line);
|
||||
void LoadFIZ_Doors(std::string const &line);
|
||||
void LoadFIZ_BuffCoupl(std::string const &line, int const Index);
|
||||
void LoadFIZ_BuffCoupl(std::string const &line, int Index);
|
||||
void LoadFIZ_TurboPos(std::string const &line);
|
||||
void LoadFIZ_Cntrl(std::string const &line);
|
||||
void LoadFIZ_Blending(std::string const &line);
|
||||
@@ -2568,7 +2568,7 @@ class TMoverParameters
|
||||
void LoadFIZ_LightsList(std::string const &Input);
|
||||
void LoadFIZ_DimmerList(std::string const &Input);
|
||||
void LoadFIZ_CompressorList(std::string const &Input);
|
||||
void LoadFIZ_PowerParamsDecode(TPowerParameters &Powerparameters, std::string const Prefix, std::string const &Input);
|
||||
void LoadFIZ_PowerParamsDecode(TPowerParameters &Powerparameters, std::string Prefix, std::string const &Input);
|
||||
TPowerType LoadFIZ_PowerDecode(std::string const &Power);
|
||||
TPowerSource LoadFIZ_SourceDecode(std::string const &Source);
|
||||
TEngineType LoadFIZ_EngineDecode(std::string const &Engine);
|
||||
|
||||
@@ -103,7 +103,7 @@ class TPrzeciwposlizg : public TRura // przy napelnianiu - rura, przy poslizgu -
|
||||
public:
|
||||
void SetPoslizg(bool flag);
|
||||
void Update(double dt) /*override*/;
|
||||
inline TPrzeciwposlizg() : TRura()
|
||||
TPrzeciwposlizg() : TRura()
|
||||
{
|
||||
Poslizg = false;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ class TRapid : public TPrzekladnik {
|
||||
void SetRapidParams(double mult, double size);
|
||||
void SetRapidStatus(bool rs);
|
||||
void Update(double dt) /*override*/;
|
||||
inline TRapid() :
|
||||
TRapid() :
|
||||
TPrzekladnik()
|
||||
{}
|
||||
};
|
||||
@@ -137,7 +137,7 @@ class TPrzekCiagly : public TPrzekladnik {
|
||||
public:
|
||||
void SetMult(double m);
|
||||
void Update(double dt) /*override*/;
|
||||
inline TPrzekCiagly() :
|
||||
TPrzekCiagly() :
|
||||
TPrzekladnik()
|
||||
{}
|
||||
};
|
||||
@@ -151,7 +151,7 @@ class TPrzek_PZZ : public TPrzekladnik {
|
||||
public:
|
||||
void SetLBP(double P);
|
||||
void Update(double dt) /*override*/;
|
||||
inline TPrzek_PZZ() :
|
||||
TPrzek_PZZ() :
|
||||
TPrzekladnik()
|
||||
{}
|
||||
};
|
||||
@@ -175,7 +175,7 @@ class TPrzekED : public TRura {
|
||||
public:
|
||||
void SetP(double P);
|
||||
void Update(double dt) /*override*/;
|
||||
inline TPrzekED() :
|
||||
TPrzekED() :
|
||||
TRura()
|
||||
{}
|
||||
};
|
||||
@@ -205,25 +205,25 @@ class TNESt3 : public TBrake {
|
||||
double LBP = 0.0; // cisnienie hamulca pomocniczego
|
||||
|
||||
public:
|
||||
inline TNESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) :
|
||||
TNESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) :
|
||||
TBrake( i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
{}
|
||||
void Init( double const PP, double const HPP, double const LPP, double const BP, int const BDF ) /*override*/;
|
||||
virtual double GetPF( double const PP, double const dt, double const Vel ) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
void Init( double PP, double HPP, double LPP, double BP, int BDF ) /*override*/;
|
||||
virtual double GetPF( double PP, double dt, double Vel ) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
void EStParams(double i_crc); // parametry charakterystyczne dla ESt
|
||||
virtual double GetCRP() /*override*/;
|
||||
void CheckState(double const BCP, double &dV1); // glowny przyrzad rozrzadczy
|
||||
void CheckReleaser(double const dt); // odluzniacz
|
||||
double CVs(double const BP); // napelniacz sterujacego
|
||||
double BVs(double const BCP); // napelniacz pomocniczego
|
||||
void SetSize( int const size, std::string const ¶ms ); // ustawianie dysz (rozmiaru ZR), przekladniki
|
||||
void PLC(double const mass); // wspolczynnik cisnienia przystawki wazacej
|
||||
void SetLP(double const TM, double const LM, double const TBP); // parametry przystawki wazacej
|
||||
void CheckState(double BCP, double &dV1); // glowny przyrzad rozrzadczy
|
||||
void CheckReleaser(double dt); // odluzniacz
|
||||
double CVs(double BP); // napelniacz sterujacego
|
||||
double BVs(double BCP); // napelniacz pomocniczego
|
||||
void SetSize( int size, std::string const ¶ms ); // ustawianie dysz (rozmiaru ZR), przekladniki
|
||||
void PLC(double mass); // wspolczynnik cisnienia przystawki wazacej
|
||||
void SetLP(double TM, double LM, double TBP); // parametry przystawki wazacej
|
||||
virtual void ForceEmptiness() /*override*/; // wymuszenie bycia pustym
|
||||
void SetLBP(double const P); // cisnienie z hamulca pomocniczego
|
||||
void SetLBP(double P); // cisnienie z hamulca pomocniczego
|
||||
};
|
||||
|
||||
extern double d2A( double const d );
|
||||
extern double d2A( double d );
|
||||
|
||||
#endif // INCLUDED_OERLIKON_EST_H
|
||||
// END
|
||||
|
||||
@@ -376,7 +376,7 @@ class TBrake
|
||||
/// <param name="LPP">Low pressure threshold [bar].</param>
|
||||
/// <param name="BP">Initial brake cylinder pressure [bar].</param>
|
||||
/// <param name="BDF">Initial brake delay flag.</param>
|
||||
virtual void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF); // inicjalizacja hamulca
|
||||
virtual void Init(double PP, double HPP, double LPP, double BP, int BDF); // inicjalizacja hamulca
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current friction coefficient between blocks and the wheel/disc.
|
||||
@@ -385,7 +385,7 @@ class TBrake
|
||||
/// <param name="Vel">Current vehicle velocity [m/s or km/h depending on FM].</param>
|
||||
/// <param name="N">Normal force on the block [N].</param>
|
||||
/// <returns>Friction coefficient.</returns>
|
||||
double GetFC(double const Vel, double const N); // wspolczynnik tarcia - hamulec wie lepiej
|
||||
double GetFC(double Vel, double N); // wspolczynnik tarcia - hamulec wie lepiej
|
||||
/// <summary>
|
||||
/// Advances the brake distributor for one simulation step and returns the net
|
||||
/// volume exchanged with the brake pipe (positive = drawn from the brake pipe).
|
||||
@@ -394,7 +394,7 @@ class TBrake
|
||||
/// <param name="dt">Time step [s].</param>
|
||||
/// <param name="Vel">Vehicle velocity [m/s].</param>
|
||||
/// <returns>Volume exchanged between the valve pre-chamber and the brake pipe.</returns>
|
||||
virtual double GetPF(double const PP, double const dt, double const Vel); // przeplyw miedzy komora wstepna i PG
|
||||
virtual double GetPF(double PP, double dt, double Vel); // przeplyw miedzy komora wstepna i PG
|
||||
/// <summary>
|
||||
/// Returns the piston force produced by the brake cylinder pressure.
|
||||
/// </summary>
|
||||
@@ -406,7 +406,7 @@ class TBrake
|
||||
/// <param name="HP">High-pressure source pressure [bar].</param>
|
||||
/// <param name="dt">Time step [s].</param>
|
||||
/// <returns>Net flow from the high-pressure line.</returns>
|
||||
virtual double GetHPFlow(double const HP, double const dt); // przeplyw - 8 bar
|
||||
virtual double GetHPFlow(double HP, double dt); // przeplyw - 8 bar
|
||||
/// <summary>Returns brake cylinder gauge pressure [bar].</summary>
|
||||
double GetBCP(); // cisnienie cylindrow hamulcowych
|
||||
/// <summary>
|
||||
@@ -425,12 +425,12 @@ class TBrake
|
||||
/// </summary>
|
||||
/// <param name="nBDF">Requested delay flag (bdelay_*).</param>
|
||||
/// <returns>True if accepted (mode supported and changed); false otherwise.</returns>
|
||||
bool SetBDF(int const nBDF); // nastawiacz GPRM
|
||||
bool SetBDF(int nBDF); // nastawiacz GPRM
|
||||
/// <summary>
|
||||
/// Engages or disengages the releaser (odluzniacz), updating the brake state flags.
|
||||
/// </summary>
|
||||
/// <param name="state">1 to engage releaser, 0 to disengage.</param>
|
||||
void Releaser(int const state); // odluzniacz
|
||||
void Releaser(int state); // odluzniacz
|
||||
/// <summary>Returns true if the releaser is currently engaged.</summary>
|
||||
bool Releaser() const;
|
||||
/// <summary>
|
||||
@@ -438,7 +438,7 @@ class TBrake
|
||||
/// Default no-op; overridden by EP-capable distributors.
|
||||
/// </summary>
|
||||
/// <param name="nEPS">EP intensity (typically -1..1).</param>
|
||||
virtual void SetEPS(double const nEPS); // hamulec EP
|
||||
virtual void SetEPS(double nEPS); // hamulec EP
|
||||
/// <summary>Sets the rapid step ratio. Default no-op; overridden where supported.</summary>
|
||||
/// <param name="RMR">Rapid ratio.</param>
|
||||
virtual void SetRM(double const RMR) {}; // ustalenie przelozenia rapida
|
||||
@@ -471,14 +471,14 @@ class TBrake
|
||||
int GetStatus(); // flaga statusu, moze sie przydac do odglosow
|
||||
/// <summary>Sets the anti-slip target pressure.</summary>
|
||||
/// <param name="Press">Pressure [bar].</param>
|
||||
void SetASBP(double const Press); // ustalenie cisnienia pp
|
||||
void SetASBP(double Press); // ustalenie cisnienia pp
|
||||
/// <summary>Vents all reservoirs to zero pressure (used when the vehicle is decoupled or reset).</summary>
|
||||
virtual void ForceEmptiness();
|
||||
/// <summary>
|
||||
/// Removes a specified relative amount of air from the reservoirs to simulate leaks.
|
||||
/// </summary>
|
||||
/// <param name="Amount">Fraction of pressure to bleed (0..1) per call.</param>
|
||||
virtual void ForceLeak(double const Amount);
|
||||
virtual void ForceLeak(double Amount);
|
||||
/// <summary>Returns and clears the accumulated SoundFlag bitfield.</summary>
|
||||
int GetSoundFlag();
|
||||
/// <summary>Returns the current brake status flags.</summary>
|
||||
@@ -537,26 +537,26 @@ class TWest : public TBrake
|
||||
/// <param name="LPP">Low pressure.</param>
|
||||
/// <param name="BP">Initial cylinder pressure.</param>
|
||||
/// <param name="BDF">Initial brake delay flag.</param>
|
||||
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
|
||||
void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/;
|
||||
/// <summary>Sets the auxiliary brake target pressure and engages the DCV when above cylinder.</summary>
|
||||
/// <param name="P">Pressure [bar].</param>
|
||||
void SetLBP(double const P); // cisnienie z hamulca pomocniczego
|
||||
void SetLBP(double P); // cisnienie z hamulca pomocniczego
|
||||
/// <summary>One-step distributor advance (Westinghouse logic).</summary>
|
||||
/// <returns>Net flow exchanged with the brake pipe.</returns>
|
||||
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
/// <summary>Returns the high-pressure flow drawn during the last GetPF step.</summary>
|
||||
double GetHPFlow(double const HP, double const dt) /*override*/;
|
||||
double GetHPFlow(double HP, double dt) /*override*/;
|
||||
/// <summary>Recomputes the load-weighing pressure coefficient for the current mass.</summary>
|
||||
/// <param name="mass">Vehicle mass.</param>
|
||||
void PLC(double const mass); // wspolczynnik cisnienia przystawki wazacej
|
||||
void PLC(double mass); // wspolczynnik cisnienia przystawki wazacej
|
||||
/// <summary>Sets the EP brake state and toggles the DCV / latches LBP from cylinder pressure on release.</summary>
|
||||
/// <param name="nEPS">New EP intensity.</param>
|
||||
void SetEPS(double const nEPS) /*override*/; // stan hamulca EP
|
||||
void SetEPS(double nEPS) /*override*/; // stan hamulca EP
|
||||
/// <summary>Stores the load-weighing parameters (TareM, LoadM, TareBP).</summary>
|
||||
void SetLP(double const TM, double const LM, double const TBP); // parametry przystawki wazacej
|
||||
void SetLP(double TM, double LM, double TBP); // parametry przystawki wazacej
|
||||
|
||||
/// <summary>Constructs the distributor by forwarding all parameters to TBrake.</summary>
|
||||
inline TWest(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
|
||||
TWest(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -576,10 +576,10 @@ class TESt : public TBrake
|
||||
|
||||
public:
|
||||
/// <summary>Initialises the ESt distributor; sizes the control reservoir (15 l) and computes BVM.</summary>
|
||||
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
|
||||
void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/;
|
||||
/// <summary>One-step distributor advance for the ESt baseline.</summary>
|
||||
/// <returns>Net flow exchanged with the brake pipe.</returns>
|
||||
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
/// <summary>Sets ESt-specific characteristic parameters (placeholder; used by some variants).</summary>
|
||||
/// <param name="i_crc">Characteristic value.</param>
|
||||
void EStParams(double i_crc); // parametry charakterystyczne dla ESt
|
||||
@@ -614,7 +614,7 @@ class TESt : public TBrake
|
||||
void ForceEmptiness() /*override*/; // wymuszenie bycia pustym
|
||||
|
||||
/// <summary>Constructs the ESt distributor and creates the control reservoir.</summary>
|
||||
inline TESt(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
TESt(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
{
|
||||
CntrlRes = std::make_shared<TReservoir>();
|
||||
}
|
||||
@@ -633,10 +633,10 @@ class TESt3 : public TESt
|
||||
public:
|
||||
/// <summary>One-step distributor advance for ESt3 (G/P-dependent fill/release curves).</summary>
|
||||
/// <returns>Net flow exchanged with the brake pipe.</returns>
|
||||
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
|
||||
/// <summary>Constructs the ESt3 distributor.</summary>
|
||||
inline TESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TESt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
|
||||
TESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TESt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -660,16 +660,16 @@ class TESt3AL2 : public TESt3
|
||||
|
||||
public:
|
||||
/// <summary>Initialises the impulse chamber on top of the ESt initialisation.</summary>
|
||||
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
|
||||
void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/;
|
||||
/// <summary>One-step distributor advance for ESt3/AL2 with load-weighing relay.</summary>
|
||||
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
/// <summary>Recomputes LoadC for the current vehicle mass.</summary>
|
||||
void PLC(double const mass); // wspolczynnik cisnienia przystawki wazacej
|
||||
void PLC(double mass); // wspolczynnik cisnienia przystawki wazacej
|
||||
/// <summary>Stores the load-weighing parameters.</summary>
|
||||
void SetLP(double const TM, double const LM, double const TBP); // parametry przystawki wazacej
|
||||
void SetLP(double TM, double LM, double TBP); // parametry przystawki wazacej
|
||||
|
||||
/// <summary>Constructs the distributor and creates the impulse chamber.</summary>
|
||||
inline TESt3AL2(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TESt3(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
TESt3AL2(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TESt3(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
{
|
||||
ImplsRes = std::make_shared<TReservoir>();
|
||||
}
|
||||
@@ -695,12 +695,12 @@ class TESt4R : public TESt
|
||||
|
||||
public:
|
||||
/// <summary>Initialises the ESt4R; sizes the impulse chamber and selects the R delay.</summary>
|
||||
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
|
||||
void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/;
|
||||
/// <summary>One-step distributor advance for ESt4R (rapid step active above velocity threshold).</summary>
|
||||
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
|
||||
/// <summary>Constructs the distributor and creates the impulse chamber.</summary>
|
||||
inline TESt4R(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TESt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
TESt4R(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TESt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
{
|
||||
ImplsRes = std::make_shared<TReservoir>();
|
||||
}
|
||||
@@ -726,24 +726,24 @@ class TLSt : public TESt4R
|
||||
|
||||
public:
|
||||
/// <summary>Initialises the LSt; resizes the valve and impulse reservoirs and presets pressures.</summary>
|
||||
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
|
||||
void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/;
|
||||
/// <summary>Sets the auxiliary brake target pressure for the DCV.</summary>
|
||||
void SetLBP(double const P); // cisnienie z hamulca pomocniczego
|
||||
void SetLBP(double P); // cisnienie z hamulca pomocniczego
|
||||
/// <summary>Sets the rapid step ratio (RM = 1 - RMR).</summary>
|
||||
/// <param name="RMR">Reduction ratio (0 disables rapid, > 0 enables).</param>
|
||||
void SetRM(double const RMR); // ustalenie przelozenia rapida
|
||||
void SetRM(double RMR); // ustalenie przelozenia rapida
|
||||
/// <summary>One-step distributor advance for LSt (DCV + rapid + ED release).</summary>
|
||||
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
/// <summary>Computes the high-pressure inflow (replenishes the auxiliary reservoir from the main line).</summary>
|
||||
double GetHPFlow(double const HP, double const dt) /*override*/; // przeplyw - 8 bar
|
||||
double GetHPFlow(double HP, double dt) /*override*/; // przeplyw - 8 bar
|
||||
/// <summary>Returns the brake-cylinder reference pressure used by the ED brake controller (CVP-BCP * BVM).</summary>
|
||||
virtual double GetEDBCP(); // cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED w EP09
|
||||
/// <summary>Sets the ED brake state used to relax the pneumatic brake.</summary>
|
||||
/// <param name="EDstate">ED intensity (0..1).</param>
|
||||
virtual void SetED(double const EDstate); // stan hamulca ED do luzowania
|
||||
virtual void SetED(double EDstate); // stan hamulca ED do luzowania
|
||||
|
||||
/// <summary>Constructs the LSt distributor.</summary>
|
||||
inline TLSt(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TESt4R(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
|
||||
TLSt(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TESt4R(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -774,18 +774,18 @@ class TEStED : public TLSt
|
||||
|
||||
public:
|
||||
/// <summary>Initialises the EStED — sets up Miedzypoj, ImplsRes and the nozzle characteristics.</summary>
|
||||
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
|
||||
void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/;
|
||||
/// <summary>One-step distributor advance for EStED (full EP09 logic with intermediate reservoir).</summary>
|
||||
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
/// <summary>Returns ED-brake reference pressure (ImplsRes pressure scaled by load coefficient).</summary>
|
||||
double GetEDBCP() /*override*/; // cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED
|
||||
/// <summary>Recomputes LoadC for the current vehicle mass.</summary>
|
||||
void PLC(double const mass); // wspolczynnik cisnienia przystawki wazacej
|
||||
void PLC(double mass); // wspolczynnik cisnienia przystawki wazacej
|
||||
/// <summary>Stores the load-weighing parameters.</summary>
|
||||
void SetLP(double const TM, double const LM, double const TBP); // parametry przystawki wazacej
|
||||
void SetLP(double TM, double LM, double TBP); // parametry przystawki wazacej
|
||||
|
||||
/// <summary>Constructs the distributor and creates the intermediate reservoir.</summary>
|
||||
inline TEStED(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TLSt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
TEStED(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TLSt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
{
|
||||
Miedzypoj = std::make_shared<TReservoir>();
|
||||
}
|
||||
@@ -812,21 +812,21 @@ class TEStEP2 : public TLSt
|
||||
|
||||
public:
|
||||
/// <summary>Initialises the EP2-equipped distributor (impulse chamber, P delay).</summary>
|
||||
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/; // inicjalizacja
|
||||
void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/; // inicjalizacja
|
||||
/// <summary>One-step distributor advance with EP2 EP brake logic.</summary>
|
||||
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
/// <summary>Recomputes LoadC for the current vehicle mass.</summary>
|
||||
void PLC(double const mass); // wspolczynnik cisnienia przystawki wazacej
|
||||
void PLC(double mass); // wspolczynnik cisnienia przystawki wazacej
|
||||
/// <summary>Sets EP intensity; if EP is active and LBP < cylinder pressure, latches LBP from cylinder.</summary>
|
||||
void SetEPS(double const nEPS) /*override*/; // stan hamulca EP
|
||||
void SetEPS(double nEPS) /*override*/; // stan hamulca EP
|
||||
/// <summary>Stores the load-weighing parameters.</summary>
|
||||
void SetLP(double const TM, double const LM, double const TBP); // parametry przystawki wazacej
|
||||
void SetLP(double TM, double LM, double TBP); // parametry przystawki wazacej
|
||||
/// <summary>EP brake flow integration step. Override in EP1 for proportional control.</summary>
|
||||
/// <param name="dt">Time step [s].</param>
|
||||
void virtual EPCalc(double dt);
|
||||
|
||||
/// <summary>Constructs the EP2 distributor.</summary>
|
||||
inline TEStEP2(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TLSt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
|
||||
TEStEP2(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TLSt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -842,10 +842,10 @@ class TEStEP1 : public TEStEP2
|
||||
void EPCalc(double dt);
|
||||
/// <summary>Stores the EP intensity.</summary>
|
||||
/// <param name="nEPS">Target EP value (integer part = direction, fractional part = magnitude).</param>
|
||||
void SetEPS(double const nEPS) override; // stan hamulca EP
|
||||
void SetEPS(double nEPS) override; // stan hamulca EP
|
||||
|
||||
/// <summary>Constructs the EP1 distributor.</summary>
|
||||
inline TEStEP1(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TEStEP2(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
TEStEP1(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TEStEP2(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -867,24 +867,24 @@ class TCV1 : public TBrake
|
||||
|
||||
public:
|
||||
/// <summary>Initialises the CV1 distributor (sizes ZS, sets pressures, computes BVM).</summary>
|
||||
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
|
||||
void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/;
|
||||
/// <summary>One-step distributor advance for the CV1 baseline.</summary>
|
||||
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
/// <summary>Returns the control reservoir (ZS) pressure.</summary>
|
||||
double GetCRP() /*override*/;
|
||||
/// <summary>Updates BrakeStatus based on pre-chamber/cylinder/control reservoir relations and the releaser.</summary>
|
||||
/// <param name="BCP">Cylinder (or impulse) pressure.</param>
|
||||
/// <param name="dV1">In/out brake pipe flow correction.</param>
|
||||
void CheckState(double const BCP, double &dV1);
|
||||
void CheckState(double BCP, double &dV1);
|
||||
/// <summary>Returns the ZS-filling slide valve opening factor for the given cylinder pressure.</summary>
|
||||
double CVs(double const BP);
|
||||
double CVs(double BP);
|
||||
/// <summary>Returns the ZP-filling slide valve opening factor for the given cylinder pressure.</summary>
|
||||
double BVs(double const BCP);
|
||||
double BVs(double BCP);
|
||||
/// <summary>Vents valve, brake and control reservoirs to zero.</summary>
|
||||
void ForceEmptiness() /*override*/; // wymuszenie bycia pustym
|
||||
|
||||
/// <summary>Constructs the CV1 distributor and creates the control reservoir.</summary>
|
||||
inline TCV1(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
TCV1(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
{
|
||||
CntrlRes = std::make_shared<TReservoir>();
|
||||
}
|
||||
@@ -922,16 +922,16 @@ class TCV1L_TR : public TCV1
|
||||
|
||||
public:
|
||||
/// <summary>Initialises the CV1-L-TR (sizes the impulse chamber on top of CV1::Init).</summary>
|
||||
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
|
||||
void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/;
|
||||
/// <summary>One-step distributor advance for CV1-L-TR (impulse chamber + DCV).</summary>
|
||||
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
/// <summary>Sets the auxiliary brake target pressure for the DCV.</summary>
|
||||
void SetLBP(double const P); // cisnienie z hamulca pomocniczego
|
||||
void SetLBP(double P); // cisnienie z hamulca pomocniczego
|
||||
/// <summary>Computes the high-pressure (8 bar) inflow used to replenish the auxiliary reservoir.</summary>
|
||||
double GetHPFlow(double const HP, double const dt) /*override*/; // przeplyw - 8 bar
|
||||
double GetHPFlow(double HP, double dt) /*override*/; // przeplyw - 8 bar
|
||||
|
||||
/// <summary>Constructs the CV1-L-TR and creates the impulse chamber.</summary>
|
||||
inline TCV1L_TR(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TCV1(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
TCV1L_TR(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TCV1(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
{
|
||||
ImplsRes = std::make_shared<TReservoir>();
|
||||
}
|
||||
@@ -971,34 +971,34 @@ class TKE : public TBrake
|
||||
|
||||
public:
|
||||
/// <summary>Initialises the KE distributor (control / impulse / auxiliary reservoirs and BVM).</summary>
|
||||
void Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF) /*override*/;
|
||||
void Init(double PP, double HPP, double LPP, double BP, int BDF) /*override*/;
|
||||
/// <summary>Sets the rapid step ratio (RM = 1 - RMR).</summary>
|
||||
void SetRM(double const RMR); // ustalenie przelozenia rapida
|
||||
void SetRM(double RMR); // ustalenie przelozenia rapida
|
||||
/// <summary>One-step distributor advance for the KE distributor.</summary>
|
||||
double GetPF(double const PP, double const dt, double const Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
double GetPF(double PP, double dt, double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
|
||||
/// <summary>Computes the high-pressure (8 bar) inflow used to replenish the auxiliary reservoir.</summary>
|
||||
double GetHPFlow(double const HP, double const dt) /*override*/; // przeplyw - 8 bar
|
||||
double GetHPFlow(double HP, double dt) /*override*/; // przeplyw - 8 bar
|
||||
/// <summary>Returns the control reservoir (ZS) pressure.</summary>
|
||||
double GetCRP() /*override*/;
|
||||
/// <summary>Updates BrakeStatus from cylinder/pre-chamber/control reservoir pressures (KE-specific thresholds).</summary>
|
||||
void CheckState(double const BCP, double &dV1);
|
||||
void CheckState(double BCP, double &dV1);
|
||||
/// <summary>Drives the releaser logic for KE — bleeds the control reservoir while engaged.</summary>
|
||||
void CheckReleaser(double const dt); // odluzniacz
|
||||
void CheckReleaser(double dt); // odluzniacz
|
||||
/// <summary>ZS-filling slide valve opening factor for the given cylinder pressure.</summary>
|
||||
double CVs(double const BP); // napelniacz sterujacego
|
||||
double CVs(double BP); // napelniacz sterujacego
|
||||
/// <summary>ZP-filling slide valve opening factor for the given cylinder pressure.</summary>
|
||||
double BVs(double const BCP); // napelniacz pomocniczego
|
||||
double BVs(double BCP); // napelniacz pomocniczego
|
||||
/// <summary>Recomputes LoadC for the current vehicle mass.</summary>
|
||||
void PLC(double const mass); // wspolczynnik cisnienia przystawki wazacej
|
||||
void PLC(double mass); // wspolczynnik cisnienia przystawki wazacej
|
||||
/// <summary>Stores the load-weighing parameters.</summary>
|
||||
void SetLP(double const TM, double const LM, double const TBP); // parametry przystawki wazacej
|
||||
void SetLP(double TM, double LM, double TBP); // parametry przystawki wazacej
|
||||
/// <summary>Sets the auxiliary brake target pressure for the DCV.</summary>
|
||||
void SetLBP(double const P); // cisnienie z hamulca pomocniczego
|
||||
void SetLBP(double P); // cisnienie z hamulca pomocniczego
|
||||
/// <summary>Vents valve, brake, control, impulse and secondary auxiliary reservoirs to zero.</summary>
|
||||
void ForceEmptiness() /*override*/; // wymuszenie bycia pustym
|
||||
|
||||
/// <summary>Constructs the KE distributor and creates the control / impulse / secondary reservoirs.</summary>
|
||||
inline TKE(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
TKE(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa)
|
||||
{
|
||||
ImplsRes = std::make_shared<TReservoir>();
|
||||
CntrlRes = std::make_shared<TReservoir>();
|
||||
@@ -1085,7 +1085,7 @@ class TDriverHandle
|
||||
/// <param name="flag">Combined ub_* flags.</param>
|
||||
virtual void SetUniversalFlag(int flag); // przycisk uniwersalny
|
||||
/// <summary>Default constructor — clears the Sounds[] array.</summary>
|
||||
inline TDriverHandle()
|
||||
TDriverHandle()
|
||||
{
|
||||
memset(Sounds, 0, sizeof(Sounds));
|
||||
}
|
||||
@@ -1112,7 +1112,7 @@ class TFV4a : public TDriverHandle
|
||||
void Init(double Press) /*override*/;
|
||||
|
||||
/// <summary>Default constructor.</summary>
|
||||
inline TFV4a() : TDriverHandle() {}
|
||||
TFV4a() : TDriverHandle() {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -1163,7 +1163,7 @@ class TFV4aM : public TDriverHandle
|
||||
/// <summary>Returns the regulator pressure (5 + TP*0.08 + RedAdj).</summary>
|
||||
double GetRP();
|
||||
/// <summary>Default constructor.</summary>
|
||||
inline TFV4aM() : TDriverHandle() {}
|
||||
TFV4aM() : TDriverHandle() {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -1217,7 +1217,7 @@ class TMHZ_EN57 : public TDriverHandle
|
||||
/// <summary>Configures handle parameters (auto/manual overcharge, over-pressure, overcharge dynamics).</summary>
|
||||
void SetParams(bool AO, bool MO, double OverP, double, double OMP, double OPD);
|
||||
/// <summary>Default constructor.</summary>
|
||||
inline TMHZ_EN57(void) : TDriverHandle() {}
|
||||
TMHZ_EN57(void) : TDriverHandle() {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -1270,7 +1270,7 @@ class TMHZ_K5P : public TDriverHandle
|
||||
void SetParams(bool AO, bool MO, double, double, double OMP, double OPD); /*ovveride*/
|
||||
|
||||
/// <summary>Default constructor.</summary>
|
||||
inline TMHZ_K5P(void) : TDriverHandle() {}
|
||||
TMHZ_K5P(void) : TDriverHandle() {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -1323,7 +1323,7 @@ class TMHZ_6P : public TDriverHandle
|
||||
void SetParams(bool AO, bool MO, double, double, double OMP, double OPD); /*ovveride*/
|
||||
|
||||
/// <summary>Default constructor.</summary>
|
||||
inline TMHZ_6P(void) : TDriverHandle() {}
|
||||
TMHZ_6P(void) : TDriverHandle() {}
|
||||
};
|
||||
|
||||
/* FBS2= class(TTDriverHandle)
|
||||
@@ -1385,7 +1385,7 @@ class TM394 : public TDriverHandle
|
||||
double GetPos(int i) /*override*/;
|
||||
|
||||
/// <summary>Default constructor — sets the maximum handle position to 5.</summary>
|
||||
inline TM394(void) : TDriverHandle()
|
||||
TM394(void) : TDriverHandle()
|
||||
{
|
||||
i_bcpno = 5;
|
||||
}
|
||||
@@ -1424,7 +1424,7 @@ class TH14K1 : public TDriverHandle
|
||||
double GetPos(int i) /*override*/;
|
||||
|
||||
/// <summary>Default constructor — sets the maximum handle position to 4.</summary>
|
||||
inline TH14K1(void) : TDriverHandle()
|
||||
TH14K1(void) : TDriverHandle()
|
||||
{
|
||||
i_bcpno = 4;
|
||||
}
|
||||
@@ -1463,7 +1463,7 @@ class TSt113 : public TH14K1
|
||||
void Init(double Press) /*override*/;
|
||||
|
||||
/// <summary>Default constructor.</summary>
|
||||
inline TSt113(void) : TH14K1() {}
|
||||
TSt113(void) : TH14K1() {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -1484,7 +1484,7 @@ class Ttest : public TDriverHandle
|
||||
void Init(double Press) /*override*/;
|
||||
|
||||
/// <summary>Default constructor.</summary>
|
||||
inline Ttest(void) : TDriverHandle() {}
|
||||
Ttest(void) : TDriverHandle() {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -1515,7 +1515,7 @@ class TFD1 : public TDriverHandle
|
||||
// procedure Init(press: real; MaxBP: real); overload;
|
||||
|
||||
/// <summary>Default constructor.</summary>
|
||||
inline TFD1(void) : TDriverHandle() {}
|
||||
TFD1(void) : TDriverHandle() {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -1540,7 +1540,7 @@ class TH1405 : public TDriverHandle
|
||||
// procedure Init(press: real; MaxBP: real); overload;
|
||||
|
||||
/// <summary>Default constructor.</summary>
|
||||
inline TH1405(void) : TDriverHandle() {}
|
||||
TH1405(void) : TDriverHandle() {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -1574,7 +1574,7 @@ class TFVel6 : public TDriverHandle
|
||||
void Init(double Press) /*override*/;
|
||||
|
||||
/// <summary>Default constructor.</summary>
|
||||
inline TFVel6(void) : TDriverHandle() {}
|
||||
TFVel6(void) : TDriverHandle() {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -1609,7 +1609,7 @@ class TFVE408 : public TDriverHandle
|
||||
void Init(double Press) /*override*/;
|
||||
|
||||
/// <summary>Default constructor.</summary>
|
||||
inline TFVE408(void) : TDriverHandle() {}
|
||||
TFVE408(void) : TDriverHandle() {}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -1622,7 +1622,7 @@ class TFVE408 : public TDriverHandle
|
||||
/// <param name="S">Effective orifice cross-section.</param>
|
||||
/// <param name="DP">Soft-clip pressure delta — softens flow for tiny PH-PL differences (default 0.25).</param>
|
||||
/// <returns>Volumetric flow rate (signed; positive = P1->P2 direction).</returns>
|
||||
extern double PF(double const P1, double const P2, double const S, double const DP = 0.25);
|
||||
extern double PF(double P1, double P2, double S, double DP = 0.25);
|
||||
/// <summary>
|
||||
/// Variant of <see cref="PF"/> that uses the dimensionless pressure ratio (sg)
|
||||
/// for the soft-clip threshold instead of an absolute pressure delta.
|
||||
@@ -1631,7 +1631,7 @@ extern double PF(double const P1, double const P2, double const S, double const
|
||||
/// <param name="P2">Destination pressure [bar].</param>
|
||||
/// <param name="S">Effective orifice cross-section.</param>
|
||||
/// <returns>Volumetric flow rate.</returns>
|
||||
extern double PF1(double const P1, double const P2, double const S);
|
||||
extern double PF1(double P1, double P2, double S);
|
||||
|
||||
/// <summary>
|
||||
/// Filling valve flow: flows from PH to PL until PL reaches LIM. The valve
|
||||
@@ -1644,7 +1644,7 @@ extern double PF1(double const P1, double const P2, double const S);
|
||||
/// <param name="LIM">Target pressure for PL [bar].</param>
|
||||
/// <param name="DP">Throttling distance from LIM (default 0.1).</param>
|
||||
/// <returns>Flow rate from PH to PL (positive into PL).</returns>
|
||||
extern double PFVa(double PH, double PL, double const S, double LIM, double const DP = 0.1); // zawor napelniajacy z PH do PL, PL do LIM
|
||||
extern double PFVa(double PH, double PL, double S, double LIM, double DP = 0.1); // zawor napelniajacy z PH do PL, PL do LIM
|
||||
/// <summary>
|
||||
/// Venting valve flow: flows from PH to PL until PH falls to LIM. The valve
|
||||
/// throttles smoothly as PH approaches LIM. Returns 0 once PH <= LIM.
|
||||
@@ -1655,4 +1655,4 @@ extern double PFVa(double PH, double PL, double const S, double LIM, double cons
|
||||
/// <param name="LIM">Lower bound for PH [bar].</param>
|
||||
/// <param name="DP">Throttling distance from LIM (default 0.1).</param>
|
||||
/// <returns>Flow rate from PH to PL.</returns>
|
||||
extern double PFVd(double PH, double PL, double const S, double LIM, double const DP = 0.1); // zawor wypuszczajacy z PH do PL, PH do LIM
|
||||
extern double PFVd(double PH, double PL, double S, double LIM, double DP = 0.1); // zawor wypuszczajacy z PH do PL, PH do LIM
|
||||
|
||||
@@ -59,29 +59,29 @@ public:
|
||||
bool
|
||||
pop_mode();
|
||||
bool
|
||||
push_mode( mode const Mode );
|
||||
push_mode( mode Mode );
|
||||
void
|
||||
set_title( std::string const &Title );
|
||||
void
|
||||
set_progress( float const Progress = 0.f, float const Subtaskprogress = 0.f );
|
||||
set_progress( float Progress = 0.f, float Subtaskprogress = 0.f );
|
||||
void
|
||||
set_tooltip( std::string const &Tooltip );
|
||||
void
|
||||
set_cursor( int const Mode );
|
||||
set_cursor( int Mode );
|
||||
void
|
||||
set_cursor_pos( double const Horizontal, double const Vertical );
|
||||
set_cursor_pos( double Horizontal, double Vertical );
|
||||
void queue_screenshot();
|
||||
// input handlers
|
||||
void on_key( int const Key, int const Scancode, int const Action, int const Mods );
|
||||
void on_char( unsigned int const Char );
|
||||
void on_cursor_pos( double const Horizontal, double const Vertical );
|
||||
void on_mouse_button( int const Button, int const Action, int const Mods );
|
||||
void on_scroll( double const Xoffset, double const Yoffset );
|
||||
void on_key( int Key, int Scancode, int Action, int Mods );
|
||||
void on_char( unsigned int Char );
|
||||
void on_cursor_pos( double Horizontal, double Vertical );
|
||||
void on_mouse_button( int Button, int Action, int Mods );
|
||||
void on_scroll( double Xoffset, double Yoffset );
|
||||
void on_focus_change(bool focus);
|
||||
void on_window_resize(int w, int h);
|
||||
// gives access to specified window, creates a new window if index == -1
|
||||
GLFWwindow *
|
||||
window( int const Windowindex = 0, bool visible = false, int width = 1, int height = 1, GLFWmonitor *monitor = nullptr, bool keep_ownership = true, bool share_ctx = true );
|
||||
window( int Windowindex = 0, bool visible = false, int width = 1, int height = 1, GLFWmonitor *monitor = nullptr, bool keep_ownership = true, bool share_ctx = true );
|
||||
GLFWmonitor * find_monitor( const std::string &str ) const;
|
||||
std::string describe_monitor( GLFWmonitor *monitor ) const;
|
||||
// generate network sync verification number
|
||||
|
||||
@@ -24,20 +24,16 @@ public:
|
||||
// mode-specific update of simulation data. returns: false on error, true otherwise
|
||||
virtual bool update() = 0;
|
||||
// draws mode-specific user interface
|
||||
inline
|
||||
void render_ui() {
|
||||
void render_ui() {
|
||||
if( m_userinterface != nullptr ) {
|
||||
m_userinterface->render(); } }
|
||||
inline
|
||||
void begin_ui_frame() {
|
||||
if( m_userinterface != nullptr ) {
|
||||
m_userinterface->begin_ui_frame(); } }
|
||||
inline
|
||||
void set_progress( float const Progress = 0.f, float const Subtaskprogress = 0.f ) {
|
||||
void set_progress( float const Progress = 0.f, float const Subtaskprogress = 0.f ) {
|
||||
if( m_userinterface != nullptr ) {
|
||||
m_userinterface->set_progress( Progress, Subtaskprogress ); } }
|
||||
inline
|
||||
void set_tooltip( std::string const &Tooltip ) {
|
||||
void set_tooltip( std::string const &Tooltip ) {
|
||||
if( m_userinterface != nullptr ) {
|
||||
m_userinterface->set_tooltip( Tooltip ); } }
|
||||
// maintenance method, called when the mode is activated
|
||||
|
||||
@@ -86,18 +86,18 @@ private:
|
||||
std::string
|
||||
binding_hints( std::pair<user_command, user_command> const &Commands ) const;
|
||||
std::pair<user_command, user_command>
|
||||
command_fallback( user_command const Command ) const;
|
||||
command_fallback( user_command Command ) const;
|
||||
};
|
||||
|
||||
// methods
|
||||
void update_camera( const double Deltatime );
|
||||
void update_camera(double Deltatime );
|
||||
// handles vehicle change flag
|
||||
void OnKeyDown( int cKey );
|
||||
void InOutKey();
|
||||
void CabView();
|
||||
void ExternalView();
|
||||
void DistantView( bool const Near = false );
|
||||
void set_picking( bool const Picking );
|
||||
void DistantView( bool Near = false );
|
||||
void set_picking( bool Picking );
|
||||
|
||||
// members
|
||||
drivermode_input m_input;
|
||||
|
||||
@@ -30,13 +30,13 @@ public:
|
||||
void showDebugUI() override;
|
||||
// potentially processes provided input key. returns: true if the input was processed, false otherwise
|
||||
bool
|
||||
on_key( int const Key, int const Action ) override;
|
||||
on_key( int Key, int Action ) override;
|
||||
// potentially processes provided mouse movement. returns: true if the input was processed, false otherwise
|
||||
bool
|
||||
on_cursor_pos( double const Horizontal, double const Vertical ) override;
|
||||
on_cursor_pos( double Horizontal, double Vertical ) override;
|
||||
// potentially processes provided mouse button. returns: true if the input was processed, false otherwise
|
||||
bool
|
||||
on_mouse_button( int const Button, int const Action ) override;
|
||||
on_mouse_button( int Button, int Action ) override;
|
||||
// updates state of UI elements
|
||||
void
|
||||
update() override;
|
||||
@@ -49,7 +49,7 @@ private:
|
||||
// methods
|
||||
// sets visibility of the cursor
|
||||
void
|
||||
set_cursor( bool const Visible );
|
||||
set_cursor( bool Visible );
|
||||
// render() subclass details
|
||||
void
|
||||
render_() override;
|
||||
|
||||
@@ -93,7 +93,7 @@ private:
|
||||
void update_section_uart( std::vector<text_line> &Output );
|
||||
#endif
|
||||
// section update helpers
|
||||
std::string update_vehicle_coupler( int const Side );
|
||||
std::string update_vehicle_coupler( int Side );
|
||||
std::string update_vehicle_brake() const;
|
||||
// renders provided lines, under specified collapsing header
|
||||
bool render_section( std::string const &Header, std::vector<text_line> const &Lines );
|
||||
|
||||
@@ -48,19 +48,19 @@ namespace
|
||||
using vec3 = glm::vec3;
|
||||
using dvec2 = glm::dvec2;
|
||||
|
||||
inline bool is_release(int state)
|
||||
bool is_release(int state)
|
||||
{
|
||||
return state == GLFW_RELEASE;
|
||||
}
|
||||
|
||||
inline bool is_press(int state)
|
||||
bool is_press(int state)
|
||||
{
|
||||
return state == GLFW_PRESS;
|
||||
}
|
||||
|
||||
// tests whether the vertical line through (Px,Pz) passes over triangle abc; if so returns the
|
||||
// surface height at that point through OutY. used by the "snap to ground" (END) feature.
|
||||
inline bool triangle_height_at(glm::dvec3 const &a, glm::dvec3 const &b, glm::dvec3 const &c,
|
||||
bool triangle_height_at(glm::dvec3 const &a, glm::dvec3 const &b, glm::dvec3 const &c,
|
||||
double const Px, double const Pz, double &OutY)
|
||||
{
|
||||
double const ux = b.x - a.x, uz = b.z - a.z;
|
||||
|
||||
@@ -97,7 +97,7 @@ class editor_mode : public application_mode
|
||||
std::vector<EditorSnapshot> m_history; // history of changes to nodes, used for undo functionality
|
||||
std::vector<EditorSnapshot> g_redo;
|
||||
// methods
|
||||
void update_camera(double const Deltatime);
|
||||
void update_camera(double Deltatime);
|
||||
|
||||
editor_ui *ui() const;
|
||||
void redo_last();
|
||||
|
||||
@@ -61,7 +61,7 @@ class brush_object_list : public ui_panel
|
||||
std::string Template;
|
||||
|
||||
public:
|
||||
brush_object_list(std::string const &Name, bool const Isopen);
|
||||
brush_object_list(std::string const &Name, bool Isopen);
|
||||
void render() override;
|
||||
void update(std::string nodeTemplate);
|
||||
|
||||
@@ -85,7 +85,7 @@ class nodebank_panel : public ui_panel
|
||||
};
|
||||
edit_mode mode = MODIFY;
|
||||
|
||||
nodebank_panel(std::string const &Name, bool const Isopen);
|
||||
nodebank_panel(std::string const &Name, bool Isopen);
|
||||
void nodebank_reload();
|
||||
void render() override;
|
||||
void add_template(const std::string &desc);
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
create( std::string const &Filename );
|
||||
// provides direct access to a specified buffer
|
||||
openal_buffer const &
|
||||
buffer( buffer_handle const Buffer ) const;
|
||||
buffer( buffer_handle Buffer ) const;
|
||||
|
||||
private:
|
||||
// types
|
||||
|
||||
@@ -76,7 +76,7 @@ struct openal_source {
|
||||
play();
|
||||
// updates state of the source
|
||||
void
|
||||
update( double const Deltatime, glm::vec3 const &Listenervelocity );
|
||||
update( double Deltatime, glm::vec3 const &Listenervelocity );
|
||||
// configures state of the source to match the provided set of properties
|
||||
void
|
||||
sync_with( sound_properties const &State );
|
||||
@@ -85,13 +85,13 @@ struct openal_source {
|
||||
stop();
|
||||
// toggles looping of the sound emitted by the source
|
||||
void
|
||||
loop( bool const State );
|
||||
loop( bool State );
|
||||
// sets max audible distance for sounds emitted by the source
|
||||
void
|
||||
range( float const Range );
|
||||
range( float Range );
|
||||
// sets modifier applied to the pitch of sounds emitted by the source
|
||||
void
|
||||
pitch( float const Pitch );
|
||||
pitch( float Pitch );
|
||||
// releases bound buffers and resets state of the class variables
|
||||
// NOTE: doesn't release allocated implementation-side source
|
||||
void
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
fetch_buffer( std::string const &Filename );
|
||||
// provides direct access to a specified buffer
|
||||
openal_buffer const &
|
||||
buffer( buffer_handle const Buffer ) const;
|
||||
buffer( buffer_handle Buffer ) const;
|
||||
// core methods
|
||||
// initializes the service
|
||||
bool
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
erase( sound_source const *Controller );
|
||||
// updates state of all active emitters
|
||||
void
|
||||
update( double const Deltatime );
|
||||
update( double Deltatime );
|
||||
|
||||
glm::dvec3 cached_camerapos;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class sound_source {
|
||||
|
||||
public:
|
||||
// constructors
|
||||
sound_source( sound_placement const Placement = sound_placement::general, float const Range = 50.f );
|
||||
sound_source( sound_placement Placement = sound_placement::general, float Range = 50.f );
|
||||
|
||||
// destructor
|
||||
~sound_source();
|
||||
@@ -66,9 +66,9 @@ public:
|
||||
// methods
|
||||
// restores state of the class from provided data stream
|
||||
sound_source &
|
||||
deserialize( cParser &Input, sound_type const Legacytype, int const Legacyparameters = 0, int const Chunkrange = 100 );
|
||||
deserialize( cParser &Input, sound_type Legacytype, int Legacyparameters = 0, int Chunkrange = 100 );
|
||||
sound_source &
|
||||
deserialize( std::string const &Input, sound_type const Legacytype, int const Legacyparameters = 0 );
|
||||
deserialize( std::string const &Input, sound_type Legacytype, int Legacyparameters = 0 );
|
||||
// sends content of the class in legacy (text) format to provided stream
|
||||
void
|
||||
export_as_text( std::ostream &Output ) const;
|
||||
@@ -77,25 +77,25 @@ public:
|
||||
copy_sounds( sound_source const &Source );
|
||||
// issues contextual play commands for the audio renderer
|
||||
void
|
||||
play( int const Flags = 0 );
|
||||
play( int Flags = 0 );
|
||||
// maintains playback of sounds started by event
|
||||
void
|
||||
play_event();
|
||||
// stops currently active play commands controlled by this emitter
|
||||
void
|
||||
stop( bool const Skipend = false );
|
||||
stop( bool Skipend = false );
|
||||
// adjusts parameters of provided implementation-side sound source
|
||||
void
|
||||
update( audio::openal_source &Source );
|
||||
// sets base volume of the emiter to specified value
|
||||
sound_source &
|
||||
gain( float const Gain );
|
||||
gain( float Gain );
|
||||
// returns current base volume of the emitter
|
||||
float
|
||||
gain() const;
|
||||
// sets base pitch of the emitter to specified value
|
||||
sound_source &
|
||||
pitch( float const Pitch );
|
||||
pitch( float Pitch );
|
||||
// owner setter/getter
|
||||
void
|
||||
owner( TDynamicObject const *Owner );
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
owner() const;
|
||||
// sound source offset setter/getter
|
||||
void
|
||||
offset( glm::vec3 const Offset );
|
||||
offset( glm::vec3 Offset );
|
||||
glm::vec3 const &
|
||||
offset() const;
|
||||
// sound source name setter/getter
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
name() const;
|
||||
// playback starting point shift setter/getter
|
||||
void
|
||||
start( float const Offset );
|
||||
start( float Offset );
|
||||
float const &
|
||||
start() const;
|
||||
// custom soundproofing setter/getter
|
||||
@@ -126,13 +126,13 @@ public:
|
||||
empty() const;
|
||||
// returns true if the source is emitting any sound; by default doesn't take into account optional ending soudnds
|
||||
bool
|
||||
is_playing( bool const Includesoundends = false ) const;
|
||||
is_playing( bool Includesoundends = false ) const;
|
||||
// returns true if the source uses sample table
|
||||
bool
|
||||
is_combined() const;
|
||||
// returns true if specified buffer is one of the optional bookends
|
||||
bool
|
||||
is_bookend( audio::buffer_handle const Buffer ) const;
|
||||
is_bookend( audio::buffer_handle Buffer ) const;
|
||||
// returns true if the source has optional bookends
|
||||
bool
|
||||
has_bookends() const;
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
location() const;
|
||||
// returns defined range of the sound
|
||||
void
|
||||
range( float const Range );
|
||||
range( float Range );
|
||||
float const
|
||||
range() const;
|
||||
|
||||
@@ -196,16 +196,16 @@ private:
|
||||
void
|
||||
update_combined( audio::openal_source &Source );
|
||||
void
|
||||
update_crossfade( sound_handle const Chunk );
|
||||
update_crossfade( sound_handle Chunk );
|
||||
void
|
||||
update_counter( sound_handle const Sound, int const Value );
|
||||
update_counter( sound_handle Sound, int Value );
|
||||
void
|
||||
update_location();
|
||||
// potentially updates area-based gain factor of the source. returns: true if location has changed
|
||||
bool
|
||||
update_soundproofing();
|
||||
void
|
||||
insert( sound_handle const Sound );
|
||||
insert( sound_handle Sound );
|
||||
template <class Iterator_>
|
||||
void
|
||||
insert( Iterator_ First, Iterator_ Last ) {
|
||||
@@ -219,9 +219,9 @@ private:
|
||||
sounds.emplace_back( soundhandle ); } );
|
||||
audio::renderer.insert( std::begin( buffers ), std::end( buffers ), this, sounds ); }
|
||||
sound_data &
|
||||
sound( sound_handle const Sound );
|
||||
sound( sound_handle Sound );
|
||||
sound_data const &
|
||||
sound( sound_handle const Sound ) const;
|
||||
sound( sound_handle Sound ) const;
|
||||
|
||||
// members
|
||||
TDynamicObject const * m_owner { nullptr }; // optional, the vehicle carrying this sound source
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
|
||||
// methods:
|
||||
void init();
|
||||
void update( bool const Includephase = false );
|
||||
void update( bool Includephase = false );
|
||||
void render();
|
||||
// returns vector pointing at the sun
|
||||
glm::vec3 getDirection() const;
|
||||
@@ -22,13 +22,13 @@ public:
|
||||
// returns current phase of the moon
|
||||
float getPhase() const { return m_phase; }
|
||||
// sets current time, overriding one acquired from the system clock
|
||||
void setTime( int const Hour, int const Minute, int const Second );
|
||||
void setTime( int Hour, int Minute, int Second );
|
||||
// sets current geographic location
|
||||
void setLocation( float const Longitude, float const Latitude );
|
||||
void setLocation( float Longitude, float Latitude );
|
||||
// sets ambient temperature in degrees C.
|
||||
void setTemperature( float const Temperature );
|
||||
void setTemperature( float Temperature );
|
||||
// sets surface pressure in milibars
|
||||
void setPressure( float const Pressure );
|
||||
void setPressure( float Pressure );
|
||||
|
||||
// constructors:
|
||||
cMoon();
|
||||
@@ -50,7 +50,7 @@ protected:
|
||||
void irradiance();
|
||||
void phase();
|
||||
// helper, normalize values to range 0...1
|
||||
float normalize( const float Value ) const;
|
||||
float normalize(float Value ) const;
|
||||
|
||||
// members:
|
||||
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
|
||||
class CSkyDome {
|
||||
public:
|
||||
CSkyDome( int const Tesselation = 54 );
|
||||
CSkyDome( int Tesselation = 54 );
|
||||
~CSkyDome();
|
||||
void Generate();
|
||||
void RebuildColors();
|
||||
|
||||
bool SetSunPosition( glm::vec3 const &Direction );
|
||||
|
||||
void SetTurbidity( const float Turbidity = 5.0f );
|
||||
void SetExposure( const bool Linearexposure, const float Expfactor );
|
||||
void SetOvercastFactor( const float Overcast = 0.0f );
|
||||
void SetTurbidity(float Turbidity = 5.0f );
|
||||
void SetExposure(bool Linearexposure, float Expfactor );
|
||||
void SetOvercastFactor(float Overcast = 0.0f );
|
||||
|
||||
// update skydome
|
||||
void Update( glm::vec3 const &Sun );
|
||||
@@ -59,9 +59,9 @@ private:
|
||||
static float m_zenithymatrix[ 3 ][ 4 ];
|
||||
|
||||
// coloring
|
||||
void GetPerez( float *Perez, float Distribution[ 5 ][ 2 ], const float Turbidity );
|
||||
float GetZenith( float Zenithmatrix[ 3 ][ 4 ], const float Theta, const float Turbidity );
|
||||
float PerezFunctionO1( float Perezcoeffs[ 5 ], const float Thetasun, const float Zenithval );
|
||||
float PerezFunctionO2( float Perezcoeffs[ 5 ], const float Icostheta, const float Gamma, const float Cosgamma2, const float Zenithval );
|
||||
void GetPerez( float *Perez, float Distribution[ 5 ][ 2 ], float Turbidity );
|
||||
float GetZenith( float Zenithmatrix[ 3 ][ 4 ], float Theta, float Turbidity );
|
||||
float PerezFunctionO1( float Perezcoeffs[ 5 ], float Thetasun, float Zenithval );
|
||||
float PerezFunctionO2( float Perezcoeffs[ 5 ], float Icostheta, float Gamma, float Cosgamma2, float Zenithval );
|
||||
};
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ public:
|
||||
// returns current intensity of the sun
|
||||
float getIntensity();
|
||||
// sets current time, overriding one acquired from the system clock
|
||||
void setTime( int const Hour, int const Minute, int const Second );
|
||||
void setTime( int Hour, int Minute, int Second );
|
||||
// sets current geographic location
|
||||
void setLocation( float const Longitude, float const Latitude );
|
||||
void setLocation( float Longitude, float Latitude );
|
||||
// sets ambient temperature in degrees C.
|
||||
void setTemperature( float const Temperature );
|
||||
void setTemperature( float Temperature );
|
||||
// sets surface pressure in milibars
|
||||
void setPressure( float const Pressure );
|
||||
void setPressure( float Pressure );
|
||||
|
||||
// constructors:
|
||||
cSun();
|
||||
|
||||
@@ -10,17 +10,17 @@ namespace gl
|
||||
GLuint id = 0;
|
||||
|
||||
public:
|
||||
inline operator GLuint() const
|
||||
operator GLuint() const
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
inline operator GLuint* const()
|
||||
operator GLuint* const()
|
||||
{
|
||||
return &id;
|
||||
}
|
||||
|
||||
inline operator const GLuint* const() const
|
||||
operator const GLuint* const() const
|
||||
{
|
||||
return &id;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace ImGuizmo
|
||||
|
||||
// Render a cube with face color corresponding to face normal. Usefull for debug/tests
|
||||
IMGUI_API void DrawCubes(const float* view, const float* projection, const float* matrices, int matrixCount);
|
||||
IMGUI_API void DrawGrid(const float* view, const float* projection, const float* matrix, const float gridSize);
|
||||
IMGUI_API void DrawGrid(const float* view, const float* projection, const float* matrix, float gridSize);
|
||||
|
||||
// call it when you want a gizmo
|
||||
// Needs view and projection matrices.
|
||||
|
||||
122
imgui/imgui.h
122
imgui/imgui.h
@@ -1240,63 +1240,63 @@ struct ImVector
|
||||
typedef const value_type* const_iterator;
|
||||
|
||||
// Constructors, destructor
|
||||
inline ImVector() { Size = Capacity = 0; Data = NULL; }
|
||||
inline ImVector(const ImVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
|
||||
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }
|
||||
inline ~ImVector() { if (Data) IM_FREE(Data); }
|
||||
ImVector() { Size = Capacity = 0; Data = NULL; }
|
||||
ImVector(const ImVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
|
||||
ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }
|
||||
~ImVector() { if (Data) IM_FREE(Data); }
|
||||
|
||||
inline bool empty() const { return Size == 0; }
|
||||
inline int size() const { return Size; }
|
||||
inline int size_in_bytes() const { return Size * (int)sizeof(T); }
|
||||
inline int capacity() const { return Capacity; }
|
||||
inline T& operator[](int i) { IM_ASSERT(i < Size); return Data[i]; }
|
||||
inline const T& operator[](int i) const { IM_ASSERT(i < Size); return Data[i]; }
|
||||
bool empty() const { return Size == 0; }
|
||||
int size() const { return Size; }
|
||||
int size_in_bytes() const { return Size * (int)sizeof(T); }
|
||||
int capacity() const { return Capacity; }
|
||||
T & operator[](int i) { IM_ASSERT(i < Size); return Data[i]; }
|
||||
const T& operator[](int i) const { IM_ASSERT(i < Size); return Data[i]; }
|
||||
|
||||
inline void clear() { if (Data) { Size = Capacity = 0; IM_FREE(Data); Data = NULL; } }
|
||||
inline T* begin() { return Data; }
|
||||
inline const T* begin() const { return Data; }
|
||||
inline T* end() { return Data + Size; }
|
||||
inline const T* end() const { return Data + Size; }
|
||||
inline T& front() { IM_ASSERT(Size > 0); return Data[0]; }
|
||||
inline const T& front() const { IM_ASSERT(Size > 0); return Data[0]; }
|
||||
inline T& back() { IM_ASSERT(Size > 0); return Data[Size - 1]; }
|
||||
inline const T& back() const { IM_ASSERT(Size > 0); return Data[Size - 1]; }
|
||||
inline void swap(ImVector<T>& rhs) {
|
||||
void clear() { if (Data) { Size = Capacity = 0; IM_FREE(Data); Data = NULL; } }
|
||||
T * begin() { return Data; }
|
||||
const T* begin() const { return Data; }
|
||||
T * end() { return Data + Size; }
|
||||
const T* end() const { return Data + Size; }
|
||||
T & front() { IM_ASSERT(Size > 0); return Data[0]; }
|
||||
const T& front() const { IM_ASSERT(Size > 0); return Data[0]; }
|
||||
T & back() { IM_ASSERT(Size > 0); return Data[Size - 1]; }
|
||||
const T& back() const { IM_ASSERT(Size > 0); return Data[Size - 1]; }
|
||||
void swap(ImVector<T>& rhs) {
|
||||
const int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size;
|
||||
const int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; T* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; }
|
||||
|
||||
inline int _grow_capacity(int sz) const {
|
||||
int _grow_capacity(int sz) const {
|
||||
const int new_capacity = Capacity ? (Capacity + Capacity/2) : 8; return new_capacity > sz ? new_capacity : sz; }
|
||||
inline void resize(int new_size) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; }
|
||||
inline void resize(int new_size, const T& v) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) memcpy(&Data[n], &v, sizeof(v)); Size = new_size; }
|
||||
inline void reserve(int new_capacity) { if (new_capacity <= Capacity) return; T* new_data = (T*)IM_ALLOC((size_t)new_capacity * sizeof(T)); if (Data) { memcpy(new_data, Data, (size_t)Size * sizeof(T)); IM_FREE(Data); } Data = new_data; Capacity = new_capacity; }
|
||||
void resize(int new_size) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; }
|
||||
void resize(int new_size, const T& v) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) memcpy(&Data[n], &v, sizeof(v)); Size = new_size; }
|
||||
void reserve(int new_capacity) { if (new_capacity <= Capacity) return; T* new_data = (T*)IM_ALLOC((size_t)new_capacity * sizeof(T)); if (Data) { memcpy(new_data, Data, (size_t)Size * sizeof(T)); IM_FREE(Data); } Data = new_data; Capacity = new_capacity; }
|
||||
|
||||
// NB: It is illegal to call push_back/push_front/insert with a reference pointing inside the ImVector data itself! e.g. v.push_back(v[10]) is forbidden.
|
||||
inline void push_back(const T& v) { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v, sizeof(v)); Size++; }
|
||||
inline void pop_back() { IM_ASSERT(Size > 0); Size--; }
|
||||
inline void push_front(const T& v) { if (Size == 0) push_back(v); else insert(Data, v); }
|
||||
inline T* erase(const T* it) { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(T)); Size--; return Data + off; }
|
||||
inline T* erase(const T* it, const T* it_last){ IM_ASSERT(it >= Data && it < Data+Size && it_last > it && it_last <= Data+Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - count) * sizeof(T)); Size -= (int)count; return Data + off; }
|
||||
inline T* erase_unsorted(const T* it) { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; if (it < Data+Size-1) memcpy(Data + off, Data + Size - 1, sizeof(T)); Size--; return Data + off; }
|
||||
inline T* insert(const T* it, const T& v) { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(T)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; }
|
||||
inline bool contains(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; }
|
||||
inline T* find(const T& v) { T* data = Data; const T* data_end = Data + Size; while (data < data_end)
|
||||
void push_back(const T& v) { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v, sizeof(v)); Size++; }
|
||||
void pop_back() { IM_ASSERT(Size > 0); Size--; }
|
||||
void push_front(const T& v) { if (Size == 0) push_back(v); else insert(Data, v); }
|
||||
T * erase(const T* it) { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(T)); Size--; return Data + off; }
|
||||
T * erase(const T* it, const T* it_last){ IM_ASSERT(it >= Data && it < Data+Size && it_last > it && it_last <= Data+Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - count) * sizeof(T)); Size -= (int)count; return Data + off; }
|
||||
T * erase_unsorted(const T* it) { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; if (it < Data+Size-1) memcpy(Data + off, Data + Size - 1, sizeof(T)); Size--; return Data + off; }
|
||||
T * insert(const T* it, const T& v) { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(T)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; }
|
||||
bool contains(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; }
|
||||
T * find(const T& v) { T* data = Data; const T* data_end = Data + Size; while (data < data_end)
|
||||
{
|
||||
if (*data == v)
|
||||
break;
|
||||
++data;
|
||||
}
|
||||
return data; }
|
||||
inline const T* find(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end)
|
||||
const T* find(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end)
|
||||
{
|
||||
if (*data == v)
|
||||
break;
|
||||
++data;
|
||||
}
|
||||
return data; }
|
||||
inline bool find_erase(const T& v) { const T* it = find(v); if (it < Data + Size) { erase(it); return true; } return false; }
|
||||
inline bool find_erase_unsorted(const T& v) { const T* it = find(v); if (it < Data + Size) { erase_unsorted(it); return true; } return false; }
|
||||
inline int index_from_ptr(const T* it) const { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; return (int)off; }
|
||||
bool find_erase(const T& v) { const T* it = find(v); if (it < Data + Size) { erase(it); return true; } return false; }
|
||||
bool find_erase_unsorted(const T& v) { const T* it = find(v); if (it < Data + Size) { erase_unsorted(it); return true; } return false; }
|
||||
int index_from_ptr(const T* it) const { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; return (int)off; }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -1650,7 +1650,7 @@ struct ImGuiTextBuffer
|
||||
IMGUI_API static char EmptyString[1];
|
||||
|
||||
ImGuiTextBuffer() { }
|
||||
inline char operator[](int i) { IM_ASSERT(Buf.Data != NULL); return Buf.Data[i]; }
|
||||
char operator[](int i) { IM_ASSERT(Buf.Data != NULL); return Buf.Data[i]; }
|
||||
const char* begin() const { return Buf.Data ? &Buf.front() : EmptyString; }
|
||||
const char* end() const { return Buf.Data ? &Buf.back() : EmptyString; } // Buf is zero-terminated, so end() will point on the zero-terminator
|
||||
int size() const { return Buf.Size ? Buf.Size - 1 : 0; }
|
||||
@@ -1778,11 +1778,11 @@ struct ImColor
|
||||
const float sc = 1.0f/255.0f; Value.x = (float)((rgba>>IM_COL32_R_SHIFT)&0xFF) * sc; Value.y = (float)((rgba>>IM_COL32_G_SHIFT)&0xFF) * sc; Value.z = (float)((rgba>>IM_COL32_B_SHIFT)&0xFF) * sc; Value.w = (float)((rgba>>IM_COL32_A_SHIFT)&0xFF) * sc; }
|
||||
ImColor(float r, float g, float b, float a = 1.0f) { Value.x = r; Value.y = g; Value.z = b; Value.w = a; }
|
||||
ImColor(const ImVec4& col) { Value = col; }
|
||||
inline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); }
|
||||
inline operator ImVec4() const { return Value; }
|
||||
operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); }
|
||||
operator ImVec4() const { return Value; }
|
||||
|
||||
// FIXME-OBSOLETE: May need to obsolete/cleanup those helpers.
|
||||
inline void SetHSV(float h, float s, float v, float a = 1.0f){ ImGui::ColorConvertHSVtoRGB(h, s, v, Value.x, Value.y, Value.z); Value.w = a; }
|
||||
void SetHSV(float h, float s, float v, float a = 1.0f){ ImGui::ColorConvertHSVtoRGB(h, s, v, Value.x, Value.y, Value.z); Value.w = a; }
|
||||
static ImColor HSV(float h, float s, float v, float a = 1.0f) { float r,g,b; ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); return ImColor(r,g,b,a); }
|
||||
};
|
||||
|
||||
@@ -1862,9 +1862,9 @@ struct ImDrawListSplitter
|
||||
int _Count; // Number of active channels (1+)
|
||||
ImVector<ImDrawChannel> _Channels; // Draw channels (not resized down so _Count might be < Channels.Size)
|
||||
|
||||
inline ImDrawListSplitter() { Clear(); }
|
||||
inline ~ImDrawListSplitter() { ClearFreeMemory(); }
|
||||
inline void Clear() { _Current = 0; _Count = 1; } // Do not clear Channels[] so our allocations are reused next frame
|
||||
ImDrawListSplitter() { Clear(); }
|
||||
~ImDrawListSplitter() { ClearFreeMemory(); }
|
||||
void Clear() { _Current = 0; _Count = 1; } // Do not clear Channels[] so our allocations are reused next frame
|
||||
IMGUI_API void ClearFreeMemory();
|
||||
IMGUI_API void Split(ImDrawList* draw_list, int count);
|
||||
IMGUI_API void Merge(ImDrawList* draw_list);
|
||||
@@ -1929,8 +1929,8 @@ struct ImDrawList
|
||||
IMGUI_API void PopClipRect();
|
||||
IMGUI_API void PushTextureID(ImTextureID texture_id);
|
||||
IMGUI_API void PopTextureID();
|
||||
inline ImVec2 GetClipRectMin() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.x, cr.y); }
|
||||
inline ImVec2 GetClipRectMax() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.z, cr.w); }
|
||||
ImVec2 GetClipRectMin() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.x, cr.y); }
|
||||
ImVec2 GetClipRectMax() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.z, cr.w); }
|
||||
|
||||
// Primitives
|
||||
// - For rectangular primitives, "p_min" and "p_max" represent the upper-left and lower-right corners.
|
||||
@@ -1959,11 +1959,11 @@ struct ImDrawList
|
||||
IMGUI_API void AddImageRounded(ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col, float rounding, ImDrawCornerFlags rounding_corners = ImDrawCornerFlags_All);
|
||||
|
||||
// Stateful path API, add points then finish with PathFillConvex() or PathStroke()
|
||||
inline void PathClear() { _Path.Size = 0; }
|
||||
inline void PathLineTo(const ImVec2& pos) { _Path.push_back(pos); }
|
||||
inline void PathLineToMergeDuplicate(const ImVec2& pos) { if (_Path.Size == 0 || memcmp(&_Path.Data[_Path.Size-1], &pos, 8) != 0) _Path.push_back(pos); }
|
||||
inline void PathFillConvex(ImU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col); _Path.Size = 0; } // Note: Anti-aliased filling requires points to be in clockwise order.
|
||||
inline void PathStroke(ImU32 col, bool closed, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness); _Path.Size = 0; }
|
||||
void PathClear() { _Path.Size = 0; }
|
||||
void PathLineTo(const ImVec2& pos) { _Path.push_back(pos); }
|
||||
void PathLineToMergeDuplicate(const ImVec2& pos) { if (_Path.Size == 0 || memcmp(&_Path.Data[_Path.Size-1], &pos, 8) != 0) _Path.push_back(pos); }
|
||||
void PathFillConvex(ImU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col); _Path.Size = 0; } // Note: Anti-aliased filling requires points to be in clockwise order.
|
||||
void PathStroke(ImU32 col, bool closed, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness); _Path.Size = 0; }
|
||||
IMGUI_API void PathArcTo(const ImVec2& center, float radius, float a_min, float a_max, int num_segments = 10);
|
||||
IMGUI_API void PathArcToFast(const ImVec2& center, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle
|
||||
IMGUI_API void PathBezierCurveTo(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, int num_segments = 0);
|
||||
@@ -1977,9 +1977,9 @@ struct ImDrawList
|
||||
// Advanced: Channels
|
||||
// - Use to split render into layers. By switching channels to can render out-of-order (e.g. submit foreground primitives before background primitives)
|
||||
// - Use to minimize draw calls (e.g. if going back-and-forth between multiple non-overlapping clipping rectangles, prefer to append into separate channels then merge at the end)
|
||||
inline void ChannelsSplit(int count) { _Splitter.Split(this, count); }
|
||||
inline void ChannelsMerge() { _Splitter.Merge(this); }
|
||||
inline void ChannelsSetCurrent(int n) { _Splitter.SetCurrentChannel(this, n); }
|
||||
void ChannelsSplit(int count) { _Splitter.Split(this, count); }
|
||||
void ChannelsMerge() { _Splitter.Merge(this); }
|
||||
void ChannelsSetCurrent(int n) { _Splitter.SetCurrentChannel(this, n); }
|
||||
|
||||
// Internal helpers
|
||||
// NB: all primitives needs to be reserved via PrimReserve() beforehand!
|
||||
@@ -1989,9 +1989,9 @@ struct ImDrawList
|
||||
IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles)
|
||||
IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col);
|
||||
IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col);
|
||||
inline void PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col){ _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; }
|
||||
inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; }
|
||||
inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); }
|
||||
void PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col){ _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; }
|
||||
void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; }
|
||||
void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); }
|
||||
IMGUI_API void UpdateClipRect();
|
||||
IMGUI_API void UpdateTextureID();
|
||||
};
|
||||
@@ -2064,15 +2064,15 @@ struct ImFontGlyphRangesBuilder
|
||||
ImVector<ImU32> UsedChars; // Store 1-bit per Unicode code point (0=unused, 1=used)
|
||||
|
||||
ImFontGlyphRangesBuilder() { Clear(); }
|
||||
inline void Clear() {
|
||||
void Clear() {
|
||||
const int size_in_bytes = 0x10000 / 8; UsedChars.resize(size_in_bytes / (int)sizeof(ImU32)); memset(UsedChars.Data, 0, (size_t)size_in_bytes); }
|
||||
inline bool GetBit(int n) const {
|
||||
bool GetBit(int n) const {
|
||||
const int off = (n >> 5);
|
||||
const ImU32 mask = 1u << (n & 31); return (UsedChars[off] & mask) != 0; } // Get bit n in the array
|
||||
inline void SetBit(int n) {
|
||||
void SetBit(int n) {
|
||||
const int off = (n >> 5);
|
||||
const ImU32 mask = 1u << (n & 31); UsedChars[off] |= mask; } // Set bit n in the array
|
||||
inline void AddChar(ImWchar c) { SetBit(c); } // Add character
|
||||
void AddChar(ImWchar c) { SetBit(c); } // Add character
|
||||
IMGUI_API void AddText(const char* text, const char* text_end = NULL); // Add string (each character of the UTF-8 string are added)
|
||||
IMGUI_API void AddRanges(const ImWchar* ranges); // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault()) to force add all of ASCII/Latin+Ext
|
||||
IMGUI_API void BuildRanges(ImVector<ImWchar>* out_ranges); // Output new ranges
|
||||
|
||||
@@ -815,7 +815,7 @@ struct ImGuiNextWindowData
|
||||
ImVec2 MenuBarOffsetMinVal; // *Always on* This is not exposed publicly, so we don't clear it.
|
||||
|
||||
ImGuiNextWindowData() { memset(this, 0, sizeof(*this)); }
|
||||
inline void ClearFlags() { Flags = ImGuiNextWindowDataFlags_None; }
|
||||
void ClearFlags() { Flags = ImGuiNextWindowDataFlags_None; }
|
||||
};
|
||||
|
||||
enum ImGuiNextItemDataFlags_
|
||||
@@ -833,7 +833,7 @@ struct ImGuiNextItemData
|
||||
ImGuiCond OpenCond;
|
||||
|
||||
ImGuiNextItemData() { memset(this, 0, sizeof(*this)); }
|
||||
inline void ClearFlags() { Flags = ImGuiNextItemDataFlags_None; }
|
||||
void ClearFlags() { Flags = ImGuiNextItemDataFlags_None; }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -460,16 +460,16 @@ public:
|
||||
// methods
|
||||
// posts specified command for specified recipient into m_intercept_queue
|
||||
void
|
||||
push( command_data const &Command, uint32_t const Recipient );
|
||||
push( command_data const &Command, uint32_t Recipient );
|
||||
// retrieves oldest posted command for specified recipient, if any. returns: true on retrieval, false if there's nothing to retrieve
|
||||
bool
|
||||
pop( command_data &Command, uint32_t const Recipient );
|
||||
pop( command_data &Command, uint32_t Recipient );
|
||||
// generates active continuous commands
|
||||
void
|
||||
update();
|
||||
// checks if given command must be scheduled on server
|
||||
bool
|
||||
is_network_target(const uint32_t Recipient);
|
||||
is_network_target(uint32_t Recipient);
|
||||
|
||||
// pops commands from intercept queue
|
||||
commands_map pop_intercept_queue();
|
||||
@@ -485,7 +485,7 @@ private:
|
||||
// contains intercepted commands to be read by application layer
|
||||
commands_map m_intercept_queue;
|
||||
|
||||
void push_direct( command_data const &Command, uint32_t const Recipient );
|
||||
void push_direct( command_data const &Command, uint32_t Recipient );
|
||||
|
||||
// hash operator for m_active_continuous
|
||||
struct command_set_hash {
|
||||
@@ -528,8 +528,8 @@ public:
|
||||
// methods
|
||||
// posts specified command for the specified recipient
|
||||
void
|
||||
post(user_command const Command, double const Param1, double const Param2,
|
||||
int const Action, uint16_t Recipient, glm::vec3 Position = glm::vec3(0.0f) , const std::string *Payload = nullptr) const;
|
||||
post(user_command Command, double Param1, double Param2,
|
||||
int Action, uint16_t Recipient, glm::vec3 Position = glm::vec3(0.0f) , const std::string *Payload = nullptr) const;
|
||||
private:
|
||||
// types
|
||||
// members
|
||||
|
||||
@@ -24,9 +24,8 @@ public:
|
||||
void
|
||||
release();
|
||||
void
|
||||
on_move( double const Mousex, double const Mousey );
|
||||
inline
|
||||
user_command
|
||||
on_move( double Mousex, double Mousey );
|
||||
user_command
|
||||
command() const {
|
||||
return m_command; }
|
||||
double
|
||||
@@ -55,13 +54,13 @@ public:
|
||||
bool
|
||||
recall_bindings();
|
||||
void
|
||||
button( int const Button, int const Action );
|
||||
button( int Button, int Action );
|
||||
int
|
||||
button( int const Button ) const;
|
||||
button( int Button ) const;
|
||||
void
|
||||
move( double const Horizontal, double const Vertical );
|
||||
move( double Horizontal, double Vertical );
|
||||
void
|
||||
scroll( double const Xoffset, double const Yoffset );
|
||||
scroll( double Xoffset, double Yoffset );
|
||||
void
|
||||
poll();
|
||||
user_command
|
||||
|
||||
@@ -21,15 +21,13 @@ public:
|
||||
bool
|
||||
init();
|
||||
void
|
||||
position( double const Horizontal, double const Vertical );
|
||||
inline
|
||||
glm::dvec2
|
||||
position( double Horizontal, double Vertical );
|
||||
glm::dvec2
|
||||
position() const {
|
||||
return m_cursorposition; }
|
||||
void
|
||||
button( int const Button, int const Action );
|
||||
inline
|
||||
int
|
||||
button( int Button, int Action );
|
||||
int
|
||||
button( int const Button ) const {
|
||||
return m_buttons[ Button ]; }
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@ private:
|
||||
using inputaxis_sequence = std::vector<input_axis>;
|
||||
// methods
|
||||
bool recall_bindings();
|
||||
void bind( std::vector< std::reference_wrapper<user_command> > &Targets, cParser &Input, std::unordered_map<std::string, user_command> const &Translator, std::string const Point );
|
||||
void on_button( int const Button, int const Action );
|
||||
void bind( std::vector< std::reference_wrapper<user_command> > &Targets, cParser &Input, std::unordered_map<std::string, user_command> const &Translator, std::string Point );
|
||||
void on_button( int Button, int Action );
|
||||
void process_axes();
|
||||
|
||||
// members
|
||||
|
||||
@@ -50,22 +50,21 @@ public:
|
||||
bool
|
||||
init() { return true; }
|
||||
bool
|
||||
key( int const Key, int const Action );
|
||||
key( int Key, int Action );
|
||||
int
|
||||
key( int const Key ) const;
|
||||
key( int Key ) const;
|
||||
void
|
||||
poll();
|
||||
inline
|
||||
user_command const
|
||||
user_command const
|
||||
command() const {
|
||||
return m_command; }
|
||||
bindingsetup_sequence&
|
||||
bindings() {
|
||||
return m_bindingsetups; }
|
||||
int
|
||||
binding( user_command const Command ) const;
|
||||
binding( user_command Command ) const;
|
||||
std::string
|
||||
binding_hint( user_command const Command ) const;
|
||||
binding_hint( user_command Command ) const;
|
||||
void
|
||||
dump_bindings();
|
||||
|
||||
@@ -101,7 +100,7 @@ private:
|
||||
|
||||
// methods
|
||||
bool
|
||||
is_movement_key( int const Key ) const;
|
||||
is_movement_key( int Key ) const;
|
||||
|
||||
// members
|
||||
user_command m_command { user_command::none }; // last, if any, issued command
|
||||
|
||||
@@ -78,8 +78,7 @@ class TAnimContainer : std::enable_shared_from_this<TAnimContainer>
|
||||
// wyświetlania
|
||||
TAnimContainer();
|
||||
bool Init(TSubModel *pNewSubModel);
|
||||
inline
|
||||
std::string NameGet() {
|
||||
std::string NameGet() {
|
||||
return pSubModel ? pSubModel->pName : ""; };
|
||||
void SetRotateAnim( glm::vec3 vNewRotateAngles, double fNewRotateSpeed);
|
||||
void SetTranslateAnim( glm::dvec3 vNewTranslate, double fNewSpeed);
|
||||
@@ -88,19 +87,15 @@ class TAnimContainer : std::enable_shared_from_this<TAnimContainer>
|
||||
void UpdateModel();
|
||||
void UpdateModelIK();
|
||||
bool InMovement(); // czy w trakcie animacji?
|
||||
inline
|
||||
double AngleGet() {
|
||||
double AngleGet() {
|
||||
return vRotateAngles.z; }; // jednak ostatnia, T3D ma inny układ
|
||||
inline
|
||||
glm::dvec3 TransGet() {
|
||||
glm::dvec3 TransGet() {
|
||||
return glm::dvec3(-vTranslation.x, vTranslation.z, vTranslation.y); }; // zmiana, bo T3D ma inny układ
|
||||
inline
|
||||
void WillBeAnimated() {
|
||||
void WillBeAnimated() {
|
||||
if (pSubModel)
|
||||
pSubModel->WillBeAnimated(); };
|
||||
void EventAssign(basic_event *ev);
|
||||
inline
|
||||
basic_event * Event() {
|
||||
basic_event * Event() {
|
||||
return evDone; };
|
||||
};
|
||||
|
||||
@@ -120,27 +115,23 @@ public:
|
||||
bool Load(cParser *parser, bool ter = false);
|
||||
std::shared_ptr<TAnimContainer> AddContainer(std::string const &Name);
|
||||
std::shared_ptr<TAnimContainer> GetContainer(std::string const &Name = "");
|
||||
void LightSet( int const n, float const v );
|
||||
void SkinSet( int const Index, material_handle const Material );
|
||||
std::optional<std::tuple<float, float, std::optional<glm::vec3> > > LightGet( int const n );
|
||||
void LightSet( int n, float v );
|
||||
void SkinSet( int Index, material_handle Material );
|
||||
std::optional<std::tuple<float, float, std::optional<glm::vec3> > > LightGet( int n );
|
||||
int TerrainCount();
|
||||
TSubModel * TerrainSquare(int n);
|
||||
int Flags();
|
||||
void on_season_update();
|
||||
inline
|
||||
material_data const *
|
||||
material_data const *
|
||||
Material() const {
|
||||
return &m_materialdata; }
|
||||
inline
|
||||
TModel3d *
|
||||
TModel3d *
|
||||
Model() const {
|
||||
return pModel; }
|
||||
inline
|
||||
void
|
||||
void
|
||||
Angles( glm::vec3 const &Angles ) {
|
||||
vAngle = Angles; }
|
||||
inline
|
||||
glm::vec3
|
||||
glm::vec3
|
||||
Angles() const {
|
||||
return vAngle; }
|
||||
// per-axis scale, applied between rotation and the submodel-local transform chain.
|
||||
@@ -148,19 +139,16 @@ public:
|
||||
// optional `scale <factor>` / `scale <x> <y> <z>` token inside a `node model` block.
|
||||
// Per-axis values let you stretch a model along a single dimension; uniform input
|
||||
// (single float) broadcasts to all three axes.
|
||||
inline
|
||||
void
|
||||
void
|
||||
Scale( glm::vec3 const &Factor ) {
|
||||
m_scale = glm::vec3(
|
||||
Factor.x > 0.0f ? Factor.x : 1.0f,
|
||||
Factor.y > 0.0f ? Factor.y : 1.0f,
|
||||
Factor.z > 0.0f ? Factor.z : 1.0f ); }
|
||||
inline
|
||||
void
|
||||
void
|
||||
Scale( float const Factor ) {
|
||||
Scale( glm::vec3( Factor ) ); }
|
||||
inline
|
||||
glm::vec3 const &
|
||||
glm::vec3 const &
|
||||
Scale() const {
|
||||
return m_scale; }
|
||||
// members
|
||||
@@ -172,7 +160,7 @@ public:
|
||||
public:
|
||||
// methods
|
||||
void RaPrepare(); // ustawienie animacji egzemplarza na wzorcu
|
||||
void RaAnimate( unsigned int const Framestamp ); // przeliczenie animacji egzemplarza
|
||||
void RaAnimate( unsigned int Framestamp ); // przeliczenie animacji egzemplarza
|
||||
|
||||
// radius() subclass details, calculates node's bounding radius
|
||||
float radius_();
|
||||
|
||||
@@ -13,7 +13,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
class TMdlContainer {
|
||||
friend class TModelsManager;
|
||||
private:
|
||||
TModel3d *LoadModel( std::string const &Name, bool const Dynamic );
|
||||
TModel3d *LoadModel( std::string const &Name, bool Dynamic );
|
||||
std::shared_ptr<TModel3d> Model { nullptr };
|
||||
std::string m_name;
|
||||
};
|
||||
@@ -22,7 +22,7 @@ private:
|
||||
class TModelsManager {
|
||||
public:
|
||||
// McZapkie: dodalem sciezke, notabene Path!=Patch :)
|
||||
static TModel3d *GetModel(std::string const &Name, bool const dynamic = false, bool const Logerrors = true , int uid = 0);
|
||||
static TModel3d *GetModel(std::string const &Name, bool dynamic = false, bool Logerrors = true , int uid = 0);
|
||||
|
||||
private:
|
||||
// types:
|
||||
@@ -32,7 +32,7 @@ private:
|
||||
static modelcontainer_sequence m_models;
|
||||
static stringmodelcontainerindex_map m_modelsmap;
|
||||
// methods:
|
||||
static TModel3d *LoadModel(std::string const &Name, const std::string &virtualName, bool const Dynamic );
|
||||
static TModel3d *LoadModel(std::string const &Name, const std::string &virtualName, bool Dynamic );
|
||||
static std::pair<bool, TModel3d *> find_in_databank( std::string const &Name );
|
||||
// checks whether specified file exists. returns name of the located file, or empty string.
|
||||
static std::string find_on_disk( std::string const &Name );
|
||||
|
||||
@@ -160,7 +160,7 @@ public: // chwilowo
|
||||
std::string m_materialname; // robocza nazwa tekstury do zapisania w pliku binarnym
|
||||
std::string pName; // robocza nazwa
|
||||
public:
|
||||
int SeekFaceNormal( std::vector<unsigned int> const &Masks, int const Startface, unsigned int const Mask, glm::vec3 const &Position, gfx::vertex_array const &Vertices );
|
||||
int SeekFaceNormal( std::vector<unsigned int> const &Masks, int Startface, unsigned int Mask, glm::vec3 const &Position, gfx::vertex_array const &Vertices );
|
||||
void RaAnimation(TAnimType a);
|
||||
void RaAnimation(glm::mat4 &m, TAnimType a);
|
||||
// returns true if the submodel is a smoke emitter attachment point, false otherwise
|
||||
@@ -196,11 +196,11 @@ public:
|
||||
void SetTranslate(float3 vNewTransVector);
|
||||
void SetRotateIK1(float3 vNewAngles);
|
||||
TSubModel * GetFromName( std::string const &search, bool i = true );
|
||||
inline float4x4 * GetMatrix() { return fMatrix; };
|
||||
inline float4x4 const * GetMatrix() const { return fMatrix; };
|
||||
float4x4 * GetMatrix() { return fMatrix; };
|
||||
float4x4 const * GetMatrix() const { return fMatrix; };
|
||||
// returns offset vector from root
|
||||
glm::vec3 offset( float const Geometrytestoffsetthreshold = 0.f ) const;
|
||||
inline void Hide() { iVisible = 0; };
|
||||
glm::vec3 offset( float Geometrytestoffsetthreshold = 0.f ) const;
|
||||
void Hide() { iVisible = 0; };
|
||||
|
||||
void create_geometry( std::size_t &Indexoffset, std::size_t &Vertexoffset, gfx::geometrybank_handle const &Bank );
|
||||
uint32_t FlagsCheck();
|
||||
@@ -218,18 +218,18 @@ public:
|
||||
void UnFlagNext() { iFlags &= 0x00FFFFFF; };
|
||||
void ColorsSet( glm::vec3 const &Ambient, glm::vec3 const &Diffuse, glm::vec3 const &Specular );
|
||||
// sets rgb components of diffuse color override to specified value
|
||||
void SetDiffuseOverride( glm::vec3 const &Color, bool const Includechildren = false, bool const Includesiblings = false );
|
||||
void SetDiffuseOverride( glm::vec3 const &Color, bool Includechildren = false, bool Includesiblings = false );
|
||||
// gets rgb components of any freespot diffuse color (searches also in children)
|
||||
std::optional<glm::vec3> GetDiffuse( float Includesiblings = false );
|
||||
// sets visibility level (alpha component) to specified value
|
||||
void SetVisibilityLevel( float const Level, bool const Includechildren = false, bool const Includesiblings = false );
|
||||
void SetVisibilityLevel( float Level, bool Includechildren = false, bool Includesiblings = false );
|
||||
// sets light level (alpha component of illumination color) to specified value
|
||||
void SetLightLevel( glm::vec4 const &Level, bool const Includechildren = false, bool const Includesiblings = false );
|
||||
void SetLightLevel( glm::vec4 const &Level, bool Includechildren = false, bool Includesiblings = false );
|
||||
// sets activation threshold of self-illumination to specitied value
|
||||
void SetSelfIllum( float const Threshold, bool const Includechildren = false, bool const Includesiblings = false );
|
||||
inline float3 Translation1Get() {
|
||||
void SetSelfIllum( float Threshold, bool Includechildren = false, bool Includesiblings = false );
|
||||
float3 Translation1Get() {
|
||||
return fMatrix ? *fMatrix->TranslationGet() + v_TransVector : v_TransVector; }
|
||||
inline float3 Translation2Get() {
|
||||
float3 Translation2Get() {
|
||||
return *fMatrix->TranslationGet() + Child->Translation1Get(); }
|
||||
material_handle GetMaterial() const {
|
||||
return m_material; }
|
||||
@@ -247,9 +247,9 @@ public:
|
||||
std::vector<std::string>&,
|
||||
std::vector<std::string>&,
|
||||
std::vector<float4x4>&);
|
||||
void serialize_geometry( std::ostream &Output, bool const Packed, bool const Indexed, bool const UserData ) const;
|
||||
void serialize_geometry( std::ostream &Output, bool Packed, bool Indexed, bool UserData ) const;
|
||||
int index_size() const;
|
||||
void serialize_indices( std::ostream &Output, int const Size ) const;
|
||||
void serialize_indices( std::ostream &Output, int Size ) const;
|
||||
// places contained geometry in provided ground node
|
||||
};
|
||||
|
||||
@@ -279,7 +279,7 @@ public:
|
||||
~TModel3d();
|
||||
float bounding_radius() const {
|
||||
return Root ? Root->m_boundingradius : 0.f; }
|
||||
inline TSubModel * GetSMRoot() { return Root; };
|
||||
TSubModel * GetSMRoot() { return Root; };
|
||||
TSubModel * GetFromName(std::string const &Name) const;
|
||||
TSubModel * AddToNamed(const char *Name, TSubModel *SubModel);
|
||||
nameoffset_sequence const & find_smoke_sources();
|
||||
|
||||
@@ -32,7 +32,7 @@ struct opengl_texture : public ITexture {
|
||||
static void
|
||||
unbind( size_t unit );
|
||||
virtual bool
|
||||
create( bool const Static = false ) override;
|
||||
create( bool Static = false ) override;
|
||||
// releases resources allocated on the opengl end, storing local copy if requested
|
||||
void
|
||||
release() override;
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
void load_STBI();
|
||||
void load_TGA();
|
||||
void set_filtering() const;
|
||||
void downsize( GLuint const Format );
|
||||
void downsize( GLuint Format );
|
||||
void flip_vertical();
|
||||
void gles_match_internalformat(GLuint format);
|
||||
|
||||
@@ -144,15 +144,15 @@ public:
|
||||
|
||||
// activates specified texture unit
|
||||
void
|
||||
unit( GLint const Textureunit );
|
||||
unit( GLint Textureunit );
|
||||
// creates texture object out of data stored in specified file
|
||||
texture_handle
|
||||
create( std::string Filename, bool const Loadnow = true, GLint Formathint = GL_SRGB_ALPHA );
|
||||
create( std::string Filename, bool Loadnow = true, GLint Formathint = GL_SRGB_ALPHA );
|
||||
// binds specified texture to specified texture unit
|
||||
void
|
||||
bind( std::size_t const Unit, texture_handle const Texture );
|
||||
bind( std::size_t Unit, texture_handle Texture );
|
||||
opengl_texture &
|
||||
mark_as_used( texture_handle const Texture );
|
||||
mark_as_used( texture_handle Texture );
|
||||
// provides direct access to specified texture object
|
||||
opengl_texture &
|
||||
texture( texture_handle const Texture ) const { return *m_textures[Texture].first; }
|
||||
|
||||
@@ -35,7 +35,7 @@ struct opengl_material : public IMaterial {
|
||||
opengl_material();
|
||||
|
||||
// methods
|
||||
bool deserialize(cParser &Input, bool const Loadnow);
|
||||
bool deserialize(cParser &Input, bool Loadnow);
|
||||
virtual void finalize(bool Loadnow) override;
|
||||
virtual bool update() override;
|
||||
virtual float get_or_guess_opacity() const override;
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
// methods
|
||||
// imports member data pair from the config file
|
||||
bool
|
||||
deserialize_mapping( cParser &Input, int const Priority, bool const Loadnow );
|
||||
deserialize_mapping( cParser &Input, int Priority, bool Loadnow );
|
||||
void log_error(const std::string &str);
|
||||
|
||||
// members
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
material_manager() { m_materials.emplace_back( opengl_material() ); } // empty bindings for null material
|
||||
|
||||
material_handle
|
||||
create( std::string const &Filename, bool const Loadnow );
|
||||
create( std::string const &Filename, bool Loadnow );
|
||||
opengl_material const &
|
||||
material( material_handle const Material ) const { return m_materials[ Material ]; }
|
||||
opengl_material &
|
||||
|
||||
@@ -40,35 +40,28 @@ public:
|
||||
void
|
||||
calculate(glm::mat4 const &Projection, glm::mat4 const &Modelview);
|
||||
// returns true if specified point is inside of the frustum
|
||||
inline
|
||||
bool
|
||||
bool
|
||||
point_inside( glm::vec3 const &Point ) const { return point_inside( Point.x, Point.y, Point.z ); }
|
||||
inline
|
||||
bool
|
||||
bool
|
||||
point_inside( float3 const &Point ) const { return point_inside( Point.x, Point.y, Point.z ); }
|
||||
bool
|
||||
point_inside( float const X, float const Y, float const Z ) const;
|
||||
point_inside( float X, float Y, float Z ) const;
|
||||
// tests if the sphere is in frustum, returns the distance between origin and sphere centre
|
||||
inline
|
||||
float
|
||||
float
|
||||
sphere_inside( glm::dvec3 const &Center, float const Radius ) const { return sphere_inside( static_cast<float>( Center.x ), static_cast<float>( Center.y ), static_cast<float>( Center.z ), Radius ); }
|
||||
inline
|
||||
float
|
||||
float
|
||||
sphere_inside( glm::vec3 const &Center, float const Radius ) const { return sphere_inside( Center.x, Center.y, Center.z, Radius ); }
|
||||
inline
|
||||
float
|
||||
float
|
||||
sphere_inside( float3 const &Center, float const Radius ) const { return sphere_inside( Center.x, Center.y, Center.z, Radius ); }
|
||||
float
|
||||
sphere_inside( float const X, float const Y, float const Z, float const Radius ) const;
|
||||
sphere_inside( float X, float Y, float Z, float Radius ) const;
|
||||
// returns true if specified cube is inside of the frustum. Size = half of the length
|
||||
inline
|
||||
bool
|
||||
bool
|
||||
cube_inside( glm::vec3 const &Center, float const Size ) const { return cube_inside( Center.x, Center.y, Center.z, Size ); }
|
||||
inline
|
||||
bool
|
||||
bool
|
||||
cube_inside( float3 const &Center, float const Size ) const { return cube_inside( Center.x, Center.y, Center.z, Size ); }
|
||||
bool
|
||||
cube_inside( float const X, float const Y, float const Z, float const Size ) const;
|
||||
cube_inside( float X, float Y, float Z, float Size ) const;
|
||||
|
||||
private:
|
||||
// types:
|
||||
@@ -79,7 +72,7 @@ private:
|
||||
|
||||
// methods:
|
||||
void
|
||||
normalize_plane( side const Side ); // normalizes a plane (A side) from the frustum
|
||||
normalize_plane( side Side ); // normalizes a plane (A side) from the frustum
|
||||
|
||||
// members:
|
||||
float m_frustum[6][4]; // holds the A B C and D values (normal & distance) for each side of the frustum.
|
||||
|
||||
@@ -28,10 +28,10 @@ struct basic_vertex {
|
||||
{}
|
||||
static basic_vertex convert(world_vertex const &world, glm::dvec3 const &origin);
|
||||
world_vertex to_world(glm::dvec3 const &origin = glm::dvec3(0.)) const;
|
||||
void serialize( std::ostream&, bool const Tangent = false ) const;
|
||||
void deserialize( std::istream&, bool const Tangent = false );
|
||||
void serialize_packed( std::ostream&, bool const Tangent = false ) const;
|
||||
void deserialize_packed( std::istream&, bool const Tangent = false );
|
||||
void serialize( std::ostream&, bool Tangent = false ) const;
|
||||
void deserialize( std::istream&, bool Tangent = false );
|
||||
void serialize_packed( std::ostream&, bool Tangent = false ) const;
|
||||
void deserialize_packed( std::istream&, bool Tangent = false );
|
||||
};
|
||||
|
||||
struct vertex_userdata{
|
||||
@@ -65,7 +65,7 @@ using vertex_array = std::vector<basic_vertex>;
|
||||
using userdata_array = std::vector<vertex_userdata>;
|
||||
using index_array = std::vector<basic_index>;
|
||||
|
||||
void calculate_tangents( vertex_array &vertices, index_array const &indices, int const type );
|
||||
void calculate_tangents( vertex_array &vertices, index_array const &indices, int type );
|
||||
void calculate_indices( index_array &Indices, vertex_array &Vertices, userdata_array &Userdata, float tolerancescale = 1.0f );
|
||||
|
||||
// generic geometry bank class, allows storage, update and drawing of geometry chunks
|
||||
@@ -79,8 +79,8 @@ struct geometry_handle {
|
||||
bank( Bank ), chunk( Chunk )
|
||||
{}
|
||||
// methods
|
||||
inline
|
||||
operator std::uint64_t() const {
|
||||
|
||||
operator std::uint64_t() const {
|
||||
/*
|
||||
return bank << 14 | chunk; }
|
||||
*/
|
||||
@@ -110,17 +110,17 @@ public:
|
||||
|
||||
// methods:
|
||||
// creates a new geometry chunk of specified type from supplied data. returns: handle to the chunk or NULL
|
||||
auto create( vertex_array &Vertices, userdata_array& Userdata, unsigned int const Type ) -> geometry_handle;
|
||||
auto create( vertex_array &Vertices, userdata_array& Userdata, unsigned int Type ) -> geometry_handle;
|
||||
// creates a new indexed geometry chunk of specified type from supplied data. returns: handle to the chunk or NULL
|
||||
auto create( index_array &Indices, vertex_array &Vertices, userdata_array& Userdata, unsigned int const Type ) -> geometry_handle;
|
||||
auto create( index_array &Indices, vertex_array &Vertices, userdata_array& Userdata, unsigned int Type ) -> geometry_handle;
|
||||
// replaces vertex data of specified chunk with the supplied data, starting from specified offset
|
||||
auto replace( vertex_array &Vertices, userdata_array& Userdata, geometry_handle const &Geometry, std::size_t const Offset = 0 ) -> bool;
|
||||
auto replace( vertex_array &Vertices, userdata_array& Userdata, geometry_handle const &Geometry, std::size_t Offset = 0 ) -> bool;
|
||||
// adds supplied vertex data at the end of specified chunk
|
||||
auto append( vertex_array &Vertices, userdata_array& Userdata, geometry_handle const &Geometry ) -> bool;
|
||||
// draws geometry stored in specified chunk
|
||||
auto draw( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams = basic_streams ) -> std::size_t;
|
||||
auto draw( geometry_handle const &Geometry, stream_units const &Units, unsigned int Streams = basic_streams ) -> std::size_t;
|
||||
// draws geometry stored in specified chunk N times via glDrawElementsInstanced*
|
||||
auto draw_instanced( geometry_handle const &Geometry, stream_units const &Units, std::size_t const InstanceCount, unsigned int const Streams = basic_streams ) -> std::size_t;
|
||||
auto draw_instanced( geometry_handle const &Geometry, stream_units const &Units, std::size_t InstanceCount, unsigned int Streams = basic_streams ) -> std::size_t;
|
||||
// draws geometry stored in supplied list of chunks
|
||||
template <typename Iterator_>
|
||||
auto draw( Iterator_ First, Iterator_ Last, stream_units const &Units, unsigned int const Streams = basic_streams ) ->std::size_t {
|
||||
@@ -164,11 +164,9 @@ protected:
|
||||
using geometrychunk_sequence = std::vector<geometry_chunk>;
|
||||
|
||||
// methods
|
||||
inline
|
||||
auto chunk( geometry_handle const Geometry ) -> geometry_chunk & {
|
||||
auto chunk( geometry_handle const Geometry ) -> geometry_chunk & {
|
||||
return m_chunks[ Geometry.chunk - 1 ]; }
|
||||
inline
|
||||
auto chunk( geometry_handle const Geometry ) const -> geometry_chunk const & {
|
||||
auto chunk( geometry_handle const Geometry ) const -> geometry_chunk const & {
|
||||
return m_chunks[ Geometry.chunk - 1 ]; }
|
||||
|
||||
// members:
|
||||
@@ -181,7 +179,7 @@ private:
|
||||
// replace() subclass details
|
||||
virtual void replace_( geometry_handle const &Geometry ) = 0;
|
||||
// draw() subclass details
|
||||
virtual auto draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams ) -> std::size_t = 0;
|
||||
virtual auto draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int Streams ) -> std::size_t = 0;
|
||||
// draw_instanced() subclass details. Default implementation falls back to N regular draws.
|
||||
virtual auto draw_instanced_( geometry_handle const &Geometry, stream_units const &Units, std::size_t const InstanceCount, unsigned int const Streams ) -> std::size_t {
|
||||
std::size_t count { 0 };
|
||||
@@ -206,18 +204,18 @@ public:
|
||||
// registers a new geometry bank. returns: handle to the bank
|
||||
auto register_bank(std::unique_ptr<geometry_bank> bank) -> geometrybank_handle;
|
||||
// creates a new geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
|
||||
auto create_chunk( vertex_array &Vertices, userdata_array &Userdata, geometrybank_handle const &Geometry, int const Type ) -> geometry_handle;
|
||||
auto create_chunk( vertex_array &Vertices, userdata_array &Userdata, geometrybank_handle const &Geometry, int Type ) -> geometry_handle;
|
||||
// creates a new indexed geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
|
||||
auto create_chunk( index_array &Indices, vertex_array &Vertices, userdata_array &Userdata, geometrybank_handle const &Geometry, unsigned int const Type ) -> geometry_handle;
|
||||
auto create_chunk( index_array &Indices, vertex_array &Vertices, userdata_array &Userdata, geometrybank_handle const &Geometry, unsigned int Type ) -> geometry_handle;
|
||||
// replaces data of specified chunk with the supplied vertex data, starting from specified offset
|
||||
auto replace( vertex_array &Vertices, userdata_array &Userdata, geometry_handle const &Geometry, std::size_t const Offset = 0 ) -> bool;
|
||||
auto replace( vertex_array &Vertices, userdata_array &Userdata, geometry_handle const &Geometry, std::size_t Offset = 0 ) -> bool;
|
||||
// adds supplied vertex data at the end of specified chunk
|
||||
auto append( vertex_array &Vertices, userdata_array &Userdata, geometry_handle const &Geometry ) -> bool;
|
||||
// draws geometry stored in specified chunk
|
||||
void draw( geometry_handle const &Geometry, unsigned int const Streams = basic_streams );
|
||||
void draw( geometry_handle const &Geometry, unsigned int Streams = basic_streams );
|
||||
// draws geometry stored in specified chunk InstanceCount times via GPU instancing.
|
||||
// The shader reads per-instance modelview matrices from instance_ubo[gl_InstanceID].
|
||||
void draw_instanced( geometry_handle const &Geometry, std::size_t const InstanceCount, unsigned int const Streams = basic_streams );
|
||||
void draw_instanced( geometry_handle const &Geometry, std::size_t InstanceCount, unsigned int Streams = basic_streams );
|
||||
template <typename Iterator_>
|
||||
void draw( Iterator_ First, Iterator_ Last, unsigned int const Streams = basic_streams ) {
|
||||
while( First != Last ) {
|
||||
@@ -246,15 +244,12 @@ private:
|
||||
stream_units m_units;
|
||||
|
||||
// methods
|
||||
inline
|
||||
auto valid( geometry_handle const &Geometry ) const -> bool {
|
||||
auto valid( geometry_handle const &Geometry ) const -> bool {
|
||||
return ( ( Geometry.bank != 0 )
|
||||
&& ( Geometry.bank <= m_geometrybanks.size() ) ); }
|
||||
inline
|
||||
auto bank( geometry_handle const Geometry ) -> geometrybanktimepointpair_sequence::value_type & {
|
||||
auto bank( geometry_handle const Geometry ) -> geometrybanktimepointpair_sequence::value_type & {
|
||||
return m_geometrybanks[ Geometry.bank - 1 ]; }
|
||||
inline
|
||||
auto bank( geometry_handle const Geometry ) const -> geometrybanktimepointpair_sequence::value_type const & {
|
||||
auto bank( geometry_handle const Geometry ) const -> geometrybanktimepointpair_sequence::value_type const & {
|
||||
return m_geometrybanks[ Geometry.bank - 1 ]; }
|
||||
|
||||
// members:
|
||||
|
||||
@@ -52,8 +52,7 @@ public:
|
||||
Render() override { return true; }
|
||||
void
|
||||
SwapBuffers() override {}
|
||||
inline
|
||||
float
|
||||
float
|
||||
Framerate() override { return 10.0f; }
|
||||
|
||||
bool AddViewport(const global_settings::extraviewport_config &conf) override { return false; }
|
||||
@@ -121,7 +120,7 @@ public:
|
||||
Texture( texture_handle const Texture ) const override { throw std::runtime_error("not impl"); }
|
||||
// utility methods
|
||||
void
|
||||
Pick_Control_Callback( std::function<void( TSubModel const *, const glm::vec2 )> Callback ) override {}
|
||||
Pick_Control_Callback( std::function<void( TSubModel const *, glm::vec2 )> Callback ) override {}
|
||||
void
|
||||
Pick_Node_Callback( std::function<void( scene::basic_node * )> Callback ) override {}
|
||||
TSubModel const *
|
||||
|
||||
@@ -52,10 +52,10 @@ private:
|
||||
replace_( geometry_handle const &Geometry ) override;
|
||||
// draw() subclass details
|
||||
auto
|
||||
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams ) -> std::size_t override;
|
||||
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int Streams ) -> std::size_t override;
|
||||
// draw_instanced() subclass details — issues glDrawElementsInstancedBaseVertex
|
||||
auto
|
||||
draw_instanced_( geometry_handle const &Geometry, stream_units const &Units, std::size_t const InstanceCount, unsigned int const Streams ) -> std::size_t override;
|
||||
draw_instanced_( geometry_handle const &Geometry, stream_units const &Units, std::size_t InstanceCount, unsigned int Streams ) -> std::size_t override;
|
||||
// release() subclass details
|
||||
void
|
||||
release_() override;
|
||||
|
||||
@@ -17,7 +17,7 @@ struct opengl33_light : public basic_light {
|
||||
|
||||
float factor;
|
||||
|
||||
void apply_intensity(float const Factor = 1.0f);
|
||||
void apply_intensity(float Factor = 1.0f);
|
||||
void apply_angle();
|
||||
|
||||
opengl33_light &operator=(basic_light const &Right) {
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
|
||||
private:
|
||||
// methods
|
||||
void create( int const Tesselation );
|
||||
void create( int Tesselation );
|
||||
// members
|
||||
std::vector<glm::vec3> m_vertices;
|
||||
std::vector<glm::vec2> m_uvs;
|
||||
|
||||
@@ -4920,7 +4920,7 @@ void opengl33_renderer::Update_Pick_Node()
|
||||
}
|
||||
}
|
||||
|
||||
void opengl33_renderer::Pick_Control_Callback(std::function<void(TSubModel const *, const glm::vec2 pos)> callback)
|
||||
void opengl33_renderer::Pick_Control_Callback(std::function<void(TSubModel const *, glm::vec2 pos)> callback)
|
||||
{
|
||||
if (!Global.render_cab) {
|
||||
callback(nullptr, glm::vec2());
|
||||
|
||||
@@ -49,8 +49,7 @@ class opengl33_renderer : public gfx_renderer {
|
||||
Render() override;
|
||||
void
|
||||
SwapBuffers() override;
|
||||
inline
|
||||
float
|
||||
float
|
||||
Framerate() override { return m_framerate; }
|
||||
// geometry methods
|
||||
// NOTE: hands-on geometry management is exposed as a temporary measure; ultimately all visualization data should be generated/handled automatically by the renderer itself
|
||||
@@ -58,13 +57,13 @@ class opengl33_renderer : public gfx_renderer {
|
||||
gfx::geometrybank_handle
|
||||
Create_Bank() override;
|
||||
// creates a new indexed geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
|
||||
gfx::geometry_handle Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) override;
|
||||
gfx::geometry_handle Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int Type) override;
|
||||
// creates a new geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
|
||||
gfx::geometry_handle Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) override;
|
||||
gfx::geometry_handle Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int Type) override;
|
||||
// replaces data of specified chunk with the supplied vertex data, starting from specified offset
|
||||
bool Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type, const std::size_t Offset = 0) override;
|
||||
bool Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int Type, std::size_t Offset = 0) override;
|
||||
// adds supplied vertex data at the end of specified chunk
|
||||
bool Append(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type) override;
|
||||
bool Append(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int Type) override;
|
||||
// provides direct access to index data of specfied chunk
|
||||
gfx::index_array const &
|
||||
Indices( gfx::geometry_handle const &Geometry ) const override;
|
||||
@@ -76,27 +75,27 @@ class opengl33_renderer : public gfx_renderer {
|
||||
UserData( gfx::geometry_handle const &Geometry ) const override;
|
||||
// material methods
|
||||
material_handle
|
||||
Fetch_Material( std::string const &Filename, bool const Loadnow = true ) override;
|
||||
Fetch_Material( std::string const &Filename, bool Loadnow = true ) override;
|
||||
void
|
||||
Bind_Material( material_handle const Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) override;
|
||||
Bind_Material( material_handle Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) override;
|
||||
IMaterial const *
|
||||
Material( material_handle const Material ) const override;
|
||||
Material( material_handle Material ) const override;
|
||||
// shader methods
|
||||
auto Fetch_Shader( std::string const &name ) -> std::shared_ptr<gl::program> override;
|
||||
// texture methods
|
||||
texture_handle
|
||||
Fetch_Texture( std::string const &Filename, bool const Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) override;
|
||||
Fetch_Texture( std::string const &Filename, bool Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) override;
|
||||
void
|
||||
Bind_Texture( texture_handle const Texture ) override;
|
||||
Bind_Texture( texture_handle Texture ) override;
|
||||
void
|
||||
Bind_Texture( std::size_t const Unit, texture_handle const Texture ) override;
|
||||
Bind_Texture( std::size_t Unit, texture_handle Texture ) override;
|
||||
ITexture &
|
||||
Texture( texture_handle const Texture ) override;
|
||||
Texture( texture_handle Texture ) override;
|
||||
ITexture const &
|
||||
Texture( texture_handle const Texture ) const override;
|
||||
Texture( texture_handle Texture ) const override;
|
||||
// utility methods
|
||||
void
|
||||
Pick_Control_Callback( std::function<void( TSubModel const *, const glm::vec2 )> Callback ) override;
|
||||
Pick_Control_Callback( std::function<void( TSubModel const *, glm::vec2 )> Callback ) override;
|
||||
void
|
||||
Pick_Node_Callback( std::function<void( scene::basic_node * )> Callback ) override;
|
||||
TSubModel const *
|
||||
@@ -113,7 +112,7 @@ class opengl33_renderer : public gfx_renderer {
|
||||
Camera_Position() const override { return m_colorpass.pass_camera.position(); }
|
||||
// maintenance methods
|
||||
void
|
||||
Update( double const Deltatime ) override;
|
||||
Update( double Deltatime ) override;
|
||||
bool
|
||||
Debug_Ui_State(std::optional<bool>) override;
|
||||
void
|
||||
@@ -131,13 +130,13 @@ class opengl33_renderer : public gfx_renderer {
|
||||
|
||||
|
||||
|
||||
opengl_material & Material( material_handle const Material );
|
||||
opengl_material & Material( material_handle Material );
|
||||
opengl_material const & Material( TSubModel const * Submodel ) const;
|
||||
// draws supplied geometry handles
|
||||
void Draw_Geometry(std::vector<gfx::geometrybank_handle>::iterator begin, std::vector<gfx::geometrybank_handle>::iterator end);
|
||||
void Draw_Geometry(const gfx::geometrybank_handle &handle);
|
||||
// material methods
|
||||
void Bind_Material_Shadow(material_handle const Material);
|
||||
void Bind_Material_Shadow(material_handle Material);
|
||||
void Update_AnimModel(TAnimModel *model);
|
||||
|
||||
// members
|
||||
@@ -257,24 +256,24 @@ class opengl33_renderer : public gfx_renderer {
|
||||
// methods
|
||||
std::unique_ptr<gl::program> make_shader(std::string v, std::string f);
|
||||
bool Init_caps();
|
||||
void setup_pass(viewport_config &Viewport, renderpass_config &Config, rendermode const Mode, float const Znear = 0.f, float const Zfar = 1.f, bool const Ignoredebug = false);
|
||||
void setup_pass(viewport_config &Viewport, renderpass_config &Config, rendermode Mode, float Znear = 0.f, float Zfar = 1.f, bool Ignoredebug = false);
|
||||
void setup_matrices();
|
||||
void setup_drawing(bool const Alpha = false);
|
||||
void setup_drawing(bool Alpha = false);
|
||||
void setup_shadow_unbind_map();
|
||||
void setup_shadow_bind_map();
|
||||
void setup_shadow_color( glm::vec4 const &Shadowcolor );
|
||||
void setup_env_map(gl::cubemap *tex);
|
||||
void setup_environment_light(TEnvironmentType const Environment = e_flat);
|
||||
void setup_sunlight_intensity( float const Factor = 1.f);
|
||||
void setup_environment_light(TEnvironmentType Environment = e_flat);
|
||||
void setup_sunlight_intensity( float Factor = 1.f);
|
||||
// runs jobs needed to generate graphics for specified render pass
|
||||
void Render_pass(viewport_config &vp, rendermode const Mode);
|
||||
void Render_pass(viewport_config &vp, rendermode Mode);
|
||||
// creates dynamic environment cubemap
|
||||
bool Render_reflections(viewport_config &vp);
|
||||
bool Render(world_environment *Environment);
|
||||
void Render(scene::basic_region *Region);
|
||||
void Render(section_sequence::iterator First, section_sequence::iterator Last);
|
||||
void Render(cell_sequence::iterator First, cell_sequence::iterator Last);
|
||||
void Render(scene::shape_node const &Shape, bool const Ignorerange);
|
||||
void Render(scene::shape_node const &Shape, bool Ignorerange);
|
||||
void Render(TAnimModel *Instance);
|
||||
// batched render path for many TAnimModel instances that share the same TModel3d.
|
||||
// Caller guarantees every instance has m_instanceable == true (no per-instance lights,
|
||||
@@ -283,8 +282,8 @@ class opengl33_renderer : public gfx_renderer {
|
||||
// instances counter. Instances are still individually frustum/distance culled.
|
||||
void Render_Instanced( TModel3d *Model, std::vector<TAnimModel *> const &Instances );
|
||||
bool Render(TDynamicObject *Dynamic);
|
||||
bool Render(TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle);
|
||||
bool Render(TModel3d *Model, material_data const *Material, float const Squaredistance);
|
||||
bool Render(TModel3d *Model, material_data const *Material, float Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle);
|
||||
bool Render(TModel3d *Model, material_data const *Material, float Squaredistance);
|
||||
void Render(TSubModel *Submodel);
|
||||
void Render(TTrack *Track);
|
||||
void Render(scene::basic_cell::path_sequence::const_iterator First, scene::basic_cell::path_sequence::const_iterator Last);
|
||||
@@ -293,10 +292,10 @@ class opengl33_renderer : public gfx_renderer {
|
||||
// no-op if the track has no sleepermodel, Global.SleeperDistance is 0, or the camera is beyond
|
||||
// Global.SleeperDistance from the track origin.
|
||||
void Render_Sleepers( TTrack *Track );
|
||||
bool Render_cab(TDynamicObject const *Dynamic, float const Lightlevel, bool const Alpha = false);
|
||||
bool Render_interior( bool const Alpha = false );
|
||||
bool Render_lowpoly( TDynamicObject *Dynamic, float const Squaredistance, bool const Setup, bool const Alpha = false );
|
||||
bool Render_coupler_adapter( TDynamicObject *Dynamic, float const Squaredistance, int const End, bool const Alpha = false );
|
||||
bool Render_cab(TDynamicObject const *Dynamic, float Lightlevel, bool Alpha = false);
|
||||
bool Render_interior( bool Alpha = false );
|
||||
bool Render_lowpoly( TDynamicObject *Dynamic, float Squaredistance, bool Setup, bool Alpha = false );
|
||||
bool Render_coupler_adapter( TDynamicObject *Dynamic, float Squaredistance, int End, bool Alpha = false );
|
||||
void Render(TMemCell *Memcell);
|
||||
void Render_particles();
|
||||
void Render_precipitation();
|
||||
@@ -307,11 +306,11 @@ class opengl33_renderer : public gfx_renderer {
|
||||
void Render_Alpha(TTraction *Traction);
|
||||
void Render_Alpha(scene::lines_node const &Lines);
|
||||
bool Render_Alpha(TDynamicObject *Dynamic);
|
||||
bool Render_Alpha(TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle);
|
||||
bool Render_Alpha(TModel3d *Model, material_data const *Material, float const Squaredistance);
|
||||
bool Render_Alpha(TModel3d *Model, material_data const *Material, float Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle);
|
||||
bool Render_Alpha(TModel3d *Model, material_data const *Material, float Squaredistance);
|
||||
void Render_Alpha(TSubModel *Submodel);
|
||||
void Update_Lights(light_array &Lights);
|
||||
glm::vec3 pick_color(std::size_t const Index);
|
||||
glm::vec3 pick_color(std::size_t Index);
|
||||
std::size_t pick_index(glm::ivec3 const &Color);
|
||||
|
||||
bool init_viewport(viewport_config &vp);
|
||||
|
||||
@@ -19,11 +19,9 @@ public:
|
||||
// constructors
|
||||
opengl_camera() = default;
|
||||
// methods:
|
||||
inline
|
||||
void
|
||||
void
|
||||
update_frustum() { update_frustum( m_projection, m_modelview ); }
|
||||
inline
|
||||
void
|
||||
void
|
||||
update_frustum(glm::mat4 frustumtest_proj) {
|
||||
update_frustum(frustumtest_proj, m_modelview); }
|
||||
void
|
||||
@@ -32,26 +30,19 @@ public:
|
||||
visible( scene::bounding_area const &Area ) const;
|
||||
bool
|
||||
visible( TDynamicObject const *Dynamic ) const;
|
||||
inline
|
||||
glm::dvec3 const &
|
||||
glm::dvec3 const &
|
||||
position() const { return m_position; }
|
||||
inline
|
||||
glm::dvec3 &
|
||||
glm::dvec3 &
|
||||
position() { return m_position; }
|
||||
inline
|
||||
glm::mat4 const &
|
||||
glm::mat4 const &
|
||||
projection() const { return m_projection; }
|
||||
inline
|
||||
glm::mat4 &
|
||||
glm::mat4 &
|
||||
projection() { return m_projection; }
|
||||
inline
|
||||
glm::mat4 const &
|
||||
glm::mat4 const &
|
||||
modelview() const { return m_modelview; }
|
||||
inline
|
||||
glm::mat4 &
|
||||
glm::mat4 &
|
||||
modelview() { return m_modelview; }
|
||||
inline
|
||||
std::vector<glm::vec4> &
|
||||
std::vector<glm::vec4> &
|
||||
frustum_points() { return m_frustumpoints; }
|
||||
// transforms provided set of clip space points to world space
|
||||
template <class Iterator_>
|
||||
|
||||
@@ -19,39 +19,31 @@ public:
|
||||
opengl_color() = default;
|
||||
|
||||
// methods:
|
||||
inline
|
||||
void
|
||||
void
|
||||
color3( glm::vec3 const &Color ) {
|
||||
return color4( glm::vec4{ Color, 1.f } ); }
|
||||
inline
|
||||
void
|
||||
void
|
||||
color3( float const Red, float const Green, float const Blue ) {
|
||||
return color3( glm::vec3 { Red, Green, Blue } ); }
|
||||
inline
|
||||
void
|
||||
void
|
||||
color3( float const *Value ) {
|
||||
return color3( glm::make_vec3( Value ) ); }
|
||||
inline
|
||||
void
|
||||
void
|
||||
color4( glm::vec4 const &Color ) {
|
||||
if( ( Color != m_color ) || ( false == Global.bUseVBO ) ) {
|
||||
m_color = Color;
|
||||
::glColor4fv( glm::value_ptr( m_color ) ); } }
|
||||
inline
|
||||
void
|
||||
void
|
||||
color4( float const Red, float const Green, float const Blue, float const Alpha ) {
|
||||
return color4( glm::vec4{ Red, Green, Blue, Alpha } ); }
|
||||
inline
|
||||
void
|
||||
void
|
||||
color4( float const *Value ) {
|
||||
return color4( glm::make_vec4( Value ) );
|
||||
}
|
||||
inline
|
||||
glm::vec4 const &
|
||||
glm::vec4 const &
|
||||
data() const {
|
||||
return m_color; }
|
||||
inline
|
||||
float const *
|
||||
float const *
|
||||
data_array() const {
|
||||
return glm::value_ptr( m_color ); }
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ private:
|
||||
replace_( geometry_handle const &Geometry ) override;
|
||||
// draw() subclass details
|
||||
auto
|
||||
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams ) -> std::size_t override;
|
||||
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int Streams ) -> std::size_t override;
|
||||
// release() subclass details
|
||||
void
|
||||
release_() override;
|
||||
@@ -63,7 +63,7 @@ private:
|
||||
delete_buffer();
|
||||
static
|
||||
void
|
||||
bind_streams(stream_units const &Units, unsigned int const Streams , size_t offset = 0);
|
||||
bind_streams(stream_units const &Units, unsigned int Streams , size_t offset = 0);
|
||||
static
|
||||
void
|
||||
release_streams();
|
||||
@@ -109,7 +109,7 @@ private:
|
||||
replace_( geometry_handle const &Geometry ) override;
|
||||
// draw() subclass details
|
||||
auto
|
||||
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams ) -> std::size_t override;
|
||||
draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int Streams ) -> std::size_t override;
|
||||
// release () subclass details
|
||||
void
|
||||
release_() override;
|
||||
|
||||
@@ -16,7 +16,7 @@ struct opengl_light : public basic_light {
|
||||
GLuint id { (GLuint)-1 };
|
||||
|
||||
void
|
||||
apply_intensity( float const Factor = 1.0f );
|
||||
apply_intensity( float Factor = 1.0f );
|
||||
void
|
||||
apply_angle();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
void
|
||||
update( opengl_camera const &Camera );
|
||||
std::size_t
|
||||
render( GLint const Textureunit );
|
||||
render( GLint Textureunit );
|
||||
private:
|
||||
// types
|
||||
struct particle_vertex {
|
||||
|
||||
@@ -22,11 +22,11 @@ public:
|
||||
void
|
||||
update();
|
||||
void
|
||||
render( GLint const Textureunit );
|
||||
render( GLint Textureunit );
|
||||
|
||||
private:
|
||||
// methods
|
||||
void create( int const Tesselation );
|
||||
void create( int Tesselation );
|
||||
// members
|
||||
std::vector<glm::vec3> m_vertices;
|
||||
std::vector<glm::vec2> m_uvs;
|
||||
|
||||
@@ -1831,7 +1831,7 @@ opengl_renderer::Texture( texture_handle const Texture ) const {
|
||||
}
|
||||
|
||||
void
|
||||
opengl_renderer::Pick_Control_Callback( std::function<void( TSubModel const *, const glm::vec2 )> Callback ) {
|
||||
opengl_renderer::Pick_Control_Callback( std::function<void( TSubModel const *, glm::vec2 )> Callback ) {
|
||||
|
||||
m_control_pick_requests.emplace_back( Callback );
|
||||
}
|
||||
|
||||
@@ -44,8 +44,7 @@ public:
|
||||
Render() override;
|
||||
void
|
||||
SwapBuffers() override;
|
||||
inline
|
||||
float
|
||||
float
|
||||
Framerate() override { return m_framerate; }
|
||||
|
||||
bool AddViewport(const global_settings::extraviewport_config &conf) override { return false; }
|
||||
@@ -58,13 +57,13 @@ public:
|
||||
gfx::geometrybank_handle
|
||||
Create_Bank() override;
|
||||
// creates a new indexed geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
|
||||
gfx::geometry_handle Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) override;
|
||||
gfx::geometry_handle Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int Type) override;
|
||||
// creates a new geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
|
||||
gfx::geometry_handle Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) override;
|
||||
gfx::geometry_handle Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int Type) override;
|
||||
// replaces data of specified chunk with the supplied vertex data, starting from specified offset
|
||||
bool Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type, const std::size_t Offset = 0) override;
|
||||
bool Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int Type, std::size_t Offset = 0) override;
|
||||
// adds supplied vertex data at the end of specified chunk
|
||||
bool Append(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type) override;
|
||||
bool Append(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int Type) override;
|
||||
// provides direct access to index data of specfied chunk
|
||||
gfx::index_array const &
|
||||
Indices( gfx::geometry_handle const &Geometry ) const override;
|
||||
@@ -76,27 +75,27 @@ public:
|
||||
UserData( gfx::geometry_handle const &Geometry ) const override;
|
||||
// material methods
|
||||
material_handle
|
||||
Fetch_Material( std::string const &Filename, bool const Loadnow = true ) override;
|
||||
Fetch_Material( std::string const &Filename, bool Loadnow = true ) override;
|
||||
void
|
||||
Bind_Material( material_handle const Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) override;
|
||||
Bind_Material( material_handle Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) override;
|
||||
IMaterial const *
|
||||
Material( material_handle const Material ) const override;
|
||||
Material( material_handle Material ) const override;
|
||||
// shader methods
|
||||
auto Fetch_Shader( std::string const &name ) -> std::shared_ptr<gl::program> override;
|
||||
// texture methods
|
||||
texture_handle
|
||||
Fetch_Texture( std::string const &Filename, bool const Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) override;
|
||||
Fetch_Texture( std::string const &Filename, bool Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) override;
|
||||
void
|
||||
Bind_Texture( texture_handle const Texture ) override;
|
||||
Bind_Texture( texture_handle Texture ) override;
|
||||
void
|
||||
Bind_Texture( std::size_t const Unit, texture_handle const Texture ) override;
|
||||
Bind_Texture( std::size_t Unit, texture_handle Texture ) override;
|
||||
ITexture &
|
||||
Texture( texture_handle const Texture ) override;
|
||||
Texture( texture_handle Texture ) override;
|
||||
ITexture const &
|
||||
Texture( texture_handle const Texture ) const override;
|
||||
Texture( texture_handle Texture ) const override;
|
||||
// utility methods
|
||||
void
|
||||
Pick_Control_Callback( std::function<void( TSubModel const *, const glm::vec2 )> Callback ) override;
|
||||
Pick_Control_Callback( std::function<void( TSubModel const *, glm::vec2 )> Callback ) override;
|
||||
void
|
||||
Pick_Node_Callback( std::function<void( scene::basic_node * )> Callback ) override;
|
||||
TSubModel const *
|
||||
@@ -113,7 +112,7 @@ public:
|
||||
Camera_Position() const override { return m_colorpass.camera.position(); }
|
||||
// maintenance methods
|
||||
void
|
||||
Update( double const Deltatime ) override;
|
||||
Update( double Deltatime ) override;
|
||||
void
|
||||
Update_Pick_Control() override;
|
||||
void
|
||||
@@ -190,27 +189,27 @@ private:
|
||||
void
|
||||
Disable_Lights();
|
||||
void
|
||||
setup_pass( renderpass_config &Config, rendermode const Mode, float const Znear = 0.f, float const Zfar = 1.f, bool const Ignoredebug = false );
|
||||
setup_pass( renderpass_config &Config, rendermode Mode, float Znear = 0.f, float Zfar = 1.f, bool Ignoredebug = false );
|
||||
void
|
||||
setup_matrices();
|
||||
void
|
||||
setup_drawing( bool const Alpha = false );
|
||||
setup_drawing( bool Alpha = false );
|
||||
void
|
||||
setup_units( bool const Diffuse, bool const Shadows, bool const Reflections );
|
||||
setup_units( bool Diffuse, bool Shadows, bool Reflections );
|
||||
void
|
||||
setup_shadow_map( GLuint const Texture, glm::mat4 const &Transformation );
|
||||
setup_shadow_map( GLuint Texture, glm::mat4 const &Transformation );
|
||||
void
|
||||
setup_shadow_color( glm::vec4 const &Shadowcolor );
|
||||
void
|
||||
setup_environment_light( TEnvironmentType const Environment = e_flat );
|
||||
setup_environment_light( TEnvironmentType Environment = e_flat );
|
||||
void
|
||||
switch_units( bool const Diffuse, bool const Shadows, bool const Reflections );
|
||||
switch_units( bool Diffuse, bool Shadows, bool Reflections );
|
||||
// helper, texture manager method; activates specified texture unit
|
||||
void
|
||||
select_unit( GLint const Textureunit );
|
||||
select_unit( GLint Textureunit );
|
||||
// runs jobs needed to generate graphics for specified render pass
|
||||
void
|
||||
Render_pass( rendermode const Mode );
|
||||
Render_pass( rendermode Mode );
|
||||
// creates dynamic environment cubemap
|
||||
bool
|
||||
Render_reflections();
|
||||
@@ -223,15 +222,15 @@ private:
|
||||
void
|
||||
Render( cell_sequence::iterator First, cell_sequence::iterator Last );
|
||||
void
|
||||
Render( scene::shape_node const &Shape, bool const Ignorerange );
|
||||
Render( scene::shape_node const &Shape, bool Ignorerange );
|
||||
void
|
||||
Render( TAnimModel *Instance );
|
||||
bool
|
||||
Render( TDynamicObject *Dynamic );
|
||||
bool
|
||||
Render( TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle );
|
||||
Render( TModel3d *Model, material_data const *Material, float Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle );
|
||||
bool
|
||||
Render( TModel3d *Model, material_data const *Material, float const Squaredistance );
|
||||
Render( TModel3d *Model, material_data const *Material, float Squaredistance );
|
||||
void
|
||||
Render( TSubModel *Submodel );
|
||||
void
|
||||
@@ -239,13 +238,13 @@ private:
|
||||
void
|
||||
Render( scene::basic_cell::path_sequence::const_iterator First, scene::basic_cell::path_sequence::const_iterator Last );
|
||||
bool
|
||||
Render_cab( TDynamicObject const *Dynamic, float const Lightlevel, bool const Alpha = false );
|
||||
Render_cab( TDynamicObject const *Dynamic, float Lightlevel, bool Alpha = false );
|
||||
bool
|
||||
Render_interior( bool const Alpha = false );
|
||||
Render_interior( bool Alpha = false );
|
||||
bool
|
||||
Render_lowpoly( TDynamicObject *Dynamic, float const Squaredistance, bool const Setup, bool const Alpha = false );
|
||||
Render_lowpoly( TDynamicObject *Dynamic, float Squaredistance, bool Setup, bool Alpha = false );
|
||||
bool
|
||||
Render_coupler_adapter( TDynamicObject *Dynamic, float const Squaredistance, int const End, bool const Alpha = false );
|
||||
Render_coupler_adapter( TDynamicObject *Dynamic, float Squaredistance, int End, bool Alpha = false );
|
||||
void
|
||||
Render( TMemCell *Memcell );
|
||||
void
|
||||
@@ -265,9 +264,9 @@ private:
|
||||
bool
|
||||
Render_Alpha( TDynamicObject *Dynamic );
|
||||
bool
|
||||
Render_Alpha( TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle );
|
||||
Render_Alpha( TModel3d *Model, material_data const *Material, float Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle );
|
||||
bool
|
||||
Render_Alpha( TModel3d *Model, material_data const *Material, float const Squaredistance );
|
||||
Render_Alpha( TModel3d *Model, material_data const *Material, float Squaredistance );
|
||||
void
|
||||
Render_Alpha( TSubModel *Submodel );
|
||||
void
|
||||
@@ -275,7 +274,7 @@ private:
|
||||
bool
|
||||
Init_caps();
|
||||
glm::vec3
|
||||
pick_color( std::size_t const Index );
|
||||
pick_color( std::size_t Index );
|
||||
std::size_t
|
||||
pick_index( glm::ivec3 const &Color );
|
||||
|
||||
@@ -367,7 +366,7 @@ private:
|
||||
std::vector<scene::basic_node *> m_picksceneryitems;
|
||||
scene::basic_node *m_picksceneryitem { nullptr };
|
||||
glm::vec3 m_worldmousecoordinates { 0.f };
|
||||
std::vector<std::function<void( TSubModel const *, const glm::vec2 )>> m_control_pick_requests;
|
||||
std::vector<std::function<void( TSubModel const *, glm::vec2 )>> m_control_pick_requests;
|
||||
std::vector<std::function<void( scene::basic_node * )>> m_node_pick_requests;
|
||||
#ifdef EU07_USE_DEBUG_CAMERA
|
||||
renderpass_config m_worldcamera; // debug item
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
deserialize( cParser &Input );
|
||||
// updates state of provided variable
|
||||
void
|
||||
update( Type_ &Variable, double const Timedelta ) const;
|
||||
update( Type_ &Variable, double Timedelta ) const;
|
||||
void
|
||||
bind( Type_ const *Modifier ) {
|
||||
m_valuechangemodifier = Modifier; }
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
bind( TAnimModel const *Node );
|
||||
// updates state of owned particles
|
||||
void
|
||||
update( double const Timedelta, bool const Onlydespawn );
|
||||
update( double Timedelta, bool Onlydespawn );
|
||||
glm::vec3 const &
|
||||
color() const {
|
||||
return m_emitter.color; }
|
||||
@@ -135,7 +135,7 @@ private:
|
||||
initialize( smoke_particle &Particle );
|
||||
// updates state of provided particle and bounding box. returns: true if particle is still alive afterwards, false otherwise
|
||||
bool
|
||||
update( smoke_particle &Particle, bounding_box &Boundingbox, double const Timedelta );
|
||||
update( smoke_particle &Particle, bounding_box &Boundingbox, double Timedelta );
|
||||
// members
|
||||
// config/inputs
|
||||
// TBD: union and indicator, or just plain owner variables?
|
||||
@@ -176,11 +176,11 @@ public:
|
||||
// methods
|
||||
// adds a new particle source of specified type, placing it in specified world location. returns: true on success, false if the specified type definition couldn't be located
|
||||
bool
|
||||
insert( std::string const &Sourcetemplate, glm::dvec3 const Location );
|
||||
insert( std::string const &Sourcetemplate, glm::dvec3 Location );
|
||||
bool
|
||||
insert( std::string const &Sourcetemplate, TDynamicObject const *Vehicle, glm::dvec3 const Location );
|
||||
insert( std::string const &Sourcetemplate, TDynamicObject const *Vehicle, glm::dvec3 Location );
|
||||
bool
|
||||
insert( std::string const &Sourcetemplate, TAnimModel const *Node, glm::dvec3 const Location );
|
||||
insert( std::string const &Sourcetemplate, TAnimModel const *Node, glm::dvec3 Location );
|
||||
// updates state of all owned emitters
|
||||
void
|
||||
update();
|
||||
|
||||
@@ -41,13 +41,13 @@ public:
|
||||
// creates a new geometry bank. returns: handle to the bank or NULL
|
||||
virtual auto Create_Bank() -> gfx::geometrybank_handle = 0;
|
||||
// creates a new indexed geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
|
||||
virtual auto Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) -> gfx::geometry_handle = 0;
|
||||
virtual auto Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int Type) -> gfx::geometry_handle = 0;
|
||||
// creates a new geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
|
||||
virtual auto Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) -> gfx::geometry_handle = 0;
|
||||
virtual auto Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int Type) -> gfx::geometry_handle = 0;
|
||||
// replaces data of specified chunk with the supplied vertex data, starting from specified offset
|
||||
virtual auto Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type, const std::size_t Offset = 0) -> bool = 0;
|
||||
virtual auto Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int Type, std::size_t Offset = 0) -> bool = 0;
|
||||
// adds supplied vertex data at the end of specified chunk
|
||||
virtual auto Append(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type) -> bool = 0;
|
||||
virtual auto Append(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int Type) -> bool = 0;
|
||||
// provides direct access to index data of specfied chunk
|
||||
virtual auto Indices( gfx::geometry_handle const &Geometry ) const->gfx::index_array const & = 0;
|
||||
// provides direct access to vertex data of specfied chunk
|
||||
@@ -55,19 +55,19 @@ public:
|
||||
// provides direct access to vertex user data of specfied chunk
|
||||
virtual auto UserData( gfx::geometry_handle const &Geometry ) const ->gfx::userdata_array const & = 0;
|
||||
// material methods
|
||||
virtual auto Fetch_Material( std::string const &Filename, bool const Loadnow = true ) -> material_handle = 0;
|
||||
virtual void Bind_Material( material_handle const Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) = 0;
|
||||
virtual auto Material( material_handle const Material ) const -> IMaterial const * = 0;
|
||||
virtual auto Fetch_Material( std::string const &Filename, bool Loadnow = true ) -> material_handle = 0;
|
||||
virtual void Bind_Material( material_handle Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) = 0;
|
||||
virtual auto Material( material_handle Material ) const -> IMaterial const * = 0;
|
||||
// shader methods
|
||||
virtual auto Fetch_Shader( std::string const &name ) -> std::shared_ptr<gl::program> = 0;
|
||||
// texture methods
|
||||
virtual auto Fetch_Texture( std::string const &Filename, bool const Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) -> texture_handle = 0;
|
||||
virtual void Bind_Texture( texture_handle const Texture ) = 0;
|
||||
virtual void Bind_Texture( std::size_t const Unit, texture_handle const Texture ) = 0;
|
||||
virtual auto Texture( texture_handle const Texture ) -> ITexture & = 0;
|
||||
virtual auto Texture( texture_handle const Texture ) const -> ITexture const & = 0;
|
||||
virtual auto Fetch_Texture( std::string const &Filename, bool Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) -> texture_handle = 0;
|
||||
virtual void Bind_Texture( texture_handle Texture ) = 0;
|
||||
virtual void Bind_Texture( std::size_t Unit, texture_handle Texture ) = 0;
|
||||
virtual auto Texture( texture_handle Texture ) -> ITexture & = 0;
|
||||
virtual auto Texture( texture_handle Texture ) const -> ITexture const & = 0;
|
||||
// utility methods
|
||||
virtual void Pick_Control_Callback( std::function<void( TSubModel const *, const glm::vec2 )> Callback ) = 0;
|
||||
virtual void Pick_Control_Callback( std::function<void( TSubModel const *, glm::vec2 )> Callback ) = 0;
|
||||
virtual void Pick_Node_Callback( std::function<void( scene::basic_node * )> Callback ) = 0;
|
||||
virtual auto Pick_Control() const -> TSubModel const * = 0;
|
||||
virtual auto Pick_Node() const -> scene::basic_node const * = 0;
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
virtual auto Camera_Projection_Matrix() const -> glm::mat4 { return glm::mat4( 1.f ); }
|
||||
virtual auto Camera_Position() const -> glm::dvec3 { return glm::dvec3( 0.0 ); }
|
||||
// maintenance methods
|
||||
virtual void Update( double const Deltatime ) = 0;
|
||||
virtual void Update( double Deltatime ) = 0;
|
||||
virtual void Update_Pick_Control() = 0;
|
||||
virtual void Update_Pick_Node() = 0;
|
||||
virtual auto Update_Mouse_Position() -> glm::dvec3 = 0;
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
on_click( TAnimModel const *Instance );
|
||||
// legacy method, finds and assigns traction piece to specified pantograph of provided vehicle
|
||||
void
|
||||
update_traction( TDynamicObject *Vehicle, int const Pantographindex );
|
||||
update_traction( TDynamicObject *Vehicle, int Pantographindex );
|
||||
// legacy method, polls event launchers within radius around specified point
|
||||
void
|
||||
update_events();
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
RaTrackAnimAdd( TTrack *Track );
|
||||
// legacy method, updates geometry for pieces in the animation list
|
||||
void
|
||||
RaAnimate( unsigned int const Framestamp );
|
||||
RaAnimate( unsigned int Framestamp );
|
||||
// sends content of the class to provided stream
|
||||
void
|
||||
serialize( std::ostream &Output ) const;
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
erase( TMemCell *Memorycell );
|
||||
// find a vehicle located nearest to specified point, within specified radius. reurns: located vehicle and distance
|
||||
std::tuple<TDynamicObject *, float>
|
||||
find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler ) const;
|
||||
find( glm::dvec3 const &Point, float Radius, bool Onlycontrolled, bool Findbycoupler ) const;
|
||||
// finds a path with one of its ends located in specified point. returns: located path and id of the matching endpoint
|
||||
std::tuple<TTrack *, int>
|
||||
find( glm::dvec3 const &Point, TTrack const *Exclude ) const;
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
find( glm::dvec3 const &Point, TTraction const *Exclude ) const;
|
||||
// finds a traction piece located nearest to specified point, sharing section with specified other piece and powered in specified direction. returns: located traction piece
|
||||
std::tuple<TTraction *, int, float>
|
||||
find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection ) const;
|
||||
find( glm::dvec3 const &Point, TTraction const *Other, int Currentdirection ) const;
|
||||
// sets center point of the cell
|
||||
void
|
||||
center( glm::dvec3 Center );
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
void
|
||||
create_geometry( gfx::geometrybank_handle const &Bank );
|
||||
void
|
||||
create_map_geometry(std::vector<gfx::basic_vertex> &Bank, const gfx::geometrybank_handle Extra);
|
||||
create_map_geometry(std::vector<gfx::basic_vertex> &Bank, gfx::geometrybank_handle Extra);
|
||||
void
|
||||
get_map_active_paths(map_colored_paths &handles);
|
||||
glm::vec3 find_nearest_track_point(const glm::dvec3 &pos);
|
||||
@@ -261,16 +261,16 @@ public:
|
||||
on_click( TAnimModel const *Instance );
|
||||
// legacy method, finds and assigns traction piece to specified pantograph of provided vehicle
|
||||
void
|
||||
update_traction( TDynamicObject *Vehicle, int const Pantographindex );
|
||||
update_traction( TDynamicObject *Vehicle, int Pantographindex );
|
||||
// legacy method, updates sounds and polls event launchers within radius around specified point
|
||||
void
|
||||
update_events( glm::dvec3 const &Location, float const Radius );
|
||||
update_events( glm::dvec3 const &Location, float Radius );
|
||||
// legacy method, updates sounds and polls event launchers within radius around specified point
|
||||
void
|
||||
update_sounds( glm::dvec3 const &Location, float const Radius );
|
||||
update_sounds( glm::dvec3 const &Location, float Radius );
|
||||
// legacy method, triggers radio-stop procedure for all vehicles in 2km radius around specified location
|
||||
void
|
||||
radio_stop( glm::dvec3 const &Location, float const Radius );
|
||||
radio_stop( glm::dvec3 const &Location, float Radius );
|
||||
// sends content of the class to provided stream
|
||||
void
|
||||
serialize( std::ostream &Output ) const;
|
||||
@@ -310,7 +310,7 @@ public:
|
||||
cell( Point ).register_end( Node ); }
|
||||
// find a vehicle located nearest to specified point, within specified radius. reurns: located vehicle and distance
|
||||
std::tuple<TDynamicObject *, float>
|
||||
find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler );
|
||||
find( glm::dvec3 const &Point, float Radius, bool Onlycontrolled, bool Findbycoupler );
|
||||
// finds a path with one of its ends located in specified point. returns: located path and id of the matching endpoint
|
||||
std::tuple<TTrack *, int>
|
||||
find( glm::dvec3 const &Point, TTrack const *Exclude );
|
||||
@@ -319,7 +319,7 @@ public:
|
||||
find( glm::dvec3 const &Point, TTraction const *Exclude );
|
||||
// finds a traction piece located nearest to specified point, sharing section with specified other piece and powered in specified direction. returns: located traction piece
|
||||
std::tuple<TTraction *, int, float>
|
||||
find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection );
|
||||
find( glm::dvec3 const &Point, TTraction const *Other, int Currentdirection );
|
||||
// sets center point of the section
|
||||
void
|
||||
center( glm::dvec3 Center );
|
||||
@@ -327,7 +327,7 @@ public:
|
||||
void
|
||||
create_geometry();
|
||||
void
|
||||
create_map_geometry(const gfx::geometrybank_handle handle);
|
||||
create_map_geometry(gfx::geometrybank_handle handle);
|
||||
void
|
||||
get_map_active_paths(map_colored_paths &handles);
|
||||
// provides access to bounding area data
|
||||
@@ -379,7 +379,7 @@ public:
|
||||
on_click( TAnimModel const *Instance );
|
||||
// legacy method, finds and assigns traction piece to specified pantograph of provided vehicle
|
||||
void
|
||||
update_traction( TDynamicObject *Vehicle, int const Pantographindex );
|
||||
update_traction( TDynamicObject *Vehicle, int Pantographindex );
|
||||
// legacy method, polls event launchers around camera
|
||||
void
|
||||
update_events();
|
||||
@@ -406,7 +406,7 @@ public:
|
||||
RadioStop( glm::dvec3 const &Location );
|
||||
// inserts provided shape in the region
|
||||
void
|
||||
insert( shape_node Shape, scratch_data &Scratchpad, bool const Transform );
|
||||
insert( shape_node Shape, scratch_data &Scratchpad, bool Transform );
|
||||
// inserts provided lines in the region
|
||||
void
|
||||
insert( lines_node Lines, scratch_data &Scratchpad );
|
||||
@@ -437,7 +437,7 @@ public:
|
||||
section( location ).erase( Node ); } }
|
||||
// find a vehicle located nearest to specified point, within specified radius. reurns: located vehicle and distance
|
||||
std::tuple<TDynamicObject *, float>
|
||||
find_vehicle( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler );
|
||||
find_vehicle( glm::dvec3 const &Point, float Radius, bool Onlycontrolled, bool Findbycoupler );
|
||||
// finds a path with one of its ends located in specified point. returns: located path and id of the matching endpoint
|
||||
std::tuple<TTrack *, int>
|
||||
find_path( glm::dvec3 const &Point, TTrack const *Exclude );
|
||||
@@ -446,10 +446,10 @@ public:
|
||||
find_traction( glm::dvec3 const &Point, TTraction const *Exclude );
|
||||
// finds a traction piece located nearest to specified point, sharing section with specified other piece and powered in specified direction. returns: located traction piece
|
||||
std::tuple<TTraction *, int>
|
||||
find_traction( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection );
|
||||
find_traction( glm::dvec3 const &Point, TTraction const *Other, int Currentdirection );
|
||||
// finds sections inside specified sphere. returns: list of sections
|
||||
std::vector<basic_section *> const &
|
||||
sections( glm::dvec3 const &Point, float const Radius );
|
||||
sections( glm::dvec3 const &Point, float Radius );
|
||||
void
|
||||
create_map_geometry();
|
||||
void
|
||||
|
||||
@@ -33,26 +33,26 @@ class basic_editor {
|
||||
public:
|
||||
// methods
|
||||
void
|
||||
translate( basic_node *Node, glm::dvec3 const &Location, bool const Snaptoground );
|
||||
translate( basic_node *Node, glm::dvec3 const &Location, bool Snaptoground );
|
||||
void
|
||||
translate( basic_node *Node, float const Offset );
|
||||
translate( basic_node *Node, float Offset );
|
||||
void
|
||||
rotate( basic_node *Node, glm::vec3 const &Angle, float const Quantization );
|
||||
rotate( basic_node *Node, glm::vec3 const &Angle, float Quantization );
|
||||
|
||||
private:
|
||||
// methods
|
||||
void
|
||||
translate_node( basic_node *Node, glm::dvec3 const &Location );
|
||||
void
|
||||
translate_node( basic_node *Node, float const Offset );
|
||||
translate_node( basic_node *Node, float Offset );
|
||||
void
|
||||
translate_instance( TAnimModel *Instance, glm::dvec3 const &Location );
|
||||
void
|
||||
translate_instance( TAnimModel *Instance, float const Offset );
|
||||
translate_instance( TAnimModel *Instance, float Offset );
|
||||
void
|
||||
translate_memorycell( TMemCell *Memorycell, glm::dvec3 const &Location );
|
||||
void
|
||||
translate_memorycell( TMemCell *Memorycell, float const Offset );
|
||||
translate_memorycell( TMemCell *Memorycell, float Offset );
|
||||
void
|
||||
rotate_node( basic_node *Node, glm::vec3 const &Angle );
|
||||
void
|
||||
|
||||
@@ -59,7 +59,7 @@ struct bounding_area {
|
||||
serialize( std::ostream &Output ) const;
|
||||
// restores content of the struct from provided input stream.
|
||||
void
|
||||
deserialize( std::istream &Input, bool const Preserveradius = true );
|
||||
deserialize( std::istream &Input, bool Preserveradius = true );
|
||||
};
|
||||
|
||||
//using group_handle = std::size_t;
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
// builds an opaque, always-visible shape from a world-space GL_TRIANGLES vertex list, stored
|
||||
// relative to Origin. used by the editor's terrain to own editable geometry it can re-upload.
|
||||
shape_node &
|
||||
make_terrain( material_handle const Material, std::vector<world_vertex> Vertices, glm::dvec3 const Origin );
|
||||
make_terrain( material_handle Material, std::vector<world_vertex> Vertices, glm::dvec3 Origin );
|
||||
// adds content of provided node to already enclosed geometry. returns: true if merge could be performed
|
||||
bool
|
||||
merge( shape_node &Shape );
|
||||
@@ -344,7 +344,7 @@ public:
|
||||
name() const;
|
||||
virtual std::string tooltip() const;
|
||||
void
|
||||
location( glm::dvec3 const Location );
|
||||
location( glm::dvec3 Location );
|
||||
glm::dvec3 const &
|
||||
location() const;
|
||||
glm::dvec3 &
|
||||
@@ -352,7 +352,7 @@ public:
|
||||
float const &
|
||||
radius();
|
||||
void
|
||||
visible( bool const Visible );
|
||||
visible( bool Visible );
|
||||
bool
|
||||
visible() const;
|
||||
void
|
||||
|
||||
@@ -42,17 +42,17 @@ public:
|
||||
handle() const;
|
||||
// places provided node in specified group
|
||||
void
|
||||
insert( group_handle const Group, basic_node *Node );
|
||||
insert( group_handle Group, basic_node *Node );
|
||||
// places provided event in specified group
|
||||
void
|
||||
insert( group_handle const Group, basic_event *Event );
|
||||
insert( group_handle Group, basic_event *Event );
|
||||
// grants direct access to specified group
|
||||
basic_group &
|
||||
group( group_handle const Group ) {
|
||||
return m_groupmap[ Group ]; }
|
||||
// sends basic content of the class in legacy (text) format to provided stream
|
||||
void
|
||||
export_as_text( std::ostream &Output, bool const Dirty ) const;
|
||||
export_as_text( std::ostream &Output, bool Dirty ) const;
|
||||
|
||||
private:
|
||||
// types
|
||||
|
||||
@@ -131,7 +131,7 @@ class python_taskqueue
|
||||
using rendertask_sequence = threading::lockable<std::deque<std::shared_ptr<render_task>>>;
|
||||
using uploadtask_sequence = threading::lockable<std::deque<std::shared_ptr<render_task>>>;
|
||||
// methods
|
||||
auto fetch_renderer(std::string const Renderer) -> PyObject *;
|
||||
auto fetch_renderer(std::string Renderer) -> PyObject *;
|
||||
void run(GLFWwindow *Context, rendertask_sequence &Tasks, uploadtask_sequence &Upload_Tasks, threading::condition_variable &Condition, std::atomic<bool> &Exit);
|
||||
void error();
|
||||
|
||||
|
||||
@@ -61,13 +61,13 @@ class basic_controller {
|
||||
public:
|
||||
// methods
|
||||
auto load( std::string const &Filename ) -> bool;
|
||||
auto update( double const Timestep ) -> int;
|
||||
auto update( double Timestep ) -> int;
|
||||
// finds element with specified name, potentially creating new element of specified type initialized with provided arguments. returns: handle to the element
|
||||
template<typename ...Args_>
|
||||
auto find_or_insert( std::string const &Name, basic_element::type_e Type = basic_element::type_e::variable, Args_ ...Args ) -> element_handle;
|
||||
// data access
|
||||
auto input( element_handle const Element ) -> int &;
|
||||
auto output( element_handle const Element ) const -> int;
|
||||
auto input( element_handle Element ) -> int &;
|
||||
auto output( element_handle Element ) const -> int;
|
||||
|
||||
private:
|
||||
//types
|
||||
@@ -100,20 +100,17 @@ private:
|
||||
// methods
|
||||
auto deserialize_operation( cParser &Input ) -> bool;
|
||||
// adds provided item to the collection. returns: true if there's no duplicate with the same name, false otherwise
|
||||
auto insert( std::string const Name, basic_element Element ) -> element_handle;
|
||||
auto insert( std::string Name, basic_element Element ) -> element_handle;
|
||||
// runs one cycle of current program. returns: error code or 0 if there's no error
|
||||
auto run() -> int;
|
||||
void log_error( std::string const &Error, int const Line = -1 ) const;
|
||||
void log_error( std::string const &Error, int Line = -1 ) const;
|
||||
auto guess_element_type_from_name( std::string const &Name ) const->basic_element::type_e;
|
||||
inline
|
||||
auto inverse( int const Value ) const -> int {
|
||||
auto inverse( int const Value ) const -> int {
|
||||
return Value == 0 ? 1 : 0; }
|
||||
// element access
|
||||
inline
|
||||
auto element( element_handle const Element ) const -> basic_element const {
|
||||
auto element( element_handle const Element ) const -> basic_element const {
|
||||
return m_elements[ Element - 1 ]; }
|
||||
inline
|
||||
auto element( element_handle const Element ) -> basic_element & {
|
||||
auto element( element_handle const Element ) -> basic_element & {
|
||||
return m_elements[ Element - 1 ]; }
|
||||
// members
|
||||
static std::map<std::string, opcode_e> const m_operationcodemap;
|
||||
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
};
|
||||
|
||||
// passes specified sound to all vehicles within range as a radio message broadcasted on specified channel
|
||||
void radio_message( sound_source *Message, int const Channel );
|
||||
void radio_message( sound_source *Message, int Channel );
|
||||
|
||||
extern state_manager State;
|
||||
extern event_manager Events;
|
||||
|
||||
@@ -32,36 +32,36 @@ public:
|
||||
void update();
|
||||
void update_precipitation();
|
||||
void update_moon();
|
||||
void time( int const Hour = -1, int const Minute = -1, int const Second = -1 );
|
||||
void time( int Hour = -1, int Minute = -1, int Second = -1 );
|
||||
// switches between static and dynamic daylight calculation
|
||||
void on_daylight_change();
|
||||
// calculates current season of the year based on set simulation date
|
||||
void compute_season( int const Yearday );
|
||||
void compute_season( int Yearday );
|
||||
// calculates current weather
|
||||
void compute_weather();
|
||||
// data access
|
||||
inline auto const &
|
||||
auto const &
|
||||
sun() const {
|
||||
return m_sun; }
|
||||
inline auto const &
|
||||
auto const &
|
||||
moon() const {
|
||||
return m_moon; }
|
||||
inline auto const &
|
||||
auto const &
|
||||
light_intensity() const {
|
||||
return m_lightintensity; }
|
||||
inline auto const &
|
||||
auto const &
|
||||
skydome() const {
|
||||
return m_skydome; }
|
||||
inline auto &
|
||||
auto &
|
||||
skydome() {
|
||||
return m_skydome; }
|
||||
inline auto const &
|
||||
auto const &
|
||||
precipitation() const {
|
||||
return m_precipitation; }
|
||||
inline auto const &
|
||||
auto const &
|
||||
wind() const {
|
||||
return m_wind.vector; }
|
||||
inline auto const &
|
||||
auto const &
|
||||
wind_azimuth() const {
|
||||
return m_wind.azimuth; }
|
||||
|
||||
|
||||
@@ -22,27 +22,22 @@ public:
|
||||
void
|
||||
init(time_t timestamp = 0);
|
||||
void
|
||||
update( double const Deltatime );
|
||||
inline
|
||||
SYSTEMTIME &
|
||||
update( double Deltatime );
|
||||
SYSTEMTIME &
|
||||
data() {
|
||||
return m_time; }
|
||||
inline
|
||||
SYSTEMTIME const &
|
||||
SYSTEMTIME const &
|
||||
data() const {
|
||||
return m_time; }
|
||||
inline
|
||||
double
|
||||
double
|
||||
second() const {
|
||||
return m_time.wMilliseconds * 0.001 + m_time.wSecond; }
|
||||
inline
|
||||
int
|
||||
int
|
||||
year_day() const {
|
||||
return m_yearday; }
|
||||
int
|
||||
julian_day() const;
|
||||
inline
|
||||
double
|
||||
double
|
||||
zone_bias() const {
|
||||
return m_timezonebias; }
|
||||
void
|
||||
@@ -56,22 +51,22 @@ private:
|
||||
convert_transition_time( SYSTEMTIME &Time ) const;
|
||||
// calculates day and month from given day of year
|
||||
void
|
||||
daymonth( WORD &Day, WORD &Month, WORD const Year, WORD const Yearday );
|
||||
daymonth( WORD &Day, WORD &Month, WORD Year, WORD Yearday );
|
||||
// calculates day of year from given date
|
||||
int
|
||||
year_day( int Day, int const Month, int const Year ) const;
|
||||
year_day( int Day, int Month, int Year ) const;
|
||||
// calculates day of week for provided date
|
||||
int
|
||||
day_of_week( int const Day, int const Month, int const Year ) const;
|
||||
day_of_week( int Day, int Month, int Year ) const;
|
||||
// calculates day of month for specified weekday of specified month of the year
|
||||
int
|
||||
day_of_month( int const Week, int const Weekday, int const Month, int const Year ) const;
|
||||
day_of_month( int Week, int Weekday, int Month, int Year ) const;
|
||||
// returns number of days between specified days of week
|
||||
int
|
||||
weekdays( int const First, int const Second ) const;
|
||||
weekdays( int First, int Second ) const;
|
||||
// returns true if specified year is a leap year, false otherwise
|
||||
bool
|
||||
is_leap( int const Year ) const;
|
||||
is_leap( int Year ) const;
|
||||
|
||||
SYSTEMTIME m_time;
|
||||
double m_milliseconds{ 0.0 };
|
||||
|
||||
@@ -109,11 +109,11 @@ class float4
|
||||
z = c;
|
||||
w = d;
|
||||
};
|
||||
float inline LengthSquared() const
|
||||
float LengthSquared() const
|
||||
{
|
||||
return x * x + y * y + z * z + w * w;
|
||||
};
|
||||
float inline Length() const
|
||||
float Length() const
|
||||
{
|
||||
return sqrt(x * x + y * y + z * z + w * w);
|
||||
};
|
||||
@@ -246,8 +246,8 @@ public:
|
||||
e[i + 2] = f; // zamiana Y i Z
|
||||
}
|
||||
};
|
||||
inline float4x4 &Rotation(float const angle, float3 const &axis);
|
||||
inline bool IdentityIs()
|
||||
inline float4x4 &Rotation(float angle, float3 const &axis);
|
||||
bool IdentityIs()
|
||||
{ // sprawdzenie jednostkowości
|
||||
for (int i = 0; i < 16; ++i)
|
||||
if (e[i] != (i % 5 ? 0.0 : 1.0)) // jedynki tylko na 0, 5, 10 i 15
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
void Quaternion(float4 *q);
|
||||
inline float3 *TranslationGet()
|
||||
float3 *TranslationGet()
|
||||
{
|
||||
return (float3 *)(e + 12);
|
||||
}
|
||||
|
||||
@@ -359,13 +359,13 @@ struct global_settings {
|
||||
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 );
|
||||
bool ConfigParse_gfx( cParser &parser, std::string_view 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_as_text( std::ostream &Output, std::string Key, Type_ const &Value ) const;
|
||||
};
|
||||
|
||||
template <typename Type_>
|
||||
@@ -377,11 +377,11 @@ global_settings::export_as_text( std::ostream &Output, std::string const Key, Ty
|
||||
|
||||
template <>
|
||||
void
|
||||
global_settings::export_as_text( std::ostream &Output, std::string const Key, std::string const &Value ) const;
|
||||
global_settings::export_as_text( std::ostream &Output, std::string Key, std::string const &Value ) const;
|
||||
|
||||
template <>
|
||||
void
|
||||
global_settings::export_as_text( std::ostream &Output, std::string const Key, bool const &Value ) const;
|
||||
global_settings::export_as_text( std::ostream &Output, std::string Key, bool const &Value ) const;
|
||||
|
||||
extern global_settings& GetGlobalSettings();
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ enum class logtype : unsigned int {
|
||||
powergrid = 1 << 10,
|
||||
};
|
||||
void LogService();
|
||||
void WriteLog( const char *str, logtype const Type = logtype::generic, bool isError = false );
|
||||
void WriteLog( const char *str, logtype Type = logtype::generic, bool isError = false );
|
||||
void Error( const std::string &asMessage, bool box = false );
|
||||
void Error( const char* &asMessage, bool box = false );
|
||||
void ErrorLog( const std::string &str, logtype const Type = logtype::generic );
|
||||
void WriteLog( const std::string &str, logtype const Type = logtype::generic );
|
||||
void ErrorLog( const std::string &str, logtype Type = logtype::generic );
|
||||
void WriteLog( const std::string &str, logtype Type = logtype::generic );
|
||||
void CommLog( const char *str );
|
||||
void CommLog( const std::string &str );
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ struct dictionary_source {
|
||||
dictionary_source() = default;
|
||||
dictionary_source( std::string const &Input );
|
||||
// methods
|
||||
inline void insert( std::string const &Key, double const Value ) { floats.emplace_back( Key, Value ); }
|
||||
inline void insert( std::string const &Key, int const Value ) { integers.emplace_back( Key, Value ); }
|
||||
inline void insert( std::string const &Key, bool const Value ) { bools.emplace_back( Key, Value ); }
|
||||
inline void insert( std::string const &Key, std::string const Value ) { strings.emplace_back( Key, Value ); }
|
||||
inline void insert( std::string const &Key, std::vector<glm::vec2> const Value ) { vec2_lists.emplace_back( Key, Value ); }
|
||||
void insert( std::string const &Key, double const Value ) { floats.emplace_back( Key, Value ); }
|
||||
void insert( std::string const &Key, int const Value ) { integers.emplace_back( Key, Value ); }
|
||||
void insert( std::string const &Key, bool const Value ) { bools.emplace_back( Key, Value ); }
|
||||
void insert( std::string const &Key, std::string const Value ) { strings.emplace_back( Key, Value ); }
|
||||
void insert( std::string const &Key, std::vector<glm::vec2> const Value ) { vec2_lists.emplace_back( Key, Value ); }
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ inline glm::dmat4 BasisChange(glm::dvec3 v, glm::dvec3 n)
|
||||
return BasisChange(u, v, n);
|
||||
}
|
||||
|
||||
template <typename T> inline glm::vec<3, T> RotateY(const glm::vec<3, T> &v, T angle)
|
||||
template <typename T> glm::vec<3, T> RotateY(const glm::vec<3, T> &v, T angle)
|
||||
{
|
||||
T s = std::sin(angle);
|
||||
T c = std::cos(angle);
|
||||
|
||||
@@ -24,7 +24,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
namespace
|
||||
{
|
||||
inline std::array<bool, 256> makeBreakTable(const char *brk)
|
||||
std::array<bool, 256> makeBreakTable(const char *brk)
|
||||
{
|
||||
std::array<bool, 256> arr{};
|
||||
for (const unsigned char c : std::string_view(brk ? brk : ""))
|
||||
@@ -34,7 +34,7 @@ inline std::array<bool, 256> makeBreakTable(const char *brk)
|
||||
return arr;
|
||||
}
|
||||
|
||||
inline char toLowerChar(char c)
|
||||
char toLowerChar(char c)
|
||||
{
|
||||
// Only fold ASCII letters. Bytes >= 0x80 belong to multibyte UTF-8
|
||||
// sequences and must be passed through untouched, otherwise a non-"C"
|
||||
@@ -45,7 +45,7 @@ inline char toLowerChar(char c)
|
||||
return c;
|
||||
}
|
||||
|
||||
inline bool startsWithBOM(const std::string &s)
|
||||
bool startsWithBOM(const std::string &s)
|
||||
{
|
||||
return s.size() >= 3
|
||||
&& static_cast<unsigned char>(s[0]) == 0xEF
|
||||
|
||||
@@ -28,7 +28,7 @@ class cParser //: public std::stringstream
|
||||
buffer_TEXT
|
||||
};
|
||||
// constructors:
|
||||
cParser(std::string const &Stream, buffertype const Type = buffer_TEXT, std::string Path = "", bool const Loadtraction = true, std::vector<std::string> Parameters = std::vector<std::string>(), bool allowRandom = false );
|
||||
cParser(std::string const &Stream, buffertype Type = buffer_TEXT, std::string Path = "", bool Loadtraction = true, std::vector<std::string> Parameters = std::vector<std::string>(), bool allowRandom = false );
|
||||
// destructor:
|
||||
virtual ~cParser();
|
||||
// methods:
|
||||
@@ -42,29 +42,24 @@ class cParser //: public std::stringstream
|
||||
Output_ output;
|
||||
*this >> output;
|
||||
return output; };
|
||||
inline
|
||||
void
|
||||
void
|
||||
ignoreToken() {
|
||||
std::string out;
|
||||
readToken(out); };
|
||||
inline
|
||||
bool
|
||||
bool
|
||||
expectToken( std::string const &Value ) {
|
||||
std::string out;
|
||||
readToken(out);
|
||||
return out == Value; };
|
||||
inline
|
||||
bool
|
||||
bool
|
||||
eof() {
|
||||
return mStream->eof(); };
|
||||
inline
|
||||
bool
|
||||
bool
|
||||
ok() {
|
||||
return !mStream->fail(); };
|
||||
cParser &
|
||||
autoclear( bool const Autoclear );
|
||||
inline
|
||||
bool
|
||||
autoclear( bool Autoclear );
|
||||
bool
|
||||
autoclear() const {
|
||||
return m_autoclear; }
|
||||
bool
|
||||
@@ -74,8 +69,7 @@ class cParser //: public std::stringstream
|
||||
void substituteParameters(std::string &token, bool ToLower);
|
||||
void skipIncludeBlock();
|
||||
// returns next incoming token, if any, without removing it from the set
|
||||
inline
|
||||
std::string
|
||||
std::string
|
||||
peek() const {
|
||||
return false == tokens.empty() ? tokens.front() : ""; }
|
||||
// inject string as internal include
|
||||
@@ -104,7 +98,7 @@ class cParser //: public std::stringstream
|
||||
// methods:
|
||||
void readToken(std::string& out, bool ToLower = true, const char *Break = "\n\r\t ;");
|
||||
static std::vector<std::string> readParameters( cParser &Input );
|
||||
std::string readQuotes( char const Quote = '\"' );
|
||||
std::string readQuotes( char Quote = '\"' );
|
||||
void skipComment( std::string const &Endmark );
|
||||
bool findQuotes( std::string &String );
|
||||
bool trimComments( std::string &String );
|
||||
@@ -131,7 +125,7 @@ class cParser //: public std::stringstream
|
||||
|
||||
template <>
|
||||
glm::vec3
|
||||
cParser::getToken( bool const ToLower, const char *Break );
|
||||
cParser::getToken( bool ToLower, const char *Break );
|
||||
|
||||
|
||||
template<typename Type_>
|
||||
@@ -157,4 +151,4 @@ cParser::operator>>( bool &Right );
|
||||
|
||||
template<>
|
||||
bool
|
||||
cParser::getToken<bool>( bool const ToLower, const char *Break );
|
||||
cParser::getToken<bool>( bool ToLower, const char *Break );
|
||||
|
||||
@@ -109,8 +109,8 @@ inline bool TestFlagAny(int const Flag, int const Value)
|
||||
{
|
||||
return (Flag & Value) != 0;
|
||||
}
|
||||
bool SetFlag(int &Flag, int const Value);
|
||||
bool ClearFlag(int &Flag, int const Value);
|
||||
bool SetFlag(int &Flag, int Value);
|
||||
bool ClearFlag(int &Flag, int Value);
|
||||
|
||||
bool FuzzyLogic(double Test, double Threshold, double Probability);
|
||||
/*jesli Test>Threshold to losowanie*/
|
||||
@@ -124,11 +124,11 @@ std::pair<std::string, int> split_string_and_number(std::string const &Key);
|
||||
std::string to_string(int Value, int width);
|
||||
std::string to_string(double Value, int precision);
|
||||
std::string to_string(double Value, int precision, int width);
|
||||
std::string to_hex_str(int const Value, int const width = 4);
|
||||
std::string to_minutes_str(float const Minutes, bool const Leadingzero, int const Width);
|
||||
std::string to_hex_str(int Value, int width = 4);
|
||||
std::string to_minutes_str(float Minutes, bool Leadingzero, int Width);
|
||||
|
||||
template <std::same_as<bool> T> // Without this line this function can be used with other types implicit casted to boolean which may create hard to debug bugs.
|
||||
inline std::string to_string(T Value)
|
||||
std::string to_string(T Value)
|
||||
{
|
||||
return Value == true ? "true" : "false";
|
||||
}
|
||||
@@ -151,7 +151,7 @@ std::string ToUpper(std::string const &text);
|
||||
// replaces polish letters with basic ascii
|
||||
void win1250_to_ascii(std::string &Input);
|
||||
// TODO: unify with win1250_to_ascii()
|
||||
std::string Bezogonkow(std::string Input, bool const Underscorestospaces = false);
|
||||
std::string Bezogonkow(std::string Input, bool Underscorestospaces = false);
|
||||
|
||||
std::string win1250_to_utf8(const std::string &input);
|
||||
|
||||
@@ -224,17 +224,17 @@ std::string substr_path(std::string const &Filename);
|
||||
std::ptrdiff_t len_common_prefix(std::string_view a, std::string_view b);
|
||||
|
||||
// returns true if provided string contains another provided string
|
||||
bool contains(std::string_view const String, std::string_view Substring);
|
||||
bool contains(std::string_view const String, char Character);
|
||||
bool contains(std::string_view String, std::string_view Substring);
|
||||
bool contains(std::string_view String, char Character);
|
||||
|
||||
// TODO: Ideally unique_ptr should be used instead of this (not safe) inline functions
|
||||
template <typename T> inline void SafeDelete(T* &Pointer)
|
||||
template <typename T> void SafeDelete(T* &Pointer)
|
||||
{
|
||||
delete Pointer;
|
||||
Pointer = nullptr;
|
||||
}
|
||||
|
||||
template <typename T> inline void SafeDeleteArray(T *&Pointer)
|
||||
template <typename T> void SafeDeleteArray(T *&Pointer)
|
||||
{
|
||||
delete[] Pointer;
|
||||
Pointer = nullptr;
|
||||
|
||||
@@ -13,7 +13,7 @@ public:
|
||||
|
||||
|
||||
static UID random() {
|
||||
static thread_local std::mt19937_64 gen(std::random_device{}());
|
||||
thread_local std::mt19937_64 gen(std::random_device{}());
|
||||
UID u;
|
||||
const uint64_t a = gen();
|
||||
const uint64_t b = gen();
|
||||
|
||||
@@ -29,19 +29,19 @@ public:
|
||||
///Loads info about coupler.
|
||||
void Load(cParser *Parser, TModel3d *Model);
|
||||
int GetStatus();
|
||||
inline void TurnOn() ///Turns on straight coupler.
|
||||
void TurnOn() ///Turns on straight coupler.
|
||||
{
|
||||
On = true;
|
||||
xOn = false;
|
||||
Update();
|
||||
};
|
||||
inline void TurnOff() ///Turns on disconnected coupler.
|
||||
void TurnOff() ///Turns on disconnected coupler.
|
||||
{
|
||||
On = false;
|
||||
xOn = false;
|
||||
Update();
|
||||
};
|
||||
inline void TurnxOn() ///Turns on slanted coupler.
|
||||
void TurnxOn() ///Turns on slanted coupler.
|
||||
{
|
||||
On = false;
|
||||
xOn = true;
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
};
|
||||
|
||||
// if the xOn model is missing, activate plain On instead
|
||||
inline void TurnxOnWithOnAsFallback()
|
||||
void TurnxOnWithOnAsFallback()
|
||||
{
|
||||
if (ModelxOn != nullptr) {
|
||||
On = false;
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
}
|
||||
};
|
||||
// if the xOn model is missing, activate plain Off instead
|
||||
inline void TurnxOnWithOffAsFallback()
|
||||
void TurnxOnWithOffAsFallback()
|
||||
{
|
||||
if (ModelxOn != nullptr) {
|
||||
On = false;
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
TurnOff();
|
||||
}
|
||||
};
|
||||
inline bool Active() const
|
||||
bool Active() const
|
||||
{
|
||||
return ModelOn != nullptr || ModelxOn != nullptr;
|
||||
};
|
||||
|
||||
@@ -18,25 +18,22 @@ class TButton {
|
||||
public:
|
||||
// methods
|
||||
TButton() = default;
|
||||
void Clear(int const i = -1);
|
||||
inline
|
||||
void FeedbackBitSet( int const i ) {
|
||||
void Clear(int i = -1);
|
||||
void FeedbackBitSet( int const i ) {
|
||||
iFeedbackBit = 1 << i; };
|
||||
void Turn( bool const State );
|
||||
inline
|
||||
bool GetValue() const {
|
||||
void Turn( bool State );
|
||||
bool GetValue() const {
|
||||
return m_state; }
|
||||
inline
|
||||
bool Active() {
|
||||
bool Active() {
|
||||
return pModelOn != nullptr || pModelOff != nullptr; }
|
||||
void Update( bool const Power = true );
|
||||
void Update( bool Power = true );
|
||||
bool Init( std::string const &asName, TModel3d const *pModel, bool bNewOn = false );
|
||||
void Load( cParser &Parser, TDynamicObject const *Owner );
|
||||
void AssignBool(bool const *bValue);
|
||||
// returns offset of submodel associated with the button from the model centre
|
||||
glm::vec3 model_offset() const;
|
||||
void gain(float new_volume);
|
||||
inline uint8_t b() { return m_state ? 1 : 0; };
|
||||
uint8_t b() { return m_state ? 1 : 0; };
|
||||
|
||||
private:
|
||||
// methods
|
||||
|
||||
@@ -19,7 +19,7 @@ class TCamera {
|
||||
public: // McZapkie: potrzebuje do kiwania na boki
|
||||
void Init(glm::dvec3 const &Location, glm::dvec3 const &Angle, TDynamicObject *Owner);
|
||||
void Reset();
|
||||
void OnCursorMove(double const x, double const y);
|
||||
void OnCursorMove(double x, double y);
|
||||
bool OnCommand( command_data const &Command );
|
||||
void Update();
|
||||
bool SetMatrix(glm::dmat4 &Matrix);
|
||||
|
||||
120
vehicle/Driver.h
120
vehicle/Driver.h
@@ -172,8 +172,7 @@ class TSpeedPos
|
||||
void Clear();
|
||||
bool Update();
|
||||
// aktualizuje odległość we wpisie
|
||||
inline
|
||||
void
|
||||
void
|
||||
UpdateDistance( double dist ) {
|
||||
fDist -= dist; }
|
||||
bool Set(basic_event *e, double d, double length, TOrders order = Wait_for_orders);
|
||||
@@ -221,48 +220,35 @@ public:
|
||||
public:
|
||||
void Update( double dt ); // uruchamiac przynajmniej raz na sekundę
|
||||
void MoveTo( TDynamicObject *to );
|
||||
void TakeControl( bool const Aidriver, bool const Forcevehiclecheck = false );
|
||||
inline
|
||||
bool primary( bool const Primary ) {
|
||||
void TakeControl( bool Aidriver, bool Forcevehiclecheck = false );
|
||||
bool primary( bool const Primary ) {
|
||||
SetFlag( iDrivigFlags, Primary ? movePrimary : -movePrimary );
|
||||
return primary(); }
|
||||
inline
|
||||
bool primary() const {
|
||||
bool primary() const {
|
||||
return (iDrivigFlags & movePrimary) != 0; };
|
||||
inline
|
||||
TMoverParameters const *Controlling() const {
|
||||
TMoverParameters const *Controlling() const {
|
||||
return mvControlling; }
|
||||
inline
|
||||
TMoverParameters const *Occupied() const {
|
||||
TMoverParameters const *Occupied() const {
|
||||
return mvOccupied; }
|
||||
void DirectionInitial();
|
||||
void DirectionChange();
|
||||
inline
|
||||
int Direction() const {
|
||||
int Direction() const {
|
||||
return iDirection; }
|
||||
inline
|
||||
TAction & action() {
|
||||
TAction & action() {
|
||||
return eAction; }
|
||||
inline
|
||||
TAction const & action() const {
|
||||
TAction const & action() const {
|
||||
return eAction; }
|
||||
inline
|
||||
bool is_active() const {
|
||||
bool is_active() const {
|
||||
return TestFlag( iDrivigFlags, moveActive ); }
|
||||
inline
|
||||
bool is_train() const {
|
||||
bool is_train() const {
|
||||
return TestFlag( mvOccupied->CategoryFlag, 1 ); }
|
||||
inline
|
||||
bool is_car() const {
|
||||
bool is_car() const {
|
||||
return TestFlag( mvOccupied->CategoryFlag, 2 ); }
|
||||
inline
|
||||
bool is_emu() const {
|
||||
bool is_emu() const {
|
||||
return mvControlling->TrainType == dt_EZT; }
|
||||
inline
|
||||
bool is_dmu() const {
|
||||
bool is_dmu() const {
|
||||
return mvControlling->TrainType == dt_DMU; }
|
||||
inline
|
||||
bool has_diesel_engine() const {
|
||||
bool has_diesel_engine() const {
|
||||
return mvControlling->EngineType == TEngineType::DieselElectric || mvControlling->EngineType == TEngineType::DieselEngine;
|
||||
}
|
||||
TBrakeSystem consist_brake_system() const;
|
||||
@@ -276,11 +262,11 @@ private:
|
||||
void ZeroLocalBrake();
|
||||
bool IncSpeed();
|
||||
bool DecSpeed( bool force = false );
|
||||
void ZeroSpeed( bool const Enforce = false );
|
||||
void ZeroSpeed( bool Enforce = false );
|
||||
bool IncBrakeEIM();
|
||||
bool DecBrakeEIM();
|
||||
bool IncSpeedEIM();
|
||||
bool DecSpeedEIM( int const Amount = 1 );
|
||||
bool DecSpeedEIM( int Amount = 1 );
|
||||
void BrakeLevelSet( double b );
|
||||
bool BrakeLevelAdd( double b );
|
||||
void SpeedSet();
|
||||
@@ -303,25 +289,23 @@ private:
|
||||
double BrakeAccFactor() const;
|
||||
// modifies brake distance for low target speeds, to ease braking rate in such situations
|
||||
float
|
||||
braking_distance_multiplier( float const Targetvelocity ) const;
|
||||
inline
|
||||
int DrivigFlags() const {
|
||||
braking_distance_multiplier( float Targetvelocity ) const;
|
||||
int DrivigFlags() const {
|
||||
return iDrivigFlags; };
|
||||
inline
|
||||
double DirectionalVel() const {
|
||||
double DirectionalVel() const {
|
||||
return mvOccupied->Vel * sign( iDirection * mvOccupied->V ); }
|
||||
|
||||
void update_timers( double const dt );
|
||||
void update_logs( double const dt );
|
||||
void update_timers( double dt );
|
||||
void update_logs( double dt );
|
||||
void determine_consist_state();
|
||||
void determine_braking_distance();
|
||||
void determine_proximity_ranges();
|
||||
void scan_route( double const Range );
|
||||
void scan_obstacles( double const Range );
|
||||
void scan_route( double Range );
|
||||
void scan_obstacles( double Range );
|
||||
void control_wheelslip();
|
||||
void control_pantographs();
|
||||
void control_horns( double const Timedelta );
|
||||
void control_security_system( double const Timedelta );
|
||||
void control_horns( double Timedelta );
|
||||
void control_security_system( double Timedelta );
|
||||
void control_handles();
|
||||
void control_lights();
|
||||
void control_compartment_lights();
|
||||
@@ -334,15 +318,15 @@ private:
|
||||
void check_departure();
|
||||
void UpdateConnect();
|
||||
void UpdateDisconnect();
|
||||
int unit_count( int const Threshold ) const;
|
||||
int unit_count( int Threshold ) const;
|
||||
void UpdateChangeDirection();
|
||||
void UpdateLooseShunt();
|
||||
void UpdateObeyTrain();
|
||||
void GuardOpenDoor();
|
||||
void pick_optimal_speed( double const Range );
|
||||
void pick_optimal_speed( double Range );
|
||||
void adjust_desired_speed_for_obstacles();
|
||||
void adjust_desired_speed_for_limits();
|
||||
void adjust_desired_speed_for_target_speed( double const Range );
|
||||
void adjust_desired_speed_for_target_speed( double Range );
|
||||
void adjust_desired_speed_for_current_speed();
|
||||
void adjust_desired_speed_for_braking_test();
|
||||
void control_tractive_and_braking_force();
|
||||
@@ -354,16 +338,16 @@ private:
|
||||
void increase_tractive_force();
|
||||
void control_braking_force();
|
||||
void apply_independent_brake_only();
|
||||
void check_route_ahead( double const Range );
|
||||
void check_route_behind( double const Range );
|
||||
void check_route_ahead( double Range );
|
||||
void check_route_behind( double Range );
|
||||
void UpdateBrakingHelper();
|
||||
void hint( driver_hint const Value, hintpredicate const Predicate, float const Predicateparameter = 0.f );
|
||||
void hint( driver_hint Value, hintpredicate Predicate, float Predicateparameter = 0.f );
|
||||
void update_hints();
|
||||
void remove_hint( driver_hint const Value );
|
||||
void remove_hint( driver_hint Value );
|
||||
void remove_train_brake_hints();
|
||||
void remove_master_controller_hints();
|
||||
void remove_reverser_hints();
|
||||
void cue_action( driver_hint const Action, float const Actionparameter = 0.f );
|
||||
void cue_action( driver_hint Action, float Actionparameter = 0.f );
|
||||
// members
|
||||
public:
|
||||
bool AIControllFlag = false; // rzeczywisty/wirtualny maszynista
|
||||
@@ -472,12 +456,12 @@ public:
|
||||
void PutCommand( std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation, TStopReason reason = stopComm );
|
||||
bool PutCommand( std::string NewCommand, double NewValue1, double NewValue2, glm::dvec3 const *NewLocation, TStopReason reason = stopComm );
|
||||
// defines assignment data
|
||||
inline auto assignment() -> std::string & { return m_assignment; }
|
||||
inline auto assignment() const -> std::string const & { return m_assignment; }
|
||||
auto assignment() -> std::string & { return m_assignment; }
|
||||
auto assignment() const -> std::string const & { return m_assignment; }
|
||||
std::string OrderCurrent() const;
|
||||
private:
|
||||
void RecognizeCommand(); // odczytuje komende przekazana lokomotywie
|
||||
void JumpToNextOrder( bool const Skipmergedchangedirection = false );
|
||||
void JumpToNextOrder( bool Skipmergedchangedirection = false );
|
||||
void JumpToFirstOrder();
|
||||
void OrderPush( TOrders NewOrder );
|
||||
void OrderNext( TOrders NewOrder );
|
||||
@@ -486,7 +470,7 @@ private:
|
||||
void OrderCheck();
|
||||
void OrdersInit( double fVel );
|
||||
void OrdersClear();
|
||||
void OrdersDump( std::string const Neworder, bool const Verbose = true );
|
||||
void OrdersDump( std::string Neworder, bool Verbose = true );
|
||||
std::string Order2Str( TOrders Order ) const;
|
||||
// members
|
||||
std::string m_assignment;
|
||||
@@ -499,39 +483,39 @@ private:
|
||||
// methods
|
||||
public:
|
||||
int CrossRoute( TTrack *tr );
|
||||
inline void MoveDistanceAdd( double distance ) {
|
||||
void MoveDistanceAdd( double distance ) {
|
||||
dMoveLen += distance * iDirection;
|
||||
} //jak jedzie do tyłu to trzeba uwzględniać, że distance jest ujemna
|
||||
private:
|
||||
// Ra: metody obsługujące skanowanie toru
|
||||
std::vector<basic_event *> CheckTrackEvent( TTrack *Track, double const fDirection ) const;
|
||||
std::vector<basic_event *> CheckTrackEvent( TTrack *Track, double fDirection ) const;
|
||||
bool TableAddNew();
|
||||
bool TableNotFound( basic_event const *Event, double const Distance ) const;
|
||||
bool TableNotFound( basic_event const *Event, double Distance ) const;
|
||||
void TableTraceRoute( double fDistance, TDynamicObject *pVehicle );
|
||||
void TableCheck( double fDistance );
|
||||
TCommandType TableUpdate( double &fVelDes, double &fDist, double &fNext, double &fAcc );
|
||||
bool TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, double const Signaldistance );
|
||||
bool TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPos &Point, double &Signaldistance, int const Pointindex );
|
||||
bool TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, double Signaldistance );
|
||||
bool TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPos &Point, double &Signaldistance, int Pointindex );
|
||||
// returns most recently calculated distance to potential obstacle ahead
|
||||
double TrackObstacle() const;
|
||||
void TablePurger();
|
||||
void TableSort();
|
||||
inline double MoveDistanceGet() const {
|
||||
double MoveDistanceGet() const {
|
||||
return dMoveLen;
|
||||
}
|
||||
inline void MoveDistanceReset() {
|
||||
void MoveDistanceReset() {
|
||||
dMoveLen = 0.0;
|
||||
}
|
||||
std::size_t TableSize() const { return sSpeedTable.size(); }
|
||||
void TableClear();
|
||||
int TableDirection() { return iTableDirection; }
|
||||
// Ra: stare funkcje skanujące, używane do szukania sygnalizatora z tyłu
|
||||
bool IsOccupiedByAnotherConsist( TTrack *Track, double const Distance );
|
||||
basic_event *CheckTrackEventBackward( double fDirection, TTrack *Track, TDynamicObject *Vehicle, int const Eventdirection = 1, end const End = rear );
|
||||
TTrack *BackwardTraceRoute( double &fDistance, double &fDirection, TDynamicObject *Vehicle, basic_event *&Event, int const Eventdirection = 1, end const End = rear, bool const Untiloccupied = true );
|
||||
bool IsOccupiedByAnotherConsist( TTrack *Track, double Distance );
|
||||
basic_event *CheckTrackEventBackward( double fDirection, TTrack *Track, TDynamicObject *Vehicle, int Eventdirection = 1, end End = rear );
|
||||
TTrack *BackwardTraceRoute( double &fDistance, double &fDirection, TDynamicObject *Vehicle, basic_event *&Event, int Eventdirection = 1, end End = rear, bool Untiloccupied = true );
|
||||
void SetProximityVelocity( double dist, double vel, glm::dvec3 const *pos );
|
||||
TCommandType BackwardScan( double const Range );
|
||||
std::string TableText( std::size_t const Index ) const;
|
||||
TCommandType BackwardScan( double Range );
|
||||
std::string TableText( std::size_t Index ) const;
|
||||
/*
|
||||
void RouteSwitch(int d);
|
||||
*/
|
||||
@@ -582,12 +566,12 @@ public:
|
||||
private:
|
||||
bool PrepareEngine();
|
||||
bool ReleaseEngine();
|
||||
void Doors( bool const Open, int const Side = 0 );
|
||||
void Doors( bool Open, int Side = 0 );
|
||||
// returns true if any vehicle in the consist has an open door
|
||||
bool doors_open() const;
|
||||
bool doors_permit_active() const;
|
||||
void AutoRewident(); // ustawia hamulce w składzie
|
||||
void announce( announcement_t const Announcement );
|
||||
void announce( announcement_t Announcement );
|
||||
// members
|
||||
double fLength = 0.0; // długość składu (do wyciągania z ograniczeń)
|
||||
double fMass = 0.0; // całkowita masa do liczenia stycznej składowej grawitacji
|
||||
|
||||
115
vehicle/DynObj.h
115
vehicle/DynObj.h
@@ -217,12 +217,12 @@ public:
|
||||
std::string asDestination; // dokąd pojazd ma być kierowany "(stacja):(tor)"
|
||||
glm::dmat4 mMatrix; // macierz przekształcenia do renderowania modeli
|
||||
TMoverParameters *MoverParameters; // parametry fizyki ruchu oraz przeliczanie
|
||||
inline TDynamicObject *NextConnected() { return MoverParameters->Neighbours[ rear ].vehicle; }; // pojazd podłączony od strony sprzęgu 1 (kabina -1)
|
||||
inline TDynamicObject *PrevConnected() { return MoverParameters->Neighbours[ front ].vehicle; }; // pojazd podłączony od strony sprzęgu 0 (kabina 1)
|
||||
inline TDynamicObject *NextConnected() const { return MoverParameters->Neighbours[ rear ].vehicle; }; // pojazd podłączony od strony sprzęgu 1 (kabina -1)
|
||||
inline TDynamicObject *PrevConnected() const { return MoverParameters->Neighbours[ front ].vehicle; }; // pojazd podłączony od strony sprzęgu 0 (kabina 1)
|
||||
inline int NextConnectedNo() const { return MoverParameters->Neighbours[ rear ].vehicle_end; }
|
||||
inline int PrevConnectedNo() const { return MoverParameters->Neighbours[ front ].vehicle_end; }
|
||||
TDynamicObject *NextConnected() { return MoverParameters->Neighbours[ rear ].vehicle; }; // pojazd podłączony od strony sprzęgu 1 (kabina -1)
|
||||
TDynamicObject *PrevConnected() { return MoverParameters->Neighbours[ front ].vehicle; }; // pojazd podłączony od strony sprzęgu 0 (kabina 1)
|
||||
TDynamicObject *NextConnected() const { return MoverParameters->Neighbours[ rear ].vehicle; }; // pojazd podłączony od strony sprzęgu 1 (kabina -1)
|
||||
TDynamicObject *PrevConnected() const { return MoverParameters->Neighbours[ front ].vehicle; }; // pojazd podłączony od strony sprzęgu 0 (kabina 1)
|
||||
int NextConnectedNo() const { return MoverParameters->Neighbours[ rear ].vehicle_end; }
|
||||
int PrevConnectedNo() const { return MoverParameters->Neighbours[ front ].vehicle_end; }
|
||||
|
||||
// Dev tools
|
||||
void Reload();
|
||||
@@ -272,8 +272,7 @@ private:
|
||||
material_data m_materialdata;
|
||||
|
||||
public:
|
||||
inline
|
||||
material_data const
|
||||
material_data const
|
||||
*Material() const {
|
||||
return &m_materialdata; }
|
||||
// tymczasowo udostępnione do wyszukiwania drutu
|
||||
@@ -436,8 +435,8 @@ private:
|
||||
sound_source rsEngageSlippery { sound_placement::engine }; // moved from cab
|
||||
sound_source retarder { sound_placement::engine };
|
||||
|
||||
void position( glm::vec3 const Location );
|
||||
void render( TMoverParameters const &Vehicle, double const Deltatime );
|
||||
void position( glm::vec3 Location );
|
||||
void render( TMoverParameters const &Vehicle, double Deltatime );
|
||||
};
|
||||
// single source per door (pair) on the centreline
|
||||
struct doorspeaker_sounds {
|
||||
@@ -464,7 +463,7 @@ private:
|
||||
void ABuModelRoll();
|
||||
void TurnOff();
|
||||
// update state of load exchange operation
|
||||
void update_exchange( double const Deltatime );
|
||||
void update_exchange( double Deltatime );
|
||||
|
||||
// members
|
||||
AirCoupler btCoupler1; // sprzegi
|
||||
@@ -606,7 +605,7 @@ private:
|
||||
std::string asModel;
|
||||
|
||||
private:
|
||||
TDynamicObject *ABuFindObject( int &Foundcoupler, double &Distance, TTrack const *Track, int const Direction, int const Mycoupler ) const;
|
||||
TDynamicObject *ABuFindObject( int &Foundcoupler, double &Distance, TTrack const *Track, int Direction, int Mycoupler ) const;
|
||||
void ABuCheckMyTrack();
|
||||
|
||||
std::string rTypeName; // nazwa typu pojazdu
|
||||
@@ -618,7 +617,7 @@ private:
|
||||
bool HeadlightsAoff{false}; // wygaszone swiatelki A
|
||||
bool HeadlightsBoff{false}; // wygaszone swiatelki B
|
||||
// checks whether there's unbroken connection of specified type to specified vehicle
|
||||
bool is_connected( TDynamicObject const *Vehicle, coupling const Coupling = coupler ) const;
|
||||
bool is_connected( TDynamicObject const *Vehicle, coupling Coupling = coupler ) const;
|
||||
TDynamicObject * PrevAny() const;
|
||||
TDynamicObject * Prev(int C = -1) const;
|
||||
TDynamicObject * Next(int C = -1) const;
|
||||
@@ -670,15 +669,15 @@ private:
|
||||
std::string Name, std::string BaseDir, std::string asReplacableSkin, std::string Type_Name,
|
||||
TTrack *Track, double fDist, std::string DriverType, double fVel, std::string TrainName,
|
||||
float Load, std::string LoadType, bool Reversed, std::string);
|
||||
int init_sections( TModel3d const *Model, std::string const &Nameprefix, bool const Overrideselfillum );
|
||||
int init_sections( TModel3d const *Model, std::string const &Nameprefix, bool Overrideselfillum );
|
||||
bool init_destination( TModel3d *Model );
|
||||
void create_controller( std::string const Type, bool const Trainset );
|
||||
void create_controller( std::string Type, bool Trainset );
|
||||
void AttachNext(TDynamicObject *Object, int iType = 1);
|
||||
bool UpdateForce(double dt);
|
||||
// initiates load change by specified amounts, with a platform on specified side
|
||||
void LoadExchange( int const Disembark, int const Embark, int const Platforms );
|
||||
void LoadExchange( int Disembark, int Embark, int Platforms );
|
||||
// calculates time needed to complete current load change, using specified platforms
|
||||
float LoadExchangeTime( int const Platforms );
|
||||
float LoadExchangeTime( int Platforms );
|
||||
// calculates time needed to complete current load change, using previously specified platforms
|
||||
float LoadExchangeTime() const;
|
||||
// calculates current load exchange factor, where 1 = nominal rate, higher = faster
|
||||
@@ -694,83 +693,83 @@ private:
|
||||
void Move(double fDistance);
|
||||
void FastMove(double fDistance);
|
||||
void RenderSounds();
|
||||
inline glm::dvec3 GetPosition() const {
|
||||
glm::dvec3 GetPosition() const {
|
||||
return vPosition; };
|
||||
// converts location from vehicle coordinates frame to world frame
|
||||
inline glm::dvec3 GetWorldPosition( glm::dvec3 const &Location ) const {
|
||||
glm::dvec3 GetWorldPosition( glm::dvec3 const &Location ) const {
|
||||
return vPosition + glm::dvec3(mMatrix * glm::dvec4(Location, 1.0)); }
|
||||
// pobranie współrzędnych czoła
|
||||
inline glm::dvec3 HeadPosition() const {
|
||||
glm::dvec3 HeadPosition() const {
|
||||
return vCoulpler[iDirection ^ 1]; };
|
||||
// pobranie współrzędnych tyłu
|
||||
inline glm::dvec3 RearPosition() const {
|
||||
glm::dvec3 RearPosition() const {
|
||||
return vCoulpler[iDirection]; };
|
||||
inline glm::dvec3 CouplerPosition( end const End ) const {
|
||||
glm::dvec3 CouplerPosition( end const End ) const {
|
||||
return vCoulpler[ End ]; }
|
||||
inline glm::dvec3 AxlePositionGet() {
|
||||
glm::dvec3 AxlePositionGet() {
|
||||
return iAxleFirst ?
|
||||
Axle1.pPosition :
|
||||
Axle0.pPosition; };
|
||||
inline double Roll() {
|
||||
double Roll() {
|
||||
return Axle1.GetRoll() + Axle0.GetRoll(); }
|
||||
/*
|
||||
// TODO: check if scanning takes into account direction when selecting axle
|
||||
// if it does, replace the version above
|
||||
// if it doesn't, fix it so it does
|
||||
inline glm::dvec3 AxlePositionGet() {
|
||||
return (
|
||||
iDirection ?
|
||||
( iAxleFirst ? Axle1.pPosition : Axle0.pPosition ) :
|
||||
( iAxleFirst ? Axle0.pPosition : Axle1.pPosition ) ); }
|
||||
*/
|
||||
inline glm::dvec3 VectorFront() const {
|
||||
// TODO: check if scanning takes into account direction when selecting axle
|
||||
// if it does, replace the version above
|
||||
// if it doesn't, fix it so it does
|
||||
inline glm::dvec3 AxlePositionGet() {
|
||||
return (
|
||||
iDirection ?
|
||||
( iAxleFirst ? Axle1.pPosition : Axle0.pPosition ) :
|
||||
( iAxleFirst ? Axle0.pPosition : Axle1.pPosition ) ); }
|
||||
*/
|
||||
glm::dvec3 VectorFront() const {
|
||||
return vFront; };
|
||||
inline glm::dvec3 VectorUp() const {
|
||||
glm::dvec3 VectorUp() const {
|
||||
return vUp; };
|
||||
inline glm::dvec3 VectorLeft() const {
|
||||
glm::dvec3 VectorLeft() const {
|
||||
return vLeft; };
|
||||
inline double const * Matrix() const {
|
||||
double const * Matrix() const {
|
||||
return glm::value_ptr(mMatrix); };
|
||||
inline double * Matrix() {
|
||||
double * Matrix() {
|
||||
return glm::value_ptr(mMatrix); };
|
||||
inline double GetVelocity() const {
|
||||
double GetVelocity() const {
|
||||
return MoverParameters->Vel; };
|
||||
inline double GetLength() const {
|
||||
double GetLength() const {
|
||||
return MoverParameters->Dim.L; };
|
||||
inline double GetWidth() const {
|
||||
double GetWidth() const {
|
||||
return MoverParameters->Dim.W; };
|
||||
double radius() const;
|
||||
// calculates distance between event-starting axle and front of the vehicle
|
||||
double tracing_offset() const;
|
||||
inline TTrack * GetTrack() {
|
||||
TTrack * GetTrack() {
|
||||
return iAxleFirst ? Axle1.GetTrack() : Axle0.GetTrack(); };
|
||||
|
||||
// McZapkie-260202
|
||||
void LoadMMediaFile(std::string const &TypeName, std::string const &ReplacableSkin);
|
||||
TModel3d *LoadMMediaFile_mdload( std::string const &Name ) const;
|
||||
|
||||
inline double ABuGetDirection() const { // ABu.
|
||||
double ABuGetDirection() const { // ABu.
|
||||
return Axle1.GetTrack() == MyTrack ? Axle1.GetDirection() : Axle0.GetDirection(); };
|
||||
// zwraca kierunek pojazdu na torze z aktywną osą
|
||||
inline double RaDirectionGet() const {
|
||||
double RaDirectionGet() const {
|
||||
return iAxleFirst ?
|
||||
Axle1.GetDirection() :
|
||||
Axle0.GetDirection(); };
|
||||
// zwraca przesunięcie wózka względem Point1 toru z aktywną osią
|
||||
inline double RaTranslationGet() const {
|
||||
double RaTranslationGet() const {
|
||||
return iAxleFirst ?
|
||||
Axle1.GetTranslation() :
|
||||
Axle0.GetTranslation(); };
|
||||
// zwraca tor z aktywną osią
|
||||
inline TTrack const * RaTrackGet() const {
|
||||
TTrack const * RaTrackGet() const {
|
||||
return iAxleFirst ?
|
||||
Axle1.GetTrack() :
|
||||
Axle0.GetTrack(); };
|
||||
|
||||
void couple( int const Side );
|
||||
int uncouple( int const Side );
|
||||
bool attach_coupler_adapter( int const Side, bool const Enforce = false );
|
||||
bool remove_coupler_adapter( int const Side );
|
||||
void couple( int Side );
|
||||
int uncouple( int Side );
|
||||
bool attach_coupler_adapter( int Side, bool Enforce = false );
|
||||
bool remove_coupler_adapter( int Side );
|
||||
void RadioStop();
|
||||
void Damage(char flag);
|
||||
void pants_up();
|
||||
@@ -781,8 +780,8 @@ private:
|
||||
bool has_signal_pc1_on() const;
|
||||
bool has_signal_pc2_on() const;
|
||||
bool has_signal_pc5_on() const;
|
||||
bool has_signal_on( int const Side, int const Pattern ) const;
|
||||
void set_cab_lights( int const Cab, float const Level );
|
||||
bool has_signal_on( int Side, int Pattern ) const;
|
||||
void set_cab_lights( int Cab, float Level );
|
||||
TDynamicObject * FirstFind(int &coupler_nr, int cf = 1);
|
||||
float GetEPP(); // wyliczanie sredniego cisnienia w PG
|
||||
int DirectionSet(int d); // ustawienie kierunku w składzie
|
||||
@@ -795,14 +794,14 @@ private:
|
||||
// updates potential collision sources
|
||||
void update_neighbours();
|
||||
// locates potential collision source within specified range, scanning its route in specified direction
|
||||
auto find_vehicle( int const Direction, double const Range ) const -> std::tuple<TDynamicObject *, int, double, bool>;
|
||||
auto find_vehicle( int Direction, double Range ) const -> std::tuple<TDynamicObject *, int, double, bool>;
|
||||
// locates potential vehicle connected with specific coupling type and satisfying supplied predicate
|
||||
template <typename Predicate_>
|
||||
auto find_vehicle( coupling const Coupling, Predicate_ const Predicate ) -> TDynamicObject *;
|
||||
auto find_vehicle( coupling Coupling, Predicate_ Predicate ) -> TDynamicObject *;
|
||||
TDynamicObject * FindPowered();
|
||||
TDynamicObject * FindPantographCarrier();
|
||||
template <typename UnaryFunction_>
|
||||
void for_each( coupling const Coupling, UnaryFunction_ const Function );
|
||||
void for_each( coupling Coupling, UnaryFunction_ Function );
|
||||
void ParamSet(int what, int into);
|
||||
// zapytanie do AI, po którym segmencie skrzyżowania jechać
|
||||
int RouteWish(TTrack *tr);
|
||||
@@ -812,7 +811,7 @@ private:
|
||||
glm::dvec3 get_future_movement() const;
|
||||
void move_set(double distance);
|
||||
// playes specified announcement, potentially preceding it with a chime
|
||||
void announce( announcement_t const Announcement, bool const Chime = true );
|
||||
void announce( announcement_t Announcement, bool Chime = true );
|
||||
// returns soundproofing for specified sound type and listener location
|
||||
float soundproofing( int const Placement, int const Listener ) const {
|
||||
return m_soundproofing[ Placement - 1 ][ Listener + 1 ]; }
|
||||
@@ -829,7 +828,7 @@ private:
|
||||
// TBD, TODO: make an object out of it
|
||||
public:
|
||||
// methods
|
||||
void update_shake( double const Timedelta );
|
||||
void update_shake( double Timedelta );
|
||||
std::pair<double, double> shake_angles() const;
|
||||
// members
|
||||
struct baseshake_config {
|
||||
@@ -874,7 +873,7 @@ public:
|
||||
update_traction( TDynamicObject *Vehicle );
|
||||
// legacy method, sends list of vehicles over network
|
||||
void
|
||||
DynamicList( bool const Onlycontrolled = false ) const;
|
||||
DynamicList( bool Onlycontrolled = false ) const;
|
||||
|
||||
private:
|
||||
// maintenance; removes from tracks consists with vehicles marked as disabled
|
||||
|
||||
@@ -38,17 +38,16 @@ public:
|
||||
TGauge() = default;
|
||||
explicit TGauge( sound_source const &Soundtemplate );
|
||||
|
||||
inline
|
||||
void Clear() {
|
||||
void Clear() {
|
||||
*this = TGauge(); }
|
||||
void Init(TSubModel *Submodel, TSubModel *Submodelon, TGaugeAnimation Type, float Scale = 1, float Offset = 0, float Friction = 0, float Value = 0, float const Endvalue = -1.0, float const Endscale = -1.0, bool const Interpolate = false );
|
||||
void Load(cParser &Parser, TDynamicObject const *Owner, double const mul = 1.0);
|
||||
void Init(TSubModel *Submodel, TSubModel *Submodelon, TGaugeAnimation Type, float Scale = 1, float Offset = 0, float Friction = 0, float Value = 0, float Endvalue = -1.0, float Endscale = -1.0, bool Interpolate = false );
|
||||
void Load(cParser &Parser, TDynamicObject const *Owner, double mul = 1.0);
|
||||
bool UpdateValue( float fNewDesired );
|
||||
bool UpdateValue( float fNewDesired, std::optional<sound_source> &Fallbacksound );
|
||||
void PutValue(float fNewDesired);
|
||||
float GetValue() const;
|
||||
float GetDesiredValue() const;
|
||||
void Update( bool const Power = true );
|
||||
void Update( bool Power = true );
|
||||
void AssignFloat(float *fValue);
|
||||
void AssignDouble(double *dValue);
|
||||
void AssignInt(int *iValue);
|
||||
@@ -58,11 +57,9 @@ public:
|
||||
// returns offset of submodel associated with the button from the model centre
|
||||
glm::vec3 model_offset() const;
|
||||
TGaugeType type() const;
|
||||
inline
|
||||
bool is_push() const {
|
||||
bool is_push() const {
|
||||
return ( static_cast<int>( type() ) & static_cast<int>( TGaugeType::push ) ) != 0; }
|
||||
inline
|
||||
bool is_toggle() const {
|
||||
bool is_toggle() const {
|
||||
return ( static_cast<int>( type() ) & static_cast<int>( TGaugeType::toggle ) ) != 0; }
|
||||
bool is_delayed() const {
|
||||
return ( static_cast<int>( type() ) & static_cast<int>( TGaugeType::delayed ) ) != 0; }
|
||||
|
||||
@@ -35,7 +35,7 @@ class TCab {
|
||||
public:
|
||||
// methods
|
||||
void Load(cParser &Parser);
|
||||
void Update( bool const Power );
|
||||
void Update( bool Power );
|
||||
TGauge &Gauge( int n = -1 ); // pobranie adresu obiektu
|
||||
TButton &Button( int n = -1 ); // pobranie adresu obiektu
|
||||
// members
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
std::string
|
||||
find( TSubModel const *Control ) const;
|
||||
bool
|
||||
contains( std::string const Control ) const;
|
||||
contains( std::string Control ) const;
|
||||
};
|
||||
|
||||
class TTrain {
|
||||
@@ -153,30 +153,28 @@ class TTrain {
|
||||
// McZapkie-010302
|
||||
bool Init(TDynamicObject *NewDynamicObject, bool e3d = false);
|
||||
|
||||
inline glm::dvec3 GetDirection() const
|
||||
glm::dvec3 GetDirection() const
|
||||
{
|
||||
return DynamicObject->VectorFront(); };
|
||||
inline glm::dvec3 GetUp() const
|
||||
glm::dvec3 GetUp() const
|
||||
{
|
||||
return DynamicObject->VectorUp(); };
|
||||
inline
|
||||
std::string GetLabel( TSubModel const *Control ) const {
|
||||
std::string GetLabel( TSubModel const *Control ) const {
|
||||
return m_controlmapper.find( Control ); }
|
||||
void UpdateCab();
|
||||
bool Update( double const Deltatime );
|
||||
bool Update( double Deltatime );
|
||||
void UpdateDirectionRelays();
|
||||
void SetupDirectionRelays();
|
||||
bool prevBatState = false;
|
||||
int prevDirection = 0;
|
||||
void add_distance( double const Distance );
|
||||
void add_distance( double Distance );
|
||||
// McZapkie-310302: ladowanie parametrow z pliku
|
||||
bool LoadMMediaFile(std::string const &asFileName);
|
||||
std::shared_ptr<dictionary_source> GetTrainState( dictionary_source const &Extraparameters );
|
||||
state_t get_state() const;
|
||||
inline float get_radiovolume() const { return m_radiovolume; }
|
||||
float get_radiovolume() const { return m_radiovolume; }
|
||||
// basic_table interface
|
||||
inline
|
||||
std::string name() const {
|
||||
std::string name() const {
|
||||
return Dynamic()->name(); }
|
||||
|
||||
private:
|
||||
@@ -188,39 +186,37 @@ class TTrain {
|
||||
void clear_cab_controls();
|
||||
// sets cabin controls based on current state of the vehicle
|
||||
// NOTE: we can get rid of this function once we have per-cab persistent state
|
||||
void set_cab_controls( int const Cab );
|
||||
void set_cab_controls( int Cab );
|
||||
// initializes a gauge matching provided label. returns: true if the label was found, false otherwise
|
||||
bool initialize_gauge(cParser &Parser, std::string const &Label, int const Cabindex);
|
||||
bool initialize_gauge(cParser &Parser, std::string const &Label, int Cabindex);
|
||||
// initializes a button matching provided label. returns: true if the label was found, false otherwise
|
||||
bool initialize_button(cParser &Parser, std::string const &Label, int const Cabindex);
|
||||
bool initialize_button(cParser &Parser, std::string const &Label, int Cabindex);
|
||||
// helper, returns true for EMU with oerlikon brake
|
||||
bool is_eztoer() const;
|
||||
// locates nearest vehicle belonging to the consist
|
||||
TDynamicObject *find_nearest_consist_vehicle(bool freefly, glm::vec3 pos) const;
|
||||
// mover master controller to specified position
|
||||
void set_master_controller( double const Position );
|
||||
void set_master_controller( double Position );
|
||||
// moves train brake lever to specified position, potentially emits switch sound if conditions are met
|
||||
void set_train_brake( double const Position );
|
||||
void set_train_brake( double Position );
|
||||
// potentially moves train brake lever to neutral position
|
||||
void zero_charging_train_brake();
|
||||
// sets specified brake acting speed for specified vehicle, potentially updating state of cab controls to match
|
||||
void set_train_brake_speed( TDynamicObject *Vehicle, int const Speed );
|
||||
void set_train_brake_speed( TDynamicObject *Vehicle, int Speed );
|
||||
// sets the motor connector button in paired unit to specified state
|
||||
void set_paired_open_motor_connectors_button( bool const State );
|
||||
void set_paired_open_motor_connectors_button( bool State );
|
||||
// helper, common part of pantograph selection methods
|
||||
void change_pantograph_selection( int const Change );
|
||||
void change_pantograph_selection( int Change );
|
||||
// helper, common part of pantograh valves state update methods
|
||||
void update_pantograph_valves();
|
||||
// update function subroutines
|
||||
void update_sounds( double const Deltatime );
|
||||
void update_sounds( double Deltatime );
|
||||
void update_sounds_runningnoise( sound_source &Sound );
|
||||
void update_sounds_resonancenoise( sound_source &Sound );
|
||||
void update_sounds_radio();
|
||||
inline
|
||||
end cab_to_end( int const End ) const {
|
||||
end cab_to_end( int const End ) const {
|
||||
return End == 2 ? rear : front; }
|
||||
inline
|
||||
end cab_to_end() const {
|
||||
end cab_to_end() const {
|
||||
return cab_to_end( iCabn ); }
|
||||
void update_screens(double dt);
|
||||
|
||||
@@ -922,19 +918,19 @@ private:
|
||||
float fDieselParams[9][10]; // parametry dla silnikow asynchronicznych
|
||||
// plays provided sound from position of the radio
|
||||
bool radio_message_played;
|
||||
void radio_message( sound_source *Message, int const Channel );
|
||||
inline auto const RadioChannel() const { return Dynamic()->Mechanik ? Dynamic()->Mechanik->iRadioChannel : 1; }
|
||||
inline auto &RadioChannel() { return Dynamic()->Mechanik->iRadioChannel; }
|
||||
inline TDynamicObject *Dynamic() { return DynamicObject; };
|
||||
inline TDynamicObject const *Dynamic() const { return DynamicObject; };
|
||||
inline TMoverParameters *Controlled() { return mvControlled; };
|
||||
inline TMoverParameters const *Controlled() const { return mvControlled; };
|
||||
inline TMoverParameters *Occupied() { return mvOccupied; };
|
||||
inline TMoverParameters const *Occupied() const { return mvOccupied; };
|
||||
void radio_message( sound_source *Message, int Channel );
|
||||
auto const RadioChannel() const { return Dynamic()->Mechanik ? Dynamic()->Mechanik->iRadioChannel : 1; }
|
||||
auto &RadioChannel() { return Dynamic()->Mechanik->iRadioChannel; }
|
||||
TDynamicObject *Dynamic() { return DynamicObject; };
|
||||
TDynamicObject const *Dynamic() const { return DynamicObject; };
|
||||
TMoverParameters *Controlled() { return mvControlled; };
|
||||
TMoverParameters const *Controlled() const { return mvControlled; };
|
||||
TMoverParameters *Occupied() { return mvOccupied; };
|
||||
TMoverParameters const *Occupied() const { return mvOccupied; };
|
||||
void DynamicSet(TDynamicObject *d);
|
||||
void MoveToVehicle( TDynamicObject *target );
|
||||
// checks whether specified point is within boundaries of the active cab
|
||||
bool point_inside(glm::dvec3 const Point) const;
|
||||
bool point_inside(glm::dvec3 Point) const;
|
||||
glm::dvec3 clamp_inside(glm::dvec3 const &Point) const;
|
||||
const screenentry_sequence & get_screens();
|
||||
|
||||
@@ -946,7 +942,7 @@ class train_table : public basic_table<TTrain> {
|
||||
public:
|
||||
void update( double dt );
|
||||
void updateAsync( double dt );
|
||||
TTrain *find_id( std::uint16_t const Id ) const;
|
||||
TTrain *find_id( std::uint16_t Id ) const;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -13,7 +13,7 @@ class vehicleparams_panel : public ui_panel
|
||||
command_relay m_relay;
|
||||
texture_handle vehicle_mini;
|
||||
|
||||
void draw_infobutton(const char *str, ImVec2 pos = ImVec2(-1.0f, -1.0f), const ImVec4 color = ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
|
||||
void draw_infobutton(const char *str, ImVec2 pos = ImVec2(-1.0f, -1.0f), ImVec4 color = ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
|
||||
void draw_mini(const TMoverParameters &mover);
|
||||
public:
|
||||
vehicleparams_panel(const std::string &vehicle);
|
||||
|
||||
@@ -34,8 +34,7 @@ public:
|
||||
bool check_activation();
|
||||
// checks conditions associated with the event. returns: true if the conditions are met
|
||||
bool check_conditions();
|
||||
inline
|
||||
auto key() const {
|
||||
auto key() const {
|
||||
return iKey; }
|
||||
bool IsGlobal() const;
|
||||
bool IsRadioActivated() const;
|
||||
|
||||
@@ -128,7 +128,7 @@ protected:
|
||||
};
|
||||
// methods
|
||||
template <class TableType_>
|
||||
void init_targets( TableType_ &Repository, std::string const &Targettype, bool const Logerrors = true );
|
||||
void init_targets( TableType_ &Repository, std::string const &Targettype, bool Logerrors = true );
|
||||
// returns true if provided token is a an event desription keyword, false otherwise
|
||||
static bool is_keyword( std::string const &Token );
|
||||
|
||||
@@ -648,7 +648,7 @@ public:
|
||||
queue( TEventLauncher *Launcher );
|
||||
// inserts in the event query events assigned to event launchers capable of receiving specified radio message sent from specified location
|
||||
void
|
||||
queue_receivers( radio_message const Message, glm::dvec3 const &Location );
|
||||
queue_receivers( radio_message Message, glm::dvec3 const &Location );
|
||||
// legacy method, updates event queues
|
||||
void
|
||||
update();
|
||||
@@ -656,16 +656,14 @@ public:
|
||||
// TBD, TODO: return handle to the event
|
||||
bool
|
||||
insert( basic_event *Event );
|
||||
inline
|
||||
bool
|
||||
bool
|
||||
insert( TEventLauncher *Launcher ) {
|
||||
return Launcher->IsRadioActivated() ? m_radiodrivenlaunchers.insert(Launcher) : m_inputdrivenlaunchers.insert(Launcher); }
|
||||
inline void purge (TEventLauncher *Launcher) {
|
||||
void purge (TEventLauncher *Launcher) {
|
||||
m_radiodrivenlaunchers.purge(Launcher);
|
||||
m_inputdrivenlaunchers.purge(Launcher); }
|
||||
// returns first event in the queue
|
||||
inline
|
||||
basic_event *
|
||||
basic_event *
|
||||
begin() {
|
||||
return QueryRootEvent; }
|
||||
|
||||
@@ -677,7 +675,7 @@ public:
|
||||
// legacy method, returns pointer to specified event, or null
|
||||
basic_event *
|
||||
FindEvent( std::string const &Name );
|
||||
inline TEventLauncher* FindEventlauncher(std::string const &Name) {
|
||||
TEventLauncher * FindEventlauncher(std::string const &Name) {
|
||||
const auto ptr = m_inputdrivenlaunchers.find(Name);
|
||||
return ptr ? ptr : m_radiodrivenlaunchers.find(Name);
|
||||
}
|
||||
|
||||
@@ -21,17 +21,17 @@ public:
|
||||
explicit TMemCell( scene::node_data const &Nodedata );
|
||||
// methods
|
||||
void
|
||||
UpdateValues( std::string const &szNewText, double const fNewValue1, double const fNewValue2, int const CheckMask );
|
||||
UpdateValues( std::string const &szNewText, double fNewValue1, double fNewValue2, int CheckMask );
|
||||
bool
|
||||
Load(cParser *parser);
|
||||
void
|
||||
PutCommand( TController *Mech, glm::dvec3 const *Loc ) const;
|
||||
bool
|
||||
Compare( std::string const &szTestText, double const fTestValue1, double const fTestValue2, int const CheckMask,
|
||||
comparison_operator const TextOperator = comparison_operator::equal,
|
||||
comparison_operator const Value1Operator = comparison_operator::equal,
|
||||
comparison_operator const Value2Operator = comparison_operator::equal,
|
||||
comparison_pass const Pass = comparison_pass::all ) const;
|
||||
Compare( std::string const &szTestText, double fTestValue1, double fTestValue2, int CheckMask,
|
||||
comparison_operator TextOperator = comparison_operator::equal,
|
||||
comparison_operator Value1Operator = comparison_operator::equal,
|
||||
comparison_operator Value2Operator = comparison_operator::equal,
|
||||
comparison_pass Pass = comparison_pass::all ) const;
|
||||
std::string const &
|
||||
Text() const {
|
||||
return szText; }
|
||||
|
||||
@@ -54,11 +54,11 @@ class TSegment
|
||||
glm::dvec3 vA, vB, vC; // współczynniki wielomianów trzeciego stopnia vD==Point1
|
||||
TTrack *pOwner = nullptr; // wskaźnik na właściciela
|
||||
|
||||
glm::dvec3 GetFirstDerivative(double const fTime) const;
|
||||
double RombergIntegral(double const fA, double const fB) const;
|
||||
double GetTFromS(double const s) const;
|
||||
glm::dvec3 RaInterpolate(double const t) const;
|
||||
glm::dvec3 RaInterpolate0(double const t) const;
|
||||
glm::dvec3 GetFirstDerivative(double fTime) const;
|
||||
double RombergIntegral(double fA, double fB) const;
|
||||
double GetTFromS(double s) const;
|
||||
glm::dvec3 RaInterpolate(double t) const;
|
||||
glm::dvec3 RaInterpolate0(double t) const;
|
||||
|
||||
public:
|
||||
bool bCurve = false;
|
||||
@@ -71,22 +71,19 @@ public:
|
||||
// finds point on segment closest to specified point in 3d space. returns: point on segment as value in range 0-1
|
||||
double
|
||||
find_nearest_point( glm::dvec3 const &Point ) const;
|
||||
inline
|
||||
glm::dvec3
|
||||
glm::dvec3
|
||||
GetDirection1() const {
|
||||
return bCurve ? CPointOut - Point1 : CPointOut; };
|
||||
inline
|
||||
glm::dvec3
|
||||
glm::dvec3
|
||||
GetDirection2() const {
|
||||
return bCurve ? CPointIn - Point2 : CPointIn; };
|
||||
glm::dvec3
|
||||
GetDirection(double const fDistance) const;
|
||||
inline
|
||||
glm::dvec3
|
||||
GetDirection(double fDistance) const;
|
||||
glm::dvec3
|
||||
GetDirection() const {
|
||||
return CPointOut; };
|
||||
glm::dvec3
|
||||
FastGetDirection(double const fDistance, double const fOffset);
|
||||
FastGetDirection(double fDistance, double fOffset);
|
||||
/*
|
||||
Math3D::vector3
|
||||
GetPoint(double const fDistance) const;
|
||||
@@ -98,39 +95,33 @@ public:
|
||||
/// <param name="fDistance">Distance from p1</param>
|
||||
/// <param name="position">Calculated position</param>
|
||||
/// <param name="rotation">Calculated rotation</param>
|
||||
void RaPositionGet(double const fDistance, glm::dvec3 &position, glm::vec3 &rotation) const;
|
||||
glm::dvec3 FastGetPoint(double const t) const;
|
||||
inline
|
||||
glm::dvec3
|
||||
void RaPositionGet(double fDistance, glm::dvec3 &position, glm::vec3 &rotation) const;
|
||||
glm::dvec3 FastGetPoint(double t) const;
|
||||
glm::dvec3
|
||||
FastGetPoint_0() const {
|
||||
return Point1; };
|
||||
inline
|
||||
glm::dvec3
|
||||
glm::dvec3
|
||||
FastGetPoint_1() const {
|
||||
return Point2; };
|
||||
inline
|
||||
float
|
||||
float
|
||||
GetRoll(double const Distance) const {
|
||||
return std::lerp( fRoll1, fRoll2, static_cast<float>(Distance / fLength) ); }
|
||||
inline
|
||||
void
|
||||
void
|
||||
GetRolls(float &r1, float &r2) const {
|
||||
// pobranie przechyłek (do generowania trójkątów)
|
||||
r1 = fRoll1;
|
||||
r2 = fRoll2; }
|
||||
|
||||
bool
|
||||
RenderLoft( gfx::vertex_array &Output, glm::dvec3 const &Origin, gfx::vertex_array const &ShapePoints, bool const Transition, double fTextureLength, double Texturescale = 1.0, int iSkip = 0, int iEnd = 0, std::pair<float, float> fOffsetX = {0.f, 0.f}, glm::vec3 **p = nullptr, bool bRender = true );
|
||||
RenderLoft( gfx::vertex_array &Output, glm::dvec3 const &Origin, gfx::vertex_array const &ShapePoints, bool Transition, double fTextureLength, double Texturescale = 1.0, int iSkip = 0, int iEnd = 0, std::pair<float, float> fOffsetX = {0.f, 0.f}, glm::vec3 **p = nullptr, bool bRender = true );
|
||||
/*
|
||||
void
|
||||
Render();
|
||||
*/
|
||||
inline
|
||||
double
|
||||
void
|
||||
Render();
|
||||
*/
|
||||
double
|
||||
GetLength() const {
|
||||
return fLength; };
|
||||
inline
|
||||
int
|
||||
int
|
||||
RaSegCount() const {
|
||||
return fTsBuffer.empty() ? 1 : iSegCount; };
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class TTraction;
|
||||
class TSwitchExtension
|
||||
{ // dodatkowe dane do toru, który jest zwrotnicą
|
||||
public:
|
||||
TSwitchExtension(TTrack *owner, int const what);
|
||||
TSwitchExtension(TTrack *owner, int what);
|
||||
~TSwitchExtension();
|
||||
std::shared_ptr<TSegment> Segments[6]; // dwa tory od punktu 1, pozosta³e dwa od 2? Ra 140101: 6 po³¹czeñ dla skrzy¿owañ
|
||||
TTrack *pNexts[2]; // tory do³¹czone do punktów 2 i 4
|
||||
@@ -112,24 +112,19 @@ public:
|
||||
static TIsolated * Find(const std::string &n); // znalezienie obiektu albo utworzenie nowego
|
||||
void AssignEvents();
|
||||
void Modify(int i, TDynamicObject *o); // dodanie lub odjęcie osi
|
||||
inline
|
||||
bool
|
||||
bool
|
||||
Busy() {
|
||||
return iAxles > 0; };
|
||||
inline
|
||||
static TIsolated *
|
||||
static TIsolated *
|
||||
Root() {
|
||||
return pRoot; };
|
||||
inline
|
||||
TIsolated *
|
||||
TIsolated *
|
||||
Next() {
|
||||
return pNext; };
|
||||
inline
|
||||
void
|
||||
void
|
||||
parent( TIsolated *Parent ) {
|
||||
pParent = Parent; }
|
||||
inline
|
||||
TIsolated *
|
||||
TIsolated *
|
||||
parent() const {
|
||||
return pParent; }
|
||||
// members
|
||||
@@ -249,39 +244,38 @@ public:
|
||||
static bool sort_by_material( TTrack const *Left, TTrack const *Right );
|
||||
static TTrack * Create400m(int what, double dx);
|
||||
TTrack * NullCreate(int dir);
|
||||
inline bool IsEmpty() {
|
||||
bool IsEmpty() {
|
||||
return Dynamics.empty(); };
|
||||
void ConnectPrevPrev(TTrack *pNewPrev, int typ);
|
||||
void ConnectPrevNext(TTrack *pNewPrev, int typ);
|
||||
void ConnectNextPrev(TTrack *pNewNext, int typ);
|
||||
void ConnectNextNext(TTrack *pNewNext, int typ);
|
||||
material_handle copy_adjacent_trackbed_material( TTrack const *Exclude = nullptr );
|
||||
inline double Length() const {
|
||||
double Length() const {
|
||||
return Segment->GetLength(); };
|
||||
inline std::shared_ptr<TSegment> CurrentSegment() const {
|
||||
std::shared_ptr<TSegment> CurrentSegment() const {
|
||||
return Segment; };
|
||||
inline TTrack *CurrentNext() const {
|
||||
TTrack *CurrentNext() const {
|
||||
return trNext; };
|
||||
inline TTrack *CurrentPrev() const {
|
||||
TTrack *CurrentPrev() const {
|
||||
return trPrev; };
|
||||
TTrack *Connected(int s, double &d) const;
|
||||
bool SetConnections(int i);
|
||||
bool Switch(int i, float const t = -1.f, float const d = -1.f);
|
||||
bool Switch(int i, float t = -1.f, float d = -1.f);
|
||||
bool SwitchForced(int i, TDynamicObject *o);
|
||||
int CrossSegment(int from, int into);
|
||||
inline int GetSwitchState() {
|
||||
int GetSwitchState() {
|
||||
return SwitchExtension ? SwitchExtension->CurrentIndex : -1; };
|
||||
// returns number of different routes possible to take from given point
|
||||
// TODO: specify entry point, number of routes for switches can vary
|
||||
inline
|
||||
int
|
||||
int
|
||||
RouteCount() const {
|
||||
return SwitchExtension != nullptr ? SwitchExtension->iRoads - 1 : 1; }
|
||||
void Load(cParser *parser, glm::dvec3 const &pOrigin);
|
||||
bool AssignEvents();
|
||||
bool AssignForcedEvents(basic_event *NewEventPlus, basic_event *NewEventMinus);
|
||||
void QueueEvents( event_sequence const &Events, TDynamicObject const *Owner );
|
||||
void QueueEvents( event_sequence const &Events, TDynamicObject const *Owner, double const Delaylimit );
|
||||
void QueueEvents( event_sequence const &Events, TDynamicObject const *Owner, double Delaylimit );
|
||||
bool CheckDynamicObject(TDynamicObject *Dynamic);
|
||||
bool AddDynamicObject(TDynamicObject *Dynamic);
|
||||
bool RemoveDynamicObject(TDynamicObject *Dynamic);
|
||||
@@ -300,7 +294,7 @@ public:
|
||||
double ActiveLength();
|
||||
|
||||
void create_geometry( gfx::geometrybank_handle const &Bank ); // wypełnianie VBO
|
||||
void create_map_geometry(std::vector<gfx::basic_vertex> &Bank, const gfx::geometrybank_handle Extra);
|
||||
void create_map_geometry(std::vector<gfx::basic_vertex> &Bank, gfx::geometrybank_handle Extra);
|
||||
void get_map_active_paths(map_colored_paths &handles);
|
||||
void get_map_paths_for_state(map_colored_paths &handles, int state);
|
||||
void get_map_future_paths(map_colored_paths &handles);
|
||||
@@ -325,7 +319,7 @@ public:
|
||||
double WidthTotal();
|
||||
bool IsGroupable();
|
||||
int TestPoint(const glm::dvec3 *Point);
|
||||
void MovedUp1(float const dh);
|
||||
void MovedUp1(float dh);
|
||||
void VelocitySet(float v);
|
||||
double VelocityGet();
|
||||
float Friction() const;
|
||||
@@ -352,16 +346,16 @@ private:
|
||||
// loads content of specified file and converts it into a vertex array
|
||||
static gfx::vertex_array deserialize_profile( std::string const &Profile );
|
||||
// provides direct access to vertex data of specified profile
|
||||
static gfx::vertex_array const & track_rail_profile( int const Profile );
|
||||
static gfx::vertex_array const & track_rail_profile( int Profile );
|
||||
// returns texture length for specified material
|
||||
float texture_length( material_handle const Material );
|
||||
float texture_length( material_handle Material );
|
||||
// creates profile for a part of current path
|
||||
void create_switch_trackbed( gfx::vertex_array &Output );
|
||||
void create_track_rail_profile( gfx::vertex_array &Right, gfx::vertex_array &Left );
|
||||
void create_track_blade_profile( gfx::vertex_array &Right, gfx::vertex_array &Left );
|
||||
void create_track_bed_profile( gfx::vertex_array &Output, TTrack const *Previous, TTrack const *Next );
|
||||
void create_road_profile( gfx::vertex_array &Output, bool const Forcetransition = false );
|
||||
void create_road_side_profile( gfx::vertex_array &Right, gfx::vertex_array &Left, gfx::vertex_array const &Road, bool const Forcetransition = false );
|
||||
void create_road_profile( gfx::vertex_array &Output, bool Forcetransition = false );
|
||||
void create_road_side_profile( gfx::vertex_array &Right, gfx::vertex_array &Left, gfx::vertex_array const &Road, bool Forcetransition = false );
|
||||
/// <summary>
|
||||
/// resolves the sleeper model/skin via the model and material managers, and fills
|
||||
/// m_sleeper_local_transforms by walking the active segment(s) at m_sleeper_frequency.
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
// constructor
|
||||
TTractionPowerSource( scene::node_data const &Nodedata );
|
||||
// methods
|
||||
void Init(double const u, double const i);
|
||||
void Init(double u, double i);
|
||||
bool Load(cParser *parser);
|
||||
bool Update(double dt);
|
||||
double CurrentGet(double res);
|
||||
@@ -73,7 +73,7 @@ class powergridsource_table : public basic_table<TTractionPowerSource> {
|
||||
public:
|
||||
// legacy method, calculates changes in simulation state over specified time
|
||||
void
|
||||
update( double const Deltatime );
|
||||
update( double Deltatime );
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -24,17 +24,17 @@ public:
|
||||
// methods
|
||||
TTrack * SetCurrentTrack(TTrack *pTrack, int end);
|
||||
bool Move(double fDistance, bool bPrimary);
|
||||
inline TTrack * GetTrack() const {
|
||||
TTrack * GetTrack() const {
|
||||
return pCurrentTrack; };
|
||||
// przechyłka policzona przy ustalaniu pozycji
|
||||
inline double GetRoll() {
|
||||
double GetRoll() {
|
||||
return vAngles.x; };
|
||||
//{return pCurrentSegment->GetRoll(fCurrentDistance)*fDirection;}; //zamiast liczyć można pobrać
|
||||
// zwrot na torze
|
||||
inline double GetDirection() const {
|
||||
double GetDirection() const {
|
||||
return fDirection; };
|
||||
// ABu-030403
|
||||
inline double GetTranslation() const {
|
||||
double GetTranslation() const {
|
||||
return fCurrentDistance; };
|
||||
// inline double GetLength(vector3 p1, vector3 cp1, vector3 cp2, vector3 p2)
|
||||
//{ return pCurrentSegment->ComputeLength(p1,cp1,cp2,p2); };
|
||||
|
||||
@@ -77,7 +77,7 @@ class TTrainParameters
|
||||
bool IsMaintenance() const;
|
||||
bool IsTimeToGo(double hh, double mm);
|
||||
// returns: difference between specified time and scheduled departure from current stop, in seconds
|
||||
double seconds_until_departure( double const Hour, double const Minute ) const;
|
||||
double seconds_until_departure( double Hour, double Minute ) const;
|
||||
bool UpdateMTable(double hh, double mm, std::string const &NewName);
|
||||
bool UpdateMTable( scenario_time const &Time, std::string const &NewName );
|
||||
bool RewindTimeTable( std::string actualStationName );
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
// methods
|
||||
// exchanges load with consist attached to specified vehicle, operating on specified schedule; returns: time needed for exchange, in seconds
|
||||
double
|
||||
update_load( TDynamicObject *First, Mtable::TTrainParameters &Schedule, int const Platform );
|
||||
update_load( TDynamicObject *First, Mtable::TTrainParameters &Schedule, int Platform );
|
||||
};
|
||||
|
||||
namespace simulation {
|
||||
|
||||
Reference in New Issue
Block a user