mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 21:29:18 +02:00
Merge branch 'tmj-dev'
This commit is contained in:
241
Driver.cpp
241
Driver.cpp
@@ -1889,21 +1889,10 @@ bool TController::CheckVehicles(TOrders user)
|
||||
fMass += p->MoverParameters->TotalMass; // dodanie masy łącznie z ładunkiem
|
||||
if (fVelMax < 0 ? true : p->MoverParameters->Vmax < fVelMax)
|
||||
fVelMax = p->MoverParameters->Vmax; // ustalenie maksymalnej prędkości dla składu
|
||||
/* //youBy: bez przesady, to jest proteza, napelniac mozna, a nawet trzeba, ale z umiarem!
|
||||
//uwzględnić jeszcze wyłączenie hamulca
|
||||
if
|
||||
((p->MoverParameters->BrakeSystem!=Pneumatic)&&(p->MoverParameters->BrakeSystem!=ElectroPneumatic))
|
||||
iDrivigFlags&=~moveOerlikons; //no jednak nie
|
||||
else if (p->MoverParameters->BrakeSubsystem!=Oerlikon)
|
||||
iDrivigFlags&=~moveOerlikons; //wtedy też nie */
|
||||
p = p->Neightbour(dir); // pojazd podłączony od wskazanej strony
|
||||
}
|
||||
if (main)
|
||||
iDrivigFlags |= movePrimary; // nie znaleziono innego, można się porządzić
|
||||
/* //tabelka z listą pojazdów jest na razie nie potrzebna
|
||||
delete[] pVehicles;
|
||||
pVehicles=new TDynamicObject*[iVehicles];
|
||||
*/
|
||||
ControllingSet(); // ustalenie członu do sterowania (może być inny niż zasiedziany)
|
||||
int pantmask = 1;
|
||||
if (iDrivigFlags & movePrimary)
|
||||
@@ -2190,42 +2179,19 @@ bool TController::PrepareEngine()
|
||||
LastReactionTime = 0.0;
|
||||
ReactionTime = PrepareTime;
|
||||
iDrivigFlags |= moveActive; // może skanować sygnały i reagować na komendy
|
||||
// with Controlling do
|
||||
if ( mvControlling->EnginePowerSource.SourceType == CurrentCollector )
|
||||
/*
|
||||
|| ( (mvOccupied->TrainType==dt_EZT)
|
||||
&& (mvControlling->GetTrainsetVoltage() > 0.0 ) ) ) // sprawdzanie, czy zasilanie jest może w innym członie
|
||||
*/
|
||||
{
|
||||
|
||||
if ( mvControlling->EnginePowerSource.SourceType == CurrentCollector ) {
|
||||
voltfront = true;
|
||||
voltrear = true;
|
||||
}
|
||||
// begin
|
||||
// if Couplers[0].Connected<>nil)
|
||||
// begin
|
||||
// if Couplers[0].Connected^.PantFrontVolt or Couplers[0].Connected^.PantRearVolt)
|
||||
// voltfront:=true
|
||||
// else
|
||||
// voltfront:=false;
|
||||
// end
|
||||
// else
|
||||
// voltfront:=false;
|
||||
// if Couplers[1].Connected<>nil)
|
||||
// begin
|
||||
// if Couplers[1].Connected^.PantFrontVolt or Couplers[1].Connected^.PantRearVolt)
|
||||
// voltrear:=true
|
||||
// else
|
||||
// voltrear:=false;
|
||||
// end
|
||||
// else
|
||||
// voltrear:=false;
|
||||
// end
|
||||
else
|
||||
// if EnginePowerSource.SourceType<>CurrentCollector)
|
||||
if (mvOccupied->TrainType != dt_EZT)
|
||||
voltfront = true; // Ra 2014-06: to jest wirtualny prąd dla spalinowych???
|
||||
if (AIControllFlag) // jeśli prowadzi komputer
|
||||
{ // część wykonawcza dla sterowania przez komputer
|
||||
else {
|
||||
if( mvOccupied->TrainType != dt_EZT ) {
|
||||
// Ra 2014-06: to jest wirtualny prąd dla spalinowych???
|
||||
voltfront = true;
|
||||
}
|
||||
}
|
||||
if (AIControllFlag) {
|
||||
// część wykonawcza dla sterowania przez komputer
|
||||
mvOccupied->BatterySwitch(true);
|
||||
if (mvControlling->EnginePowerSource.SourceType == CurrentCollector)
|
||||
{ // jeśli silnikowy jest pantografującym
|
||||
@@ -2247,39 +2213,42 @@ bool TController::PrepareEngine()
|
||||
mvControlling->PantCompFlag = false; // sprężarkę pantografów można już wyłączyć
|
||||
}
|
||||
}
|
||||
// if (mvOccupied->TrainType==dt_EZT)
|
||||
//{//Ra 2014-12: po co to tutaj?
|
||||
// mvControlling->PantFront(true);
|
||||
// mvControlling->PantRear(true);
|
||||
//}
|
||||
// if (mvControlling->EngineType==DieselElectric)
|
||||
// mvControlling->Battery=true; //Ra: to musi być tak?
|
||||
}
|
||||
|
||||
if (mvControlling->PantFrontVolt || mvControlling->PantRearVolt || voltfront || voltrear)
|
||||
{ // najpierw ustalamy kierunek, jeśli nie został ustalony
|
||||
if (!iDirection) // jeśli nie ma ustalonego kierunku
|
||||
if (mvOccupied->V == 0)
|
||||
{ // ustalenie kierunku, gdy stoi
|
||||
if( !iDirection ) {
|
||||
// jeśli nie ma ustalonego kierunku
|
||||
if( mvOccupied->V == 0 ) { // ustalenie kierunku, gdy stoi
|
||||
iDirection = mvOccupied->CabNo; // wg wybranej kabiny
|
||||
if (!iDirection) // jeśli nie ma ustalonego kierunku
|
||||
if ((mvControlling->PantFrontVolt != 0.0) ||
|
||||
(mvControlling->PantRearVolt != 0.0) || voltfront || voltrear)
|
||||
{
|
||||
if (mvOccupied->Couplers[1].CouplingFlag ==
|
||||
ctrain_virtual) // jeśli z tyłu nie ma nic
|
||||
if( !iDirection ) {
|
||||
// jeśli nie ma ustalonego kierunku
|
||||
if( ( mvControlling->PantFrontVolt != 0.0 ) || ( mvControlling->PantRearVolt != 0.0 ) || voltfront || voltrear ) {
|
||||
if( mvOccupied->Couplers[ 1 ].CouplingFlag == ctrain_virtual ) {
|
||||
// jeśli z tyłu nie ma nic
|
||||
iDirection = -1; // jazda w kierunku sprzęgu 1
|
||||
if (mvOccupied->Couplers[0].CouplingFlag ==
|
||||
ctrain_virtual) // jeśli z przodu nie ma nic
|
||||
}
|
||||
if( mvOccupied->Couplers[ 0 ].CouplingFlag == ctrain_virtual ) {
|
||||
// jeśli z przodu nie ma nic
|
||||
iDirection = 1; // jazda w kierunku sprzęgu 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // ustalenie kierunku, gdy jedzie
|
||||
if ((mvControlling->PantFrontVolt != 0.0) || (mvControlling->PantRearVolt != 0.0) ||
|
||||
voltfront || voltrear)
|
||||
if (mvOccupied->V < 0) // jedzie do tyłu
|
||||
iDirection = -1; // jazda w kierunku sprzęgu 1
|
||||
else // jak nie do tyłu, to do przodu
|
||||
iDirection = 1; // jazda w kierunku sprzęgu 0
|
||||
else {
|
||||
// ustalenie kierunku, gdy jedzie
|
||||
if( ( mvControlling->PantFrontVolt != 0.0 ) || ( mvControlling->PantRearVolt != 0.0 ) || voltfront || voltrear ) {
|
||||
if( mvOccupied->V < 0 ) {
|
||||
// jedzie do tyłu
|
||||
iDirection = -1; // jazda w kierunku sprzęgu 1
|
||||
}
|
||||
else {
|
||||
// jak nie do tyłu, to do przodu
|
||||
iDirection = 1; // jazda w kierunku sprzęgu 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (AIControllFlag) // jeśli prowadzi komputer
|
||||
{ // część wykonawcza dla sterowania przez komputer
|
||||
if (mvControlling->ConvOvldFlag)
|
||||
@@ -2288,38 +2257,48 @@ bool TController::PrepareEngine()
|
||||
; // zerowanie napędu
|
||||
mvControlling->ConvOvldFlag = false; // reset nadmiarowego
|
||||
}
|
||||
else if (!mvControlling->Mains)
|
||||
{
|
||||
// if TrainType=dt_SN61)
|
||||
// begin
|
||||
// OK:=(OrderDirectionChange(ChangeDir,Controlling)=-1);
|
||||
// OK:=IncMainCtrl(1);
|
||||
// end;
|
||||
else if (false == mvControlling->Mains) {
|
||||
while (DecSpeed(true))
|
||||
; // zerowanie napędu
|
||||
OK = mvControlling->MainSwitch(true);
|
||||
if (mvControlling->EngineType == DieselEngine)
|
||||
{ // Ra 2014-06: dla SN61 trzeba wrzucić pierwszą pozycję - nie wiem, czy tutaj...
|
||||
// kiedyś działało...
|
||||
if (!mvControlling->MainCtrlPos)
|
||||
{
|
||||
if (mvControlling->RList[0].R ==
|
||||
0.0) // gdy na pozycji 0 dawka paliwa jest zerowa, to zgaśnie
|
||||
mvControlling->IncMainCtrl(1); // dlatego trzeba zwiększyć pozycję
|
||||
if (!mvControlling->ScndCtrlPos) // jeśli bieg nie został ustawiony
|
||||
if (!mvControlling->MotorParam[0].AutoSwitch) // gdy biegi ręczne
|
||||
if (mvControlling->MotorParam[0].mIsat == 0.0) // bl,mIsat,fi,mfi
|
||||
mvControlling->IncScndCtrl(1); // pierwszy bieg
|
||||
|
||||
if( ( mvOccupied->EngineType == DieselEngine )
|
||||
|| ( mvOccupied->EngineType == DieselElectric ) ) {
|
||||
// start helper devices before spinning up the engine
|
||||
// TODO: replace with dedicated diesel engine subsystems
|
||||
mvOccupied->ConverterSwitch( true );
|
||||
mvOccupied->CompressorSwitch( true );
|
||||
}
|
||||
if( mvOccupied->TrainType == dt_SN61 ) {
|
||||
// specjalnie dla SN61 żeby nie zgasł
|
||||
if( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn == 0 ) {
|
||||
mvControlling->IncMainCtrl( 1 );
|
||||
}
|
||||
}
|
||||
OK = mvControlling->MainSwitch(true);
|
||||
/*
|
||||
if (mvControlling->EngineType == DieselEngine) {
|
||||
// Ra 2014-06: dla SN61 trzeba wrzucić pierwszą pozycję - nie wiem, czy tutaj...
|
||||
// kiedyś działało...
|
||||
if (!mvControlling->MainCtrlPos) {
|
||||
if( mvControlling->RList[ 0 ].R == 0.0 ) {
|
||||
// gdy na pozycji 0 dawka paliwa jest zerowa, to zgaśnie dlatego trzeba zwiększyć pozycję
|
||||
mvControlling->IncMainCtrl( 1 );
|
||||
}
|
||||
if( ( !mvControlling->ScndCtrlPos ) // jeśli bieg nie został ustawiony
|
||||
&& ( !mvControlling->MotorParam[ 0 ].AutoSwitch ) // gdy biegi ręczne
|
||||
&& ( mvControlling->MotorParam[ 0 ].mIsat == 0.0 ) ) { // bl,mIsat,fi,mfi
|
||||
// pierwszy bieg
|
||||
mvControlling->IncScndCtrl( 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{ // Ra: iDirection określa, w którą stronę jedzie skład względem sprzęgów pojazdu z AI
|
||||
OK = (OrderDirectionChange(iDirection, mvOccupied) == -1);
|
||||
else {
|
||||
OK = ( OrderDirectionChange( iDirection, mvOccupied ) == -1 );
|
||||
mvOccupied->ConverterSwitch( true );
|
||||
// w EN57 sprężarka w ra jest zasilana z silnikowego
|
||||
mvControlling->CompressorSwitch(true);
|
||||
mvControlling->ConverterSwitch(true);
|
||||
mvControlling->CompressorSwitch(true);
|
||||
mvControlling->CompressorSwitch( true );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2718,20 +2697,22 @@ bool TController::IncSpeed()
|
||||
break;
|
||||
case DieselEngine:
|
||||
if (mvControlling->ShuntModeAllow)
|
||||
{ // dla 2Ls150 można zmienić tryb pracy, jeśli jest w liniowym i nie daje rady (wymaga
|
||||
// zerowania kierunku)
|
||||
{ // dla 2Ls150 można zmienić tryb pracy, jeśli jest w liniowym i nie daje rady (wymaga zerowania kierunku)
|
||||
// mvControlling->ShuntMode=(OrderList[OrderPos]&Shunt)||(fMass>224000.0);
|
||||
}
|
||||
if ((mvControlling->Vel > mvControlling->dizel_minVelfullengage) &&
|
||||
(mvControlling->RList[mvControlling->MainCtrlPos].Mn > 0))
|
||||
OK = mvControlling->IncMainCtrl(1);
|
||||
if (mvControlling->RList[mvControlling->MainCtrlPos].Mn == 0)
|
||||
OK = mvControlling->IncMainCtrl(1);
|
||||
if (!mvControlling->Mains)
|
||||
{
|
||||
mvControlling->MainSwitch(true);
|
||||
mvControlling->ConverterSwitch(true);
|
||||
mvControlling->CompressorSwitch(true);
|
||||
if( true == Ready ) {
|
||||
if( ( mvControlling->Vel > mvControlling->dizel_minVelfullengage )
|
||||
&& ( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn > 0 ) ) {
|
||||
OK = mvControlling->IncMainCtrl( 1 );
|
||||
}
|
||||
if( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn == 0 ) {
|
||||
OK = mvControlling->IncMainCtrl( 1 );
|
||||
}
|
||||
}
|
||||
if( false == mvControlling->Mains ) {
|
||||
mvControlling->MainSwitch( true );
|
||||
mvControlling->ConverterSwitch( true );
|
||||
mvControlling->CompressorSwitch( true );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3173,12 +3154,11 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
||||
vCommandLocation = *NewLocation;
|
||||
if ((NewValue1 != 0.0) && (OrderList[OrderPos] != Obey_train))
|
||||
{ // o ile jazda
|
||||
if (!iEngineActive)
|
||||
OrderNext(Prepare_engine); // trzeba odpalić silnik najpierw, światła ustawi
|
||||
// JumpToNextOrder()
|
||||
// if (OrderList[OrderPos]!=Obey_train) //jeśli nie pociągowa
|
||||
OrderNext(Obey_train); // to uruchomić jazdę pociągową (od razu albo po odpaleniu
|
||||
// silnika
|
||||
if( iEngineActive == 0 ) {
|
||||
// trzeba odpalić silnik najpierw, światła ustawi
|
||||
OrderNext( Prepare_engine );
|
||||
}
|
||||
OrderNext(Obey_train); // to uruchomić jazdę pociągową (od razu albo po odpaleniu silnika
|
||||
OrderCheck(); // jeśli jazda pociągowa teraz, to wykonać niezbędne operacje
|
||||
}
|
||||
if (NewValue1 != 0.0) // jeśli jechać
|
||||
@@ -3481,6 +3461,7 @@ TController::UpdateSituation(double dt) {
|
||||
index = std::min(BrakeAccTableSize, std::max(1, index));
|
||||
fBrake_a0[0] = fBrake_a0[index];
|
||||
fBrake_a1[0] = fBrake_a1[index];
|
||||
|
||||
Ready = true; // wstępnie gotowy
|
||||
fReady = 0.0; // założenie, że odhamowany
|
||||
fAccGravity = 0.0; // przyspieszenie wynikające z pochylenia
|
||||
@@ -3489,8 +3470,8 @@ TController::UpdateSituation(double dt) {
|
||||
TDynamicObject *p = pVehicles[0]; // pojazd na czole składu
|
||||
while (p)
|
||||
{ // sprawdzenie odhamowania wszystkich połączonych pojazdów
|
||||
if (Ready) // bo jak coś nie odhamowane, to dalej nie ma co sprawdzać
|
||||
// if (p->MoverParameters->BrakePress>=0.03*p->MoverParameters->MaxBrakePress)
|
||||
if (Ready) {
|
||||
// bo jak coś nie odhamowane, to dalej nie ma co sprawdzać
|
||||
if (p->MoverParameters->BrakePress >= 0.4) // wg UIC określone sztywno na 0.04
|
||||
{
|
||||
Ready = false; // nie gotowy
|
||||
@@ -3508,6 +3489,7 @@ TController::UpdateSituation(double dt) {
|
||||
Need_TryAgain = true; // reset jak przy wywaleniu nadmiarowego
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fReady < p->MoverParameters->BrakePress)
|
||||
fReady = p->MoverParameters->BrakePress; // szukanie najbardziej zahamowanego
|
||||
if( ( dy = p->VectorFront().y ) != 0.0 ) {
|
||||
@@ -3526,6 +3508,25 @@ TController::UpdateSituation(double dt) {
|
||||
// if (mvOccupied->BrakePress<0.08) //to wystarczy, że zadziałają liniowe (nie ma ich jeszcze!!!)
|
||||
if (fReady < 0.8) // delikatniejszy warunek, obejmuje wszystkie wagony
|
||||
Ready = true; //żeby uznać za odhamowany
|
||||
// second pass, for diesel engines verify the engines are fully started
|
||||
// TODO: cache presence of diesel engines in the consist, to skip this test if there isn't any
|
||||
p = pVehicles[ 0 ]; // pojazd na czole składu
|
||||
while( ( true == Ready )
|
||||
&& ( p != nullptr ) ) {
|
||||
|
||||
auto const *vehicle { p->MoverParameters };
|
||||
|
||||
if( ( vehicle->EngineType == DieselEngine )
|
||||
|| ( vehicle->EngineType == DieselElectric ) ) {
|
||||
|
||||
Ready = (
|
||||
vehicle->enrot > 0.9 * (
|
||||
vehicle->EngineType == DieselEngine ?
|
||||
vehicle->dizel_nmin :
|
||||
vehicle->DElist[ 0 ].RPM / 60.0 ) );
|
||||
}
|
||||
p = p->Next(); // pojazd podłączony z tyłu (patrząc od czoła)
|
||||
}
|
||||
|
||||
// crude way to deal with automatic door opening on W4 preventing further ride
|
||||
// for human-controlled vehicles with no door control and dynamic brake auto-activating with door open
|
||||
@@ -5660,10 +5661,12 @@ void TController::DirectionForward(bool forward)
|
||||
else
|
||||
while (mvOccupied->ActiveDir >= 0)
|
||||
mvOccupied->DirectionBackward(); // do tyłu w obecnej kabinie
|
||||
if (mvOccupied->EngineType == DieselEngine) // specjalnie dla SN61
|
||||
if (iDrivigFlags & moveActive) // jeśli był już odpalony
|
||||
if (mvControlling->RList[mvControlling->MainCtrlPos].Mn == 0)
|
||||
mvControlling->IncMainCtrl(1); //żeby nie zgasł
|
||||
if( mvOccupied->TrainType == dt_SN61 ) {
|
||||
// specjalnie dla SN61 żeby nie zgasł
|
||||
if( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn == 0 ) {
|
||||
mvControlling->IncMainCtrl( 1 );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
std::string TController::Relation()
|
||||
|
||||
@@ -3533,7 +3533,7 @@ void TDynamicObject::RenderSounds() {
|
||||
}
|
||||
m_lastbrakepressure = MoverParameters->BrakePress;
|
||||
// ensure some basic level of volume and scale it up depending on pressure in the cylinder; scale this by the leak rate
|
||||
volume = 20 * m_brakepressurechange * ( 0.25 + 0.75 * ( std::max( MoverParameters->BrakePress, 0.0 ) / MoverParameters->MaxBrakePress[ 3 ] ) );
|
||||
volume = 20 * m_brakepressurechange * ( 0.25 + 0.75 * ( std::max( 0.0, MoverParameters->BrakePress ) / std::max( 1.0, MoverParameters->MaxBrakePress[ 3 ] ) ) );
|
||||
if( volume > 0.075f ) {
|
||||
rsUnbrake
|
||||
.gain( volume )
|
||||
@@ -3591,7 +3591,7 @@ void TDynamicObject::RenderSounds() {
|
||||
|
||||
brakeforceratio =
|
||||
clamp(
|
||||
MoverParameters->UnitBrakeForce / ( MoverParameters->BrakeForceR( 1.0, MoverParameters->Vel ) / ( MoverParameters->NAxles * std::max( 1, MoverParameters->NBpA ) ) ),
|
||||
MoverParameters->UnitBrakeForce / std::max( 1.0, MoverParameters->BrakeForceR( 1.0, MoverParameters->Vel ) / ( MoverParameters->NAxles * std::max( 1, MoverParameters->NBpA ) ) ),
|
||||
0.0, 1.0 );
|
||||
rsBrake
|
||||
.pitch( rsBrake.m_frequencyoffset + MoverParameters->Vel * rsBrake.m_frequencyfactor )
|
||||
|
||||
2
Gauge.h
2
Gauge.h
@@ -46,7 +46,7 @@ public:
|
||||
// returns offset of submodel associated with the button from the model centre
|
||||
glm::vec3 model_offset() const;
|
||||
// members
|
||||
TSubModel *SubModel; // McZapkie-310302: zeby mozna bylo sprawdzac czy zainicjowany poprawnie
|
||||
TSubModel *SubModel { nullptr }; // McZapkie-310302: zeby mozna bylo sprawdzac czy zainicjowany poprawnie
|
||||
|
||||
private:
|
||||
// methods
|
||||
|
||||
@@ -8262,10 +8262,9 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
|
||||
// end
|
||||
else if (Command == "CompressorSwitch") /*NBMX*/
|
||||
{
|
||||
if ((CValue1 == 1))
|
||||
CompressorAllow = true;
|
||||
else if ((CValue1 == 0))
|
||||
CompressorAllow = false;
|
||||
if( CompressorPower < 2 ) {
|
||||
CompressorAllow = ( CValue1 == 1 );
|
||||
}
|
||||
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||
}
|
||||
else if (Command == "DoorOpen") /*NBMX*/
|
||||
|
||||
@@ -247,10 +247,6 @@ TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn
|
||||
NBpA = i_nbpa;
|
||||
BrakeDelays = i_BD;
|
||||
BrakeDelayFlag = bdelay_P;
|
||||
DCV = false;
|
||||
ASBP = 0.0;
|
||||
BrakeStatus = b_hld;
|
||||
SoundFlag = 0;
|
||||
// 210.88
|
||||
// SizeBR:=i_bcn*i_bcr*i_bcr*i_bcd*40.17*MaxBP/(5-MaxBP); //objetosc ZP w stosunku do cylindra
|
||||
// 14" i cisnienia 4.2 atm
|
||||
@@ -258,7 +254,6 @@ TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn
|
||||
SizeBC = i_bcn * i_bcr * i_bcr * i_bcd * 210.88 * MaxBP /
|
||||
4.2; // objetosc CH w stosunku do cylindra 14" i cisnienia 4.2 atm
|
||||
|
||||
// BrakeCyl:=TReservoir.Create;
|
||||
BrakeCyl = std::make_shared<TBrakeCyl>();
|
||||
BrakeRes = std::make_shared<TReservoir>();
|
||||
ValveRes = std::make_shared<TReservoir>();
|
||||
@@ -268,7 +263,6 @@ TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn
|
||||
BrakeRes->CreateCap(i_brc);
|
||||
ValveRes->CreateCap(0.25);
|
||||
|
||||
// FM.Free;
|
||||
// materialy cierne
|
||||
i_mat = i_mat & (255 - bp_MHS);
|
||||
switch (i_mat)
|
||||
|
||||
@@ -1388,7 +1388,7 @@ TWorld::Update_UI() {
|
||||
uitextline2 += ( vehicle->MoverParameters->PantPressLockActive ? "!" : ( vehicle->MoverParameters->PantPressSwitchActive ? "*" : "." ) );
|
||||
uitextline2 += ( false == vehicle->MoverParameters->ConverterAllowLocal ? "-" : ( vehicle->MoverParameters->ConverterAllow ? ( vehicle->MoverParameters->ConverterFlag ? "X" : "x" ) : "." ) );
|
||||
uitextline2 += ( vehicle->MoverParameters->ConvOvldFlag ? "!" : "." );
|
||||
uitextline2 += ( false == vehicle->MoverParameters->CompressorAllowLocal ? "-" : ( vehicle->MoverParameters->CompressorAllow ? ( vehicle->MoverParameters->CompressorFlag ? "C" : "c" ) : "." ) );
|
||||
uitextline2 += ( false == vehicle->MoverParameters->CompressorAllowLocal ? "-" : ( ( vehicle->MoverParameters->CompressorAllow || vehicle->MoverParameters->CompressorPower > 1 ) ? ( vehicle->MoverParameters->CompressorFlag ? "C" : "c" ) : "." ) );
|
||||
uitextline2 += ( vehicle->MoverParameters->CompressorGovernorLock ? "!" : "." );
|
||||
/*
|
||||
uitextline2 +=
|
||||
|
||||
103
renderer.cpp
103
renderer.cpp
@@ -22,8 +22,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "Logs.h"
|
||||
#include "usefull.h"
|
||||
|
||||
#define EU07_NEW_CAB_RENDERCODE
|
||||
|
||||
opengl_renderer GfxRenderer;
|
||||
extern TWorld World;
|
||||
|
||||
@@ -111,7 +109,7 @@ opengl_renderer::Init( GLFWwindow *Window ) {
|
||||
|
||||
::glDepthFunc( GL_LEQUAL );
|
||||
glEnable( GL_DEPTH_TEST );
|
||||
glAlphaFunc( GL_GREATER, 0.04f );
|
||||
glAlphaFunc( GL_GREATER, 0.f );
|
||||
glEnable( GL_ALPHA_TEST );
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
glEnable( GL_BLEND );
|
||||
@@ -431,13 +429,11 @@ opengl_renderer::Render_pass( rendermode const Mode ) {
|
||||
::glEnable( GL_TEXTURE_2D );
|
||||
}
|
||||
#endif
|
||||
#ifdef EU07_NEW_CAB_RENDERCODE
|
||||
if( World.Train != nullptr ) {
|
||||
// cab render is performed without shadows, due to low resolution and number of models without windows :|
|
||||
switch_units( true, false, false );
|
||||
Render_cab( World.Train->Dynamic(), false );
|
||||
}
|
||||
#endif
|
||||
switch_units( true, true, true );
|
||||
Render( simulation::Region );
|
||||
/*
|
||||
@@ -832,7 +828,7 @@ opengl_renderer::setup_drawing( bool const Alpha ) {
|
||||
}
|
||||
else {
|
||||
::glDisable( GL_BLEND );
|
||||
::glAlphaFunc( GL_GREATER, 0.50f );
|
||||
::glAlphaFunc( GL_GREATER, 0.5f );
|
||||
}
|
||||
|
||||
switch( m_renderpass.draw_mode ) {
|
||||
@@ -909,7 +905,7 @@ opengl_renderer::setup_units( bool const Diffuse, bool const Shadows, bool const
|
||||
if( ( true == Global::RenderShadows ) && ( true == Shadows ) && ( false == Global::bWireFrame ) ) {
|
||||
|
||||
::glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
|
||||
::glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, glm::value_ptr( m_shadowcolor ) ); // TODO: dynamically calculated shadow colour, based on sun height
|
||||
::glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, glm::value_ptr( m_shadowcolor ) );
|
||||
|
||||
::glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE ); // darken the previous stage
|
||||
::glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS );
|
||||
@@ -1393,17 +1389,6 @@ opengl_renderer::Render( scene::basic_region *Region ) {
|
||||
|
||||
m_sectionqueue.clear();
|
||||
m_cellqueue.clear();
|
||||
/*
|
||||
for( auto *section : Region->sections( m_renderpass.camera.position(), m_renderpass.draw_range * Global::fDistanceFactor ) ) {
|
||||
#ifdef EU07_USE_DEBUG_CULLING
|
||||
if( m_worldcamera.camera.visible( section->m_area ) ) {
|
||||
#else
|
||||
if( m_renderpass.camera.visible( section->m_area ) ) {
|
||||
#endif
|
||||
m_sectionqueue.emplace_back( section );
|
||||
}
|
||||
}
|
||||
*/
|
||||
// build a list of region sections to render
|
||||
glm::vec3 const cameraposition { m_renderpass.camera.position() };
|
||||
auto const camerax = static_cast<int>( std::floor( cameraposition.x / scene::EU07_SECTIONSIZE + scene::EU07_REGIONSIDESECTIONCOUNT / 2 ) );
|
||||
@@ -1420,11 +1405,7 @@ opengl_renderer::Render( scene::basic_region *Region ) {
|
||||
if( column >= scene::EU07_REGIONSIDESECTIONCOUNT ) { break; }
|
||||
auto *section { Region->m_sections[ row * scene::EU07_REGIONSIDESECTIONCOUNT + column ] };
|
||||
if( ( section != nullptr )
|
||||
#ifdef EU07_USE_DEBUG_CULLING
|
||||
&& ( m_worldcamera.camera.visible( section->m_area ) ) ) {
|
||||
#else
|
||||
&& ( m_renderpass.camera.visible( section->m_area ) ) ) {
|
||||
#endif
|
||||
m_sectionqueue.emplace_back( section );
|
||||
}
|
||||
}
|
||||
@@ -1501,38 +1482,6 @@ opengl_renderer::Render( section_sequence::iterator First, section_sequence::ite
|
||||
auto const originoffset { section->m_area.center - m_renderpass.camera.position() };
|
||||
::glTranslated( originoffset.x, originoffset.y, originoffset.z );
|
||||
// render
|
||||
#ifdef EU07_USE_DEBUG_CULLING
|
||||
// debug
|
||||
::glLineWidth( 2.f );
|
||||
float const width = section->m_area.radius;
|
||||
float const height = section->m_area.radius * 0.2f;
|
||||
glDisable( GL_LIGHTING );
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
glColor3ub( 255, 128, 128 );
|
||||
glBegin( GL_LINE_LOOP );
|
||||
glVertex3f( -width, height, width );
|
||||
glVertex3f( -width, height, -width );
|
||||
glVertex3f( width, height, -width );
|
||||
glVertex3f( width, height, width );
|
||||
glEnd();
|
||||
glBegin( GL_LINE_LOOP );
|
||||
glVertex3f( -width, 0, width );
|
||||
glVertex3f( -width, 0, -width );
|
||||
glVertex3f( width, 0, -width );
|
||||
glVertex3f( width, 0, width );
|
||||
glEnd();
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( -width, height, width ); glVertex3f( -width, 0, width );
|
||||
glVertex3f( -width, height, -width ); glVertex3f( -width, 0, -width );
|
||||
glVertex3f( width, height, -width ); glVertex3f( width, 0, -width );
|
||||
glVertex3f( width, height, width ); glVertex3f( width, 0, width );
|
||||
glEnd();
|
||||
glColor3ub( 255, 255, 255 );
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glEnable( GL_LIGHTING );
|
||||
glLineWidth( 1.f );
|
||||
#endif
|
||||
// shapes
|
||||
for( auto const &shape : section->m_shapes ) { Render( shape, true ); }
|
||||
// post-render cleanup
|
||||
::glPopMatrix();
|
||||
@@ -1552,11 +1501,7 @@ opengl_renderer::Render( section_sequence::iterator First, section_sequence::ite
|
||||
case rendermode::pickscenery: {
|
||||
for( auto &cell : section->m_cells ) {
|
||||
if( ( true == cell.m_active )
|
||||
#ifdef EU07_USE_DEBUG_CULLING
|
||||
&& ( m_worldcamera.camera.visible( cell.m_area ) ) ) {
|
||||
#else
|
||||
&& ( m_renderpass.camera.visible( cell.m_area ) ) ) {
|
||||
#endif
|
||||
// store visible cells with content as well as their current distance, for sorting later
|
||||
m_cellqueue.emplace_back(
|
||||
glm::length2( m_renderpass.camera.position() - cell.m_area.center ),
|
||||
@@ -1605,35 +1550,6 @@ opengl_renderer::Render( cell_sequence::iterator First, cell_sequence::iterator
|
||||
::glTranslated( originoffset.x, originoffset.y, originoffset.z );
|
||||
|
||||
// render
|
||||
#ifdef EU07_USE_DEBUG_CULLING
|
||||
// debug
|
||||
float const width = cell->m_area.radius;
|
||||
float const height = cell->m_area.radius * 0.15f;
|
||||
glDisable( GL_LIGHTING );
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
glColor3ub( 255, 255, 0 );
|
||||
glBegin( GL_LINE_LOOP );
|
||||
glVertex3f( -width, height, width );
|
||||
glVertex3f( -width, height, -width );
|
||||
glVertex3f( width, height, -width );
|
||||
glVertex3f( width, height, width );
|
||||
glEnd();
|
||||
glBegin( GL_LINE_LOOP );
|
||||
glVertex3f( -width, 0, width );
|
||||
glVertex3f( -width, 0, -width );
|
||||
glVertex3f( width, 0, -width );
|
||||
glVertex3f( width, 0, width );
|
||||
glEnd();
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( -width, height, width ); glVertex3f( -width, 0, width );
|
||||
glVertex3f( -width, height, -width ); glVertex3f( -width, 0, -width );
|
||||
glVertex3f( width, height, -width ); glVertex3f( width, 0, -width );
|
||||
glVertex3f( width, height, width ); glVertex3f( width, 0, width );
|
||||
glEnd();
|
||||
glColor3ub( 255, 255, 255 );
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glEnable( GL_LIGHTING );
|
||||
#endif
|
||||
// opaque non-instanced shapes
|
||||
for( auto const &shape : cell->m_shapesopaque ) { Render( shape, false ); }
|
||||
// tracks
|
||||
@@ -1805,6 +1721,10 @@ opengl_renderer::Render( scene::shape_node const &Shape, bool const Ignorerange
|
||||
void
|
||||
opengl_renderer::Render( TAnimModel *Instance ) {
|
||||
|
||||
if( false == Instance->m_visible ) {
|
||||
return;
|
||||
}
|
||||
|
||||
double distancesquared;
|
||||
switch( m_renderpass.draw_mode ) {
|
||||
case rendermode::shadows: {
|
||||
@@ -1988,7 +1908,6 @@ opengl_renderer::Render_cab( TDynamicObject *Dynamic, bool const Alpha ) {
|
||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( Dynamic->InteriorLight * Dynamic->InteriorLightLevel ) );
|
||||
}
|
||||
// render
|
||||
#ifdef EU07_NEW_CAB_RENDERCODE
|
||||
if( true == Alpha ) {
|
||||
// translucent parts
|
||||
Render_Alpha( Dynamic->mdKabina, Dynamic->Material(), 0.0 );
|
||||
@@ -1997,10 +1916,6 @@ opengl_renderer::Render_cab( TDynamicObject *Dynamic, bool const Alpha ) {
|
||||
// opaque parts
|
||||
Render( Dynamic->mdKabina, Dynamic->Material(), 0.0 );
|
||||
}
|
||||
#else
|
||||
Render( Dynamic->mdKabina, Dynamic->Material(), 0.0 );
|
||||
Render_Alpha( Dynamic->mdKabina, Dynamic->Material(), 0.0 );
|
||||
#endif
|
||||
// post-render restore
|
||||
if( Dynamic->fShade > 0.0f ) {
|
||||
// change light level based on light level of the occupied track
|
||||
@@ -2632,6 +2547,10 @@ opengl_renderer::Render_Alpha( cell_sequence::reverse_iterator First, cell_seque
|
||||
void
|
||||
opengl_renderer::Render_Alpha( TAnimModel *Instance ) {
|
||||
|
||||
if( false == Instance->m_visible ) {
|
||||
return;
|
||||
}
|
||||
|
||||
double distancesquared;
|
||||
switch( m_renderpass.draw_mode ) {
|
||||
case rendermode::shadows: {
|
||||
|
||||
@@ -22,7 +22,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
#define EU07_USE_PICKING_FRAMEBUFFER
|
||||
//#define EU07_USE_DEBUG_SHADOWMAP
|
||||
//#define EU07_USE_DEBUG_CAMERA
|
||||
//#define EU07_USE_DEBUG_CULLING
|
||||
|
||||
struct opengl_light {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user