mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 15:39:19 +02:00
build 181216. increased coupler disconnection working range, guaranteed freespot visibility range, optional alternate rotation event mode, ai vehicle startup logic enhancement, minor bug fixes
This commit is contained in:
@@ -243,24 +243,10 @@ void TAnimContainer::UpdateModel() {
|
|||||||
}
|
}
|
||||||
if (fRotateSpeed != 0.0)
|
if (fRotateSpeed != 0.0)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
|
||||||
double dif= fDesiredAngle-fAngle;
|
|
||||||
double s= fRotateSpeed*sign(dif)*Timer::GetDeltaTime();
|
|
||||||
if ((abs(s)-abs(dif))>0)
|
|
||||||
fAngle= fDesiredAngle;
|
|
||||||
else
|
|
||||||
fAngle+= s;
|
|
||||||
|
|
||||||
while (fAngle>360) fAngle-= 360;
|
|
||||||
while (fAngle<-360) fAngle+= 360;
|
|
||||||
pSubModel->SetRotate(vRotateAxis,fAngle);
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool anim = false;
|
bool anim = false;
|
||||||
auto dif = vDesiredAngles - vRotateAngles;
|
auto dif = vDesiredAngles - vRotateAngles;
|
||||||
double s;
|
double s;
|
||||||
s = fRotateSpeed * sign(dif.x) * Timer::GetDeltaTime();
|
s = std::abs( fRotateSpeed ) * sign(dif.x) * Timer::GetDeltaTime();
|
||||||
if (fabs(s) >= fabs(dif.x))
|
if (fabs(s) >= fabs(dif.x))
|
||||||
vRotateAngles.x = vDesiredAngles.x;
|
vRotateAngles.x = vDesiredAngles.x;
|
||||||
else
|
else
|
||||||
@@ -268,7 +254,7 @@ void TAnimContainer::UpdateModel() {
|
|||||||
vRotateAngles.x += s;
|
vRotateAngles.x += s;
|
||||||
anim = true;
|
anim = true;
|
||||||
}
|
}
|
||||||
s = fRotateSpeed * sign(dif.y) * Timer::GetDeltaTime();
|
s = std::abs( fRotateSpeed ) * sign(dif.y) * Timer::GetDeltaTime();
|
||||||
if (fabs(s) >= fabs(dif.y))
|
if (fabs(s) >= fabs(dif.y))
|
||||||
vRotateAngles.y = vDesiredAngles.y;
|
vRotateAngles.y = vDesiredAngles.y;
|
||||||
else
|
else
|
||||||
@@ -276,7 +262,7 @@ void TAnimContainer::UpdateModel() {
|
|||||||
vRotateAngles.y += s;
|
vRotateAngles.y += s;
|
||||||
anim = true;
|
anim = true;
|
||||||
}
|
}
|
||||||
s = fRotateSpeed * sign(dif.z) * Timer::GetDeltaTime();
|
s = std::abs( fRotateSpeed ) * sign(dif.z) * Timer::GetDeltaTime();
|
||||||
if (fabs(s) >= fabs(dif.z))
|
if (fabs(s) >= fabs(dif.z))
|
||||||
vRotateAngles.z = vDesiredAngles.z;
|
vRotateAngles.z = vDesiredAngles.z;
|
||||||
else
|
else
|
||||||
@@ -284,6 +270,8 @@ void TAnimContainer::UpdateModel() {
|
|||||||
vRotateAngles.z += s;
|
vRotateAngles.z += s;
|
||||||
anim = true;
|
anim = true;
|
||||||
}
|
}
|
||||||
|
// HACK: negative speed allows to work around legacy behaviour, where desired angle > 360 meant permanent rotation
|
||||||
|
if( fRotateSpeed > 0.0 ) {
|
||||||
while( vRotateAngles.x >= 360 )
|
while( vRotateAngles.x >= 360 )
|
||||||
vRotateAngles.x -= 360;
|
vRotateAngles.x -= 360;
|
||||||
while( vRotateAngles.x <= -360 )
|
while( vRotateAngles.x <= -360 )
|
||||||
@@ -296,10 +284,13 @@ void TAnimContainer::UpdateModel() {
|
|||||||
vRotateAngles.z -= 360;
|
vRotateAngles.z -= 360;
|
||||||
while( vRotateAngles.z <= -360 )
|
while( vRotateAngles.z <= -360 )
|
||||||
vRotateAngles.z += 360;
|
vRotateAngles.z += 360;
|
||||||
if (vRotateAngles.x == 0.0)
|
}
|
||||||
if (vRotateAngles.y == 0.0)
|
|
||||||
if (vRotateAngles.z == 0.0)
|
if( ( vRotateAngles.x == 0.0 )
|
||||||
|
&& ( vRotateAngles.y == 0.0 )
|
||||||
|
&& ( vRotateAngles.z == 0.0 ) ) {
|
||||||
iAnim &= ~1; // kąty są zerowe
|
iAnim &= ~1; // kąty są zerowe
|
||||||
|
}
|
||||||
if (!anim)
|
if (!anim)
|
||||||
{ // nie potrzeba przeliczać już
|
{ // nie potrzeba przeliczać już
|
||||||
fRotateSpeed = 0.0;
|
fRotateSpeed = 0.0;
|
||||||
|
|||||||
44
Driver.cpp
44
Driver.cpp
@@ -2430,7 +2430,7 @@ bool TController::PrepareEngine()
|
|||||||
; // zerowanie napędu
|
; // zerowanie napędu
|
||||||
mvControlling->ConvOvldFlag = false; // reset nadmiarowego
|
mvControlling->ConvOvldFlag = false; // reset nadmiarowego
|
||||||
}
|
}
|
||||||
else if (false == mvControlling->Mains) {
|
else if (false == IsLineBreakerClosed) {
|
||||||
while (DecSpeed(true))
|
while (DecSpeed(true))
|
||||||
; // zerowanie napędu
|
; // zerowanie napędu
|
||||||
if( mvOccupied->TrainType == dt_SN61 ) {
|
if( mvOccupied->TrainType == dt_SN61 ) {
|
||||||
@@ -3206,8 +3206,8 @@ void TController::SpeedCntrl(double DesiredSpeed)
|
|||||||
else if (mvControlling->ScndCtrlPosNo > 1)
|
else if (mvControlling->ScndCtrlPosNo > 1)
|
||||||
{
|
{
|
||||||
int DesiredPos = 1 + mvControlling->ScndCtrlPosNo * ((DesiredSpeed - 1.0) / mvControlling->Vmax);
|
int DesiredPos = 1 + mvControlling->ScndCtrlPosNo * ((DesiredSpeed - 1.0) / mvControlling->Vmax);
|
||||||
while (mvControlling->ScndCtrlPos > DesiredPos) mvControlling->DecScndCtrl(1);
|
while( ( mvControlling->ScndCtrlPos > DesiredPos ) && ( true == mvControlling->DecScndCtrl( 1 ) ) ) { ; } // all work is done in the condition loop
|
||||||
while (mvControlling->ScndCtrlPos < DesiredPos) mvControlling->IncScndCtrl(1);
|
while( ( mvControlling->ScndCtrlPos < DesiredPos ) && ( true == mvControlling->IncScndCtrl( 1 ) ) ) { ; } // all work is done in the condition loop
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3826,37 +3826,47 @@ TController::UpdateSituation(double dt) {
|
|||||||
fAccGravity = 0.0; // przyspieszenie wynikające z pochylenia
|
fAccGravity = 0.0; // przyspieszenie wynikające z pochylenia
|
||||||
double dy; // składowa styczna grawitacji, w przedziale <0,1>
|
double dy; // składowa styczna grawitacji, w przedziale <0,1>
|
||||||
double AbsAccS = 0;
|
double AbsAccS = 0;
|
||||||
|
IsLineBreakerClosed = true; // presume things are in working order
|
||||||
TDynamicObject *p = pVehicles[0]; // pojazd na czole składu
|
TDynamicObject *p = pVehicles[0]; // pojazd na czole składu
|
||||||
while (p)
|
while (p)
|
||||||
{ // sprawdzenie odhamowania wszystkich połączonych pojazdów
|
{ // sprawdzenie odhamowania wszystkich połączonych pojazdów
|
||||||
|
auto *vehicle { p->MoverParameters };
|
||||||
if (Ready) {
|
if (Ready) {
|
||||||
// bo jak coś nie odhamowane, to dalej nie ma co sprawdzać
|
// 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
|
if (vehicle->BrakePress >= 0.4) // wg UIC określone sztywno na 0.04
|
||||||
{
|
{
|
||||||
Ready = false; // nie gotowy
|
Ready = false; // nie gotowy
|
||||||
// Ra: odluźnianie przeładowanych lokomotyw, ciągniętych na zimno - prowizorka...
|
// Ra: odluźnianie przeładowanych lokomotyw, ciągniętych na zimno - prowizorka...
|
||||||
if (AIControllFlag) // skład jak dotąd był wyluzowany
|
if (AIControllFlag) // skład jak dotąd był wyluzowany
|
||||||
{
|
{
|
||||||
if( ( mvOccupied->BrakeCtrlPos == 0 ) // jest pozycja jazdy
|
if( ( mvOccupied->BrakeCtrlPos == 0 ) // jest pozycja jazdy
|
||||||
&& ( ( p->MoverParameters->Hamulec->GetBrakeStatus() & b_dmg ) == 0 ) // brake isn't broken
|
&& ( ( vehicle->Hamulec->GetBrakeStatus() & b_dmg ) == 0 ) // brake isn't broken
|
||||||
&& ( p->MoverParameters->PipePress - 5.0 > -0.1 ) // jeśli ciśnienie jak dla jazdy
|
&& ( vehicle->PipePress - 5.0 > -0.1 ) // jeśli ciśnienie jak dla jazdy
|
||||||
&& ( p->MoverParameters->Hamulec->GetCRP() > p->MoverParameters->PipePress + 0.12 ) ) { // za dużo w zbiorniku
|
&& ( vehicle->Hamulec->GetCRP() > vehicle->PipePress + 0.12 ) ) { // za dużo w zbiorniku
|
||||||
// indywidualne luzowanko
|
// indywidualne luzowanko
|
||||||
p->MoverParameters->BrakeReleaser( 1 );
|
vehicle->BrakeReleaser( 1 );
|
||||||
}
|
}
|
||||||
if (p->MoverParameters->Power > 0.01) // jeśli ma silnik
|
if( ( vehicle->Power > 0.01 ) // jeśli ma silnik
|
||||||
if (p->MoverParameters->FuseFlag) // wywalony nadmiarowy
|
&& ( vehicle->FuseFlag ) ) { // wywalony nadmiarowy
|
||||||
Need_TryAgain = true; // reset jak przy wywaleniu nadmiarowego
|
Need_TryAgain = true; // reset jak przy wywaleniu nadmiarowego
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fReady < p->MoverParameters->BrakePress)
|
}
|
||||||
fReady = p->MoverParameters->BrakePress; // szukanie najbardziej zahamowanego
|
if (fReady < vehicle->BrakePress)
|
||||||
|
fReady = vehicle->BrakePress; // szukanie najbardziej zahamowanego
|
||||||
if( ( dy = p->VectorFront().y ) != 0.0 ) {
|
if( ( dy = p->VectorFront().y ) != 0.0 ) {
|
||||||
// istotne tylko dla pojazdów na pochyleniu
|
// istotne tylko dla pojazdów na pochyleniu
|
||||||
// ciężar razy składowa styczna grawitacji
|
// ciężar razy składowa styczna grawitacji
|
||||||
fAccGravity -= p->MoverParameters->TotalMassxg * dy * ( p->DirectionGet() == iDirection ? 1 : -1 );
|
fAccGravity -= vehicle->TotalMassxg * dy * ( p->DirectionGet() == iDirection ? 1 : -1 );
|
||||||
}
|
}
|
||||||
|
// test state of main switch in all powered vehicles under control
|
||||||
|
if( ( vehicle->Power > 0.01 )
|
||||||
|
&& ( ( vehicle == mvControlling )
|
||||||
|
|| ( p->PrevC( coupling::control ) != nullptr ) ) ) {
|
||||||
|
IsLineBreakerClosed = ( IsLineBreakerClosed && vehicle->Mains );
|
||||||
|
}
|
||||||
|
|
||||||
p = p->Next(); // pojazd podłączony z tyłu (patrząc od czoła)
|
p = p->Next(); // pojazd podłączony z tyłu (patrząc od czoła)
|
||||||
}
|
}
|
||||||
if( iDirection ) {
|
if( iDirection ) {
|
||||||
@@ -5221,10 +5231,10 @@ TController::UpdateSituation(double dt) {
|
|||||||
return; // ...and don't touch any other controls
|
return; // ...and don't touch any other controls
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mvControlling->ConvOvldFlag ||
|
if( ( true == mvControlling->ConvOvldFlag ) // wywalił bezpiecznik nadmiarowy przetwornicy
|
||||||
!mvControlling->Mains) // WS może wywalić z powodu błędu w drutach
|
|| ( false == IsLineBreakerClosed ) ) { // WS może wywalić z powodu błędu w drutach
|
||||||
{ // wywalił bezpiecznik nadmiarowy przetwornicy
|
// próba ponownego załączenia
|
||||||
PrepareEngine(); // próba ponownego załączenia
|
PrepareEngine();
|
||||||
}
|
}
|
||||||
// włączanie bezpiecznika
|
// włączanie bezpiecznika
|
||||||
if ((mvControlling->EngineType == TEngineType::ElectricSeriesMotor) ||
|
if ((mvControlling->EngineType == TEngineType::ElectricSeriesMotor) ||
|
||||||
|
|||||||
1
Driver.h
1
Driver.h
@@ -222,6 +222,7 @@ public:
|
|||||||
double BrakingLevelIncrease{ 0.25 };
|
double BrakingLevelIncrease{ 0.25 };
|
||||||
bool IsCargoTrain{ false };
|
bool IsCargoTrain{ false };
|
||||||
bool IsHeavyCargoTrain{ false };
|
bool IsHeavyCargoTrain{ false };
|
||||||
|
bool IsLineBreakerClosed{ false }; // state of line breaker in all powered vehicles under control
|
||||||
double fLastStopExpDist = -1.0; // odległość wygasania ostateniego przystanku
|
double fLastStopExpDist = -1.0; // odległość wygasania ostateniego przystanku
|
||||||
double ReactionTime = 0.0; // czas reakcji Ra: czego i na co? świadomości AI
|
double ReactionTime = 0.0; // czas reakcji Ra: czego i na co? świadomości AI
|
||||||
double fBrakeTime = 0.0; // wpisana wartość jest zmniejszana do 0, gdy ujemna należy zmienić nastawę hamulca
|
double fBrakeTime = 0.0; // wpisana wartość jest zmniejszana do 0, gdy ujemna należy zmienić nastawę hamulca
|
||||||
|
|||||||
@@ -620,8 +620,12 @@ void
|
|||||||
TDynamicObject::toggle_lights() {
|
TDynamicObject::toggle_lights() {
|
||||||
|
|
||||||
if( true == SectionLightsActive ) {
|
if( true == SectionLightsActive ) {
|
||||||
// switch all lights off
|
// switch all lights off...
|
||||||
for( auto §ion : Sections ) {
|
for( auto §ion : Sections ) {
|
||||||
|
// ... but skip cab sections, their lighting ignores battery state
|
||||||
|
auto const sectionname { section.compartment->pName };
|
||||||
|
if( sectionname.find( "cab" ) == 0 ) { continue; }
|
||||||
|
|
||||||
section.light_level = 0.0f;
|
section.light_level = 0.0f;
|
||||||
}
|
}
|
||||||
SectionLightsActive = false;
|
SectionLightsActive = false;
|
||||||
|
|||||||
@@ -1370,6 +1370,7 @@ public:
|
|||||||
bool MotorBlowersSwitch( bool State, side const Side, range_t const Notify = range_t::consist ); // traction motor fan state toggle
|
bool MotorBlowersSwitch( bool State, side const Side, range_t const Notify = range_t::consist ); // traction motor fan state toggle
|
||||||
bool MotorBlowersSwitchOff( bool State, side const Side, range_t const Notify = range_t::consist ); // traction motor fan state toggle
|
bool MotorBlowersSwitchOff( bool State, side const Side, range_t const Notify = range_t::consist ); // traction motor fan state toggle
|
||||||
bool MainSwitch( bool const State, range_t const Notify = range_t::consist );/*! wylacznik glowny*/
|
bool MainSwitch( bool const State, range_t const Notify = range_t::consist );/*! wylacznik glowny*/
|
||||||
|
void MainSwitch_( bool const State );
|
||||||
bool ConverterSwitch( bool State, range_t const Notify = range_t::consist );/*! wl/wyl przetwornicy*/
|
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 CompressorSwitch( bool State, range_t const Notify = range_t::consist );/*! wl/wyl sprezarki*/
|
||||||
|
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ int TMoverParameters::DettachStatus(int ConnectNo)
|
|||||||
// if (CouplerType==Articulated) return false; //sprzęg nie do rozpięcia - może być tylko urwany
|
// if (CouplerType==Articulated) return false; //sprzęg nie do rozpięcia - może być tylko urwany
|
||||||
// Couplers[ConnectNo].CoupleDist=Distance(Loc,Couplers[ConnectNo].Connected->Loc,Dim,Couplers[ConnectNo].Connected->Dim);
|
// Couplers[ConnectNo].CoupleDist=Distance(Loc,Couplers[ConnectNo].Connected->Loc,Dim,Couplers[ConnectNo].Connected->Dim);
|
||||||
CouplerDist(ConnectNo);
|
CouplerDist(ConnectNo);
|
||||||
if (Couplers[ConnectNo].CouplerType == TCouplerType::Screw ? Couplers[ConnectNo].CoupleDist < 0.0 : true)
|
if (Couplers[ConnectNo].CouplerType == TCouplerType::Screw ? Couplers[ConnectNo].CoupleDist < 0.01 : true)
|
||||||
return -Couplers[ConnectNo].CouplingFlag; // można rozłączać, jeśli dociśnięty
|
return -Couplers[ConnectNo].CouplingFlag; // można rozłączać, jeśli dociśnięty
|
||||||
return (Couplers[ConnectNo].CoupleDist > 0.2) ? -Couplers[ConnectNo].CouplingFlag :
|
return (Couplers[ConnectNo].CoupleDist > 0.2) ? -Couplers[ConnectNo].CouplingFlag :
|
||||||
Couplers[ConnectNo].CouplingFlag;
|
Couplers[ConnectNo].CouplingFlag;
|
||||||
@@ -2729,12 +2729,35 @@ bool TMoverParameters::MotorBlowersSwitchOff( bool State, side const Side, range
|
|||||||
// Q: 20160713
|
// Q: 20160713
|
||||||
// włączenie / wyłączenie obwodu głownego
|
// włączenie / wyłączenie obwodu głownego
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
bool TMoverParameters::MainSwitch( bool const State, range_t const Notify )
|
bool TMoverParameters::MainSwitch( bool const State, range_t const Notify ) {
|
||||||
{
|
|
||||||
bool const initialstate { Mains || dizel_startup };
|
bool const initialstate { Mains || dizel_startup };
|
||||||
|
|
||||||
if( ( Mains != State )
|
MainSwitch_( State );
|
||||||
&& ( MainCtrlPosNo > 0 ) ) {
|
|
||||||
|
if( Notify != range_t::local ) {
|
||||||
|
// pass the command to other vehicles
|
||||||
|
SendCtrlToNext(
|
||||||
|
"MainSwitch",
|
||||||
|
( State ? 1 : 0 ),
|
||||||
|
CabNo,
|
||||||
|
( Notify == range_t::unit ?
|
||||||
|
coupling::control | coupling::permanent :
|
||||||
|
coupling::control ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( ( Mains || dizel_startup ) != initialstate );
|
||||||
|
}
|
||||||
|
|
||||||
|
void TMoverParameters::MainSwitch_( bool const State ) {
|
||||||
|
|
||||||
|
if( ( Mains == State )
|
||||||
|
|| ( MainCtrlPosNo == 0 ) ) {
|
||||||
|
// nothing to do
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool const initialstate { Mains || dizel_startup };
|
||||||
|
|
||||||
if( ( false == State )
|
if( ( false == State )
|
||||||
|| ( ( ( ScndCtrlPos == 0 ) || ( EngineType == TEngineType::ElectricInductionMotor ) )
|
|| ( ( ( ScndCtrlPos == 0 ) || ( EngineType == TEngineType::ElectricInductionMotor ) )
|
||||||
@@ -2772,22 +2795,8 @@ bool TMoverParameters::MainSwitch( bool const State, range_t const Notify )
|
|||||||
if( Mains != initialstate ) {
|
if( Mains != initialstate ) {
|
||||||
LastSwitchingTime = 0;
|
LastSwitchingTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Notify != range_t::local ) {
|
|
||||||
// pass the command to other vehicles
|
|
||||||
SendCtrlToNext(
|
|
||||||
"MainSwitch",
|
|
||||||
( State ? 1 : 0 ),
|
|
||||||
CabNo,
|
|
||||||
( Notify == range_t::unit ?
|
|
||||||
coupling::control | coupling::permanent :
|
|
||||||
coupling::control ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return ( ( Mains || dizel_startup ) != initialstate );
|
|
||||||
}
|
|
||||||
|
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
// Q: 20160713
|
// Q: 20160713
|
||||||
@@ -9446,22 +9455,7 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
|
|||||||
}
|
}
|
||||||
else if (Command == "MainSwitch")
|
else if (Command == "MainSwitch")
|
||||||
{
|
{
|
||||||
if (CValue1 == 1) {
|
MainSwitch_( CValue1 > 0.0 );
|
||||||
|
|
||||||
if( ( EngineType == TEngineType::DieselEngine )
|
|
||||||
|| ( EngineType == TEngineType::DieselElectric ) ) {
|
|
||||||
dizel_startup = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Mains = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Mains = false;
|
|
||||||
// potentially knock out the pumps if their switch doesn't force them on
|
|
||||||
WaterPump.is_active &= WaterPump.is_enabled;
|
|
||||||
FuelPump.is_active &= FuelPump.is_enabled;
|
|
||||||
}
|
|
||||||
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "Direction")
|
else if (Command == "Direction")
|
||||||
|
|||||||
@@ -813,6 +813,9 @@ void TTrain::OnCommand_secondcontrollerincrease( TTrain *Train, command_data con
|
|||||||
Train->mvControlled->AnPos + 0.025,
|
Train->mvControlled->AnPos + 0.025,
|
||||||
0.0, 1.0 );
|
0.0, 1.0 );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Train->mvControlled->IncScndCtrl( 1 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -900,6 +903,8 @@ void TTrain::OnCommand_secondcontrollerdecreasefast( TTrain *Train, command_data
|
|||||||
|
|
||||||
void TTrain::OnCommand_secondcontrollerset( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_secondcontrollerset( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
|
if( Command.action != GLFW_RELEASE ) {
|
||||||
|
// on press or hold
|
||||||
auto const targetposition{ std::min<int>( Command.param1, Train->mvControlled->ScndCtrlPosNo ) };
|
auto const targetposition{ std::min<int>( Command.param1, Train->mvControlled->ScndCtrlPosNo ) };
|
||||||
while( ( targetposition < Train->mvControlled->ScndCtrlPos )
|
while( ( targetposition < Train->mvControlled->ScndCtrlPos )
|
||||||
&& ( true == Train->mvControlled->DecScndCtrl( 1 ) ) ) {
|
&& ( true == Train->mvControlled->DecScndCtrl( 1 ) ) ) {
|
||||||
@@ -912,6 +917,7 @@ void TTrain::OnCommand_secondcontrollerset( TTrain *Train, command_data const &C
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_independentbrakeincrease( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_independentbrakeincrease( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
@@ -961,10 +967,13 @@ void TTrain::OnCommand_independentbrakedecreasefast( TTrain *Train, command_data
|
|||||||
|
|
||||||
void TTrain::OnCommand_independentbrakeset( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_independentbrakeset( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
|
if( Command.action != GLFW_RELEASE ) {
|
||||||
|
|
||||||
Train->mvControlled->LocalBrakePosA = (
|
Train->mvControlled->LocalBrakePosA = (
|
||||||
clamp(
|
clamp(
|
||||||
Command.param1,
|
Command.param1,
|
||||||
0.0, 1.0 ) );
|
0.0, 1.0 ) );
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Train->mvControlled->LocalBrakePos = (
|
Train->mvControlled->LocalBrakePos = (
|
||||||
std::round(
|
std::round(
|
||||||
|
|||||||
@@ -190,11 +190,13 @@ opengl_vbogeometrybank::draw_( gfx::geometry_handle const &Geometry, gfx::stream
|
|||||||
m_buffercapacity = datasize;
|
m_buffercapacity = datasize;
|
||||||
}
|
}
|
||||||
// actual draw procedure starts here
|
// actual draw procedure starts here
|
||||||
|
auto &chunkrecord { m_chunkrecords[ Geometry.chunk - 1 ] };
|
||||||
|
// sanity check; shouldn't be needed but, eh
|
||||||
|
if( chunkrecord.size == 0 ) { return; }
|
||||||
// setup...
|
// setup...
|
||||||
if( m_activebuffer != m_buffer ) {
|
if( m_activebuffer != m_buffer ) {
|
||||||
bind_buffer();
|
bind_buffer();
|
||||||
}
|
}
|
||||||
auto &chunkrecord = m_chunkrecords[ Geometry.chunk - 1 ];
|
|
||||||
auto const &chunk = gfx::geometry_bank::chunk( Geometry );
|
auto const &chunk = gfx::geometry_bank::chunk( Geometry );
|
||||||
if( false == chunkrecord.is_good ) {
|
if( false == chunkrecord.is_good ) {
|
||||||
// we may potentially need to upload new buffer data before we can draw it
|
// we may potentially need to upload new buffer data before we can draw it
|
||||||
|
|||||||
13
renderer.cpp
13
renderer.cpp
@@ -2588,7 +2588,8 @@ opengl_renderer::Render( TSubModel *Submodel ) {
|
|||||||
// material configuration:
|
// material configuration:
|
||||||
Bind_Material( null_handle );
|
Bind_Material( null_handle );
|
||||||
// limit impact of dense fog on the lights
|
// limit impact of dense fog on the lights
|
||||||
::glFogf( GL_FOG_DENSITY, static_cast<GLfloat>( 1.0 / std::min<float>( Global.fFogEnd, m_fogrange * 2 ) ) );
|
auto const lightrange { std::max<float>( 500, m_fogrange * 2 ) }; // arbitrary, visibility at least 750m
|
||||||
|
::glFogf( GL_FOG_DENSITY, static_cast<GLfloat>( 1.0 / lightrange ) );
|
||||||
|
|
||||||
::glPushAttrib( GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_POINT_BIT );
|
::glPushAttrib( GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_POINT_BIT );
|
||||||
::glDisable( GL_LIGHTING );
|
::glDisable( GL_LIGHTING );
|
||||||
@@ -3123,7 +3124,8 @@ opengl_renderer::Render_Alpha( TAnimModel *Instance ) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
opengl_renderer::Render_Alpha( TTraction *Traction ) {
|
opengl_renderer::Render_Alpha( TTraction *Traction ) {
|
||||||
|
/*
|
||||||
|
// NOTE: test disabled as this call is only executed as part of the colour pass
|
||||||
double distancesquared;
|
double distancesquared;
|
||||||
switch( m_renderpass.draw_mode ) {
|
switch( m_renderpass.draw_mode ) {
|
||||||
case rendermode::shadows: {
|
case rendermode::shadows: {
|
||||||
@@ -3136,6 +3138,8 @@ opengl_renderer::Render_Alpha( TTraction *Traction ) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
auto const distancesquared { glm::length2( ( Traction->location() - m_renderpass.camera.position() ) / (double)Global.ZoomFactor ) / Global.fDistanceFactor };
|
||||||
if( ( distancesquared < Traction->m_rangesquaredmin )
|
if( ( distancesquared < Traction->m_rangesquaredmin )
|
||||||
|| ( distancesquared >= Traction->m_rangesquaredmax ) ) {
|
|| ( distancesquared >= Traction->m_rangesquaredmax ) ) {
|
||||||
return;
|
return;
|
||||||
@@ -3184,7 +3188,8 @@ void
|
|||||||
opengl_renderer::Render_Alpha( scene::lines_node const &Lines ) {
|
opengl_renderer::Render_Alpha( scene::lines_node const &Lines ) {
|
||||||
|
|
||||||
auto const &data { Lines.data() };
|
auto const &data { Lines.data() };
|
||||||
|
/*
|
||||||
|
// NOTE: test disabled as this call is only executed as part of the colour pass
|
||||||
double distancesquared;
|
double distancesquared;
|
||||||
switch( m_renderpass.draw_mode ) {
|
switch( m_renderpass.draw_mode ) {
|
||||||
case rendermode::shadows: {
|
case rendermode::shadows: {
|
||||||
@@ -3197,6 +3202,8 @@ opengl_renderer::Render_Alpha( scene::lines_node const &Lines ) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
auto const distancesquared { glm::length2( ( data.area.center - m_renderpass.camera.position() ) / (double)Global.ZoomFactor ) / Global.fDistanceFactor };
|
||||||
if( ( distancesquared < data.rangesquared_min )
|
if( ( distancesquared < data.rangesquared_min )
|
||||||
|| ( distancesquared >= data.rangesquared_max ) ) {
|
|| ( distancesquared >= data.rangesquared_max ) ) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
//#define EU07_USE_DEBUG_CABSHADOWMAP
|
//#define EU07_USE_DEBUG_CABSHADOWMAP
|
||||||
//#define EU07_USE_DEBUG_CAMERA
|
//#define EU07_USE_DEBUG_CAMERA
|
||||||
//#define EU07_USE_DEBUG_SOUNDEMITTERS
|
//#define EU07_USE_DEBUG_SOUNDEMITTERS
|
||||||
#define EU07_USEIMGUIIMPLOPENGL2
|
//#define EU07_USEIMGUIIMPLOPENGL2
|
||||||
|
|
||||||
struct opengl_light : public basic_light {
|
struct opengl_light : public basic_light {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user