mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
celestial bodies scaling tweak, driver cab included in the compartment lighting system
This commit is contained in:
1
Driver.h
1
Driver.h
@@ -255,6 +255,7 @@ private:
|
|||||||
sound_source tsGuardSignal { sound_placement::internal };
|
sound_source tsGuardSignal { sound_placement::internal };
|
||||||
std::array<int, 2> m_lighthints { -1 }; // suggested light patterns
|
std::array<int, 2> m_lighthints { -1 }; // suggested light patterns
|
||||||
public:
|
public:
|
||||||
|
int HelperState = 0; //stan pomocnika maszynisty
|
||||||
double AccPreferred = 0.0; // preferowane przyspieszenie (wg psychiki kierującego, zmniejszana przy wykryciu kolizji)
|
double AccPreferred = 0.0; // preferowane przyspieszenie (wg psychiki kierującego, zmniejszana przy wykryciu kolizji)
|
||||||
double AccDesired = AccPreferred; // przyspieszenie, jakie ma utrzymywać (<0:nie przyspieszaj,<-0.1:hamuj)
|
double AccDesired = AccPreferred; // przyspieszenie, jakie ma utrzymywać (<0:nie przyspieszaj,<-0.1:hamuj)
|
||||||
double VelDesired = 0.0; // predkość, z jaką ma jechać, wynikająca z analizy tableki; <=VelSignal
|
double VelDesired = 0.0; // predkość, z jaką ma jechać, wynikająca z analizy tableki; <=VelSignal
|
||||||
|
|||||||
16
DynObj.cpp
16
DynObj.cpp
@@ -647,6 +647,22 @@ TDynamicObject::toggle_lights() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TDynamicObject::set_cab_lights( float const Level ) {
|
||||||
|
|
||||||
|
if( Level == InteriorLightLevel ) { return; }
|
||||||
|
|
||||||
|
InteriorLightLevel = Level;
|
||||||
|
|
||||||
|
for( auto §ion : Sections ) {
|
||||||
|
// cab compartments are placed at the beginning of the list, so we can bail out as soon as we find different compartment type
|
||||||
|
auto const sectionname { section.compartment->pName };
|
||||||
|
if( sectionname.find( "cab" ) != 0 ) { return; }
|
||||||
|
|
||||||
|
section.light_level = Level;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ABu 29.01.05 przeklejone z render i renderalpha: *********************
|
// ABu 29.01.05 przeklejone z render i renderalpha: *********************
|
||||||
void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||||
{ // ABu290105: pozbierane i uporzadkowane powtarzajace
|
{ // ABu290105: pozbierane i uporzadkowane powtarzajace
|
||||||
|
|||||||
3
DynObj.h
3
DynObj.h
@@ -612,8 +612,9 @@ private:
|
|||||||
void CouplersDettach(double MinDist, int MyScanDir);
|
void CouplersDettach(double MinDist, int MyScanDir);
|
||||||
void RadioStop();
|
void RadioStop();
|
||||||
void Damage(char flag);
|
void Damage(char flag);
|
||||||
void RaLightsSet(int head, int rear);
|
void RaLightsSet(int head, int rear);
|
||||||
int LightList( side const Side ) const { return iInventory[ Side ]; }
|
int LightList( side const Side ) const { return iInventory[ Side ]; }
|
||||||
|
void set_cab_lights( float const Level );
|
||||||
TDynamicObject * FirstFind(int &coupler_nr, int cf = 1);
|
TDynamicObject * FirstFind(int &coupler_nr, int cf = 1);
|
||||||
float GetEPP(); // wyliczanie sredniego cisnienia w PG
|
float GetEPP(); // wyliczanie sredniego cisnienia w PG
|
||||||
int DirectionSet(int d); // ustawienie kierunku w składzie
|
int DirectionSet(int d); // ustawienie kierunku w składzie
|
||||||
|
|||||||
18
Train.cpp
18
Train.cpp
@@ -4709,13 +4709,10 @@ void TTrain::OnCommand_cabchangebackward( TTrain *Train, command_data const &Com
|
|||||||
|
|
||||||
// cab movement update, fixed step part
|
// cab movement update, fixed step part
|
||||||
void TTrain::UpdateMechPosition(double dt)
|
void TTrain::UpdateMechPosition(double dt)
|
||||||
{ // Ra: mechanik powinien być
|
{ // Ra: mechanik powinien być telepany niezależnie od pozycji pojazdu
|
||||||
// telepany niezależnie od pozycji
|
|
||||||
// pojazdu
|
|
||||||
// Ra: trzeba zrobić model bujania głową i wczepić go do pojazdu
|
// Ra: trzeba zrobić model bujania głową i wczepić go do pojazdu
|
||||||
|
|
||||||
// DynamicObject->vFront=DynamicObject->GetDirection(); //to jest już
|
// DynamicObject->vFront=DynamicObject->GetDirection(); //to jest już policzone
|
||||||
// policzone
|
|
||||||
|
|
||||||
// Ra: tu by się przydało uwzględnić rozkład sił:
|
// Ra: tu by się przydało uwzględnić rozkład sił:
|
||||||
// - na postoju horyzont prosto, kabina skosem
|
// - na postoju horyzont prosto, kabina skosem
|
||||||
@@ -4792,7 +4789,6 @@ void TTrain::UpdateMechPosition(double dt)
|
|||||||
shake *= 0.85;
|
shake *= 0.85;
|
||||||
|
|
||||||
vMechVelocity -= ( shake + vMechVelocity * 100 ) * ( fMechSpringX + fMechSpringY + fMechSpringZ ) / ( 200 );
|
vMechVelocity -= ( shake + vMechVelocity * 100 ) * ( fMechSpringX + fMechSpringY + fMechSpringZ ) / ( 200 );
|
||||||
// shake *= 0.95 * dt; // shake damping
|
|
||||||
|
|
||||||
// McZapkie:
|
// McZapkie:
|
||||||
pMechShake += vMechVelocity * dt;
|
pMechShake += vMechVelocity * dt;
|
||||||
@@ -4804,8 +4800,6 @@ void TTrain::UpdateMechPosition(double dt)
|
|||||||
pMechOffset += vMechMovement * dt;
|
pMechOffset += vMechMovement * dt;
|
||||||
// ABu011104: 5*pMechShake.y, zeby ladnie pudlem rzucalo :)
|
// ABu011104: 5*pMechShake.y, zeby ladnie pudlem rzucalo :)
|
||||||
pMechPosition = pMechOffset + Math3D::vector3( 1.5 * pMechShake.x, 2.0 * pMechShake.y, 1.5 * pMechShake.z );
|
pMechPosition = pMechOffset + Math3D::vector3( 1.5 * pMechShake.x, 2.0 * pMechShake.y, 1.5 * pMechShake.z );
|
||||||
|
|
||||||
// pMechShake = interpolate( pMechShake, Math3D::vector3(), clamp( dt, 0.0, 1.0 ) );
|
|
||||||
}
|
}
|
||||||
else { // hamowanie rzucania przy spadku FPS
|
else { // hamowanie rzucania przy spadku FPS
|
||||||
pMechShake -= pMechShake * std::min( dt, 1.0 ); // po tym chyba potrafią zostać jakieś ułamki, które powodują zjazd
|
pMechShake -= pMechShake * std::min( dt, 1.0 ); // po tym chyba potrafią zostać jakieś ułamki, które powodują zjazd
|
||||||
@@ -5911,11 +5905,12 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
|
|
||||||
// calculate current level of interior illumination
|
// calculate current level of interior illumination
|
||||||
// TODO: organize it along with rest of train update in a more sensible arrangement
|
// TODO: organize it along with rest of train update in a more sensible arrangement
|
||||||
|
auto interiorlightlevel { 0.f };
|
||||||
switch( iCabLightFlag ) // Ra: uzeleżnic od napięcia w obwodzie sterowania
|
switch( iCabLightFlag ) // Ra: uzeleżnic od napięcia w obwodzie sterowania
|
||||||
{ // hunter-091012: uzaleznienie jasnosci od przetwornicy
|
{ // hunter-091012: uzaleznienie jasnosci od przetwornicy
|
||||||
case 0: {
|
case 0: {
|
||||||
//światło wewnętrzne zgaszone
|
//światło wewnętrzne zgaszone
|
||||||
DynamicObject->InteriorLightLevel = 0.0f;
|
interiorlightlevel = 0.0f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
@@ -5925,7 +5920,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
|| ( ( ( mvOccupied->Couplers[ side::front ].CouplingFlag & coupling::permanent ) != 0 ) && mvOccupied->Couplers[ side::front ].Connected->ConverterFlag )
|
|| ( ( ( mvOccupied->Couplers[ side::front ].CouplingFlag & coupling::permanent ) != 0 ) && mvOccupied->Couplers[ side::front ].Connected->ConverterFlag )
|
||||||
|| ( ( ( mvOccupied->Couplers[ side::rear ].CouplingFlag & coupling::permanent ) != 0 ) && mvOccupied->Couplers[ side::rear ].Connected->ConverterFlag ) ) };
|
|| ( ( ( mvOccupied->Couplers[ side::rear ].CouplingFlag & coupling::permanent ) != 0 ) && mvOccupied->Couplers[ side::rear ].Connected->ConverterFlag ) ) };
|
||||||
|
|
||||||
DynamicObject->InteriorLightLevel = (
|
interiorlightlevel = (
|
||||||
converteractive ?
|
converteractive ?
|
||||||
0.4f :
|
0.4f :
|
||||||
0.2f );
|
0.2f );
|
||||||
@@ -5938,13 +5933,14 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
|| ( ( ( mvOccupied->Couplers[ side::front ].CouplingFlag & coupling::permanent ) != 0 ) && mvOccupied->Couplers[ side::front ].Connected->ConverterFlag )
|
|| ( ( ( mvOccupied->Couplers[ side::front ].CouplingFlag & coupling::permanent ) != 0 ) && mvOccupied->Couplers[ side::front ].Connected->ConverterFlag )
|
||||||
|| ( ( ( mvOccupied->Couplers[ side::rear ].CouplingFlag & coupling::permanent ) != 0 ) && mvOccupied->Couplers[ side::rear ].Connected->ConverterFlag ) ) };
|
|| ( ( ( mvOccupied->Couplers[ side::rear ].CouplingFlag & coupling::permanent ) != 0 ) && mvOccupied->Couplers[ side::rear ].Connected->ConverterFlag ) ) };
|
||||||
|
|
||||||
DynamicObject->InteriorLightLevel = (
|
interiorlightlevel = (
|
||||||
converteractive ?
|
converteractive ?
|
||||||
1.0f :
|
1.0f :
|
||||||
0.5f );
|
0.5f );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DynamicObject->set_cab_lights( interiorlightlevel );
|
||||||
|
|
||||||
// anti slip system activation, maintained while the control button is down
|
// anti slip system activation, maintained while the control button is down
|
||||||
if( mvOccupied->BrakeSystem != TBrakeSystem::ElectroPneumatic ) {
|
if( mvOccupied->BrakeSystem != TBrakeSystem::ElectroPneumatic ) {
|
||||||
|
|||||||
21
renderer.cpp
21
renderer.cpp
@@ -1488,7 +1488,10 @@ opengl_renderer::Render( world_environment *Environment ) {
|
|||||||
::glLoadIdentity(); // macierz jedynkowa
|
::glLoadIdentity(); // macierz jedynkowa
|
||||||
::glTranslatef( sunposition.x, sunposition.y, sunposition.z ); // początek układu zostaje bez zmian
|
::glTranslatef( sunposition.x, sunposition.y, sunposition.z ); // początek układu zostaje bez zmian
|
||||||
|
|
||||||
float const size = 0.045f;
|
float const size = interpolate( // TODO: expose distance/scale factor from the moon object
|
||||||
|
0.0325f,
|
||||||
|
0.0275f,
|
||||||
|
clamp( Environment->m_sun.getAngle(), 0.f, 90.f ) / 90.f );
|
||||||
::glBegin( GL_TRIANGLE_STRIP );
|
::glBegin( GL_TRIANGLE_STRIP );
|
||||||
::glMultiTexCoord2f( m_diffusetextureunit, 1.f, 1.f ); ::glVertex3f( -size, size, 0.f );
|
::glMultiTexCoord2f( m_diffusetextureunit, 1.f, 1.f ); ::glVertex3f( -size, size, 0.f );
|
||||||
::glMultiTexCoord2f( m_diffusetextureunit, 1.f, 0.f ); ::glVertex3f( -size, -size, 0.f );
|
::glMultiTexCoord2f( m_diffusetextureunit, 1.f, 0.f ); ::glVertex3f( -size, -size, 0.f );
|
||||||
@@ -1518,8 +1521,8 @@ opengl_renderer::Render( world_environment *Environment ) {
|
|||||||
::glTranslatef( moonposition.x, moonposition.y, moonposition.z );
|
::glTranslatef( moonposition.x, moonposition.y, moonposition.z );
|
||||||
|
|
||||||
float const size = interpolate( // TODO: expose distance/scale factor from the moon object
|
float const size = interpolate( // TODO: expose distance/scale factor from the moon object
|
||||||
0.0175f,
|
0.0160f,
|
||||||
0.015f,
|
0.0135f,
|
||||||
clamp( Environment->m_moon.getAngle(), 0.f, 90.f ) / 90.f );
|
clamp( Environment->m_moon.getAngle(), 0.f, 90.f ) / 90.f );
|
||||||
// choose the moon appearance variant, based on current moon phase
|
// choose the moon appearance variant, based on current moon phase
|
||||||
// NOTE: implementation specific, 8 variants are laid out in 3x3 arrangement
|
// NOTE: implementation specific, 8 variants are laid out in 3x3 arrangement
|
||||||
@@ -2156,19 +2159,21 @@ opengl_renderer::Render( TDynamicObject *Dynamic ) {
|
|||||||
if( Dynamic->mdLowPolyInt ) {
|
if( Dynamic->mdLowPolyInt ) {
|
||||||
// low poly interior
|
// low poly interior
|
||||||
if( FreeFlyModeFlag ? true : !Dynamic->mdKabina || !Dynamic->bDisplayCab ) {
|
if( FreeFlyModeFlag ? true : !Dynamic->mdKabina || !Dynamic->bDisplayCab ) {
|
||||||
|
/*
|
||||||
// enable cab light if needed
|
// enable cab light if needed
|
||||||
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||||
|
|
||||||
// crude way to light the cabin, until we have something more complete in place
|
// crude way to light the cabin, until we have something more complete in place
|
||||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( Dynamic->InteriorLight * Dynamic->InteriorLightLevel ) );
|
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( Dynamic->InteriorLight * Dynamic->InteriorLightLevel ) );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
Render( Dynamic->mdLowPolyInt, Dynamic->Material(), squaredistance );
|
Render( Dynamic->mdLowPolyInt, Dynamic->Material(), squaredistance );
|
||||||
|
/*
|
||||||
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||||
// reset the overall ambient
|
// reset the overall ambient
|
||||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( m_baseambient ) );
|
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( m_baseambient ) );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( Dynamic->mdModel )
|
if( Dynamic->mdModel )
|
||||||
@@ -3241,19 +3246,21 @@ opengl_renderer::Render_Alpha( TDynamicObject *Dynamic ) {
|
|||||||
if( Dynamic->mdLowPolyInt ) {
|
if( Dynamic->mdLowPolyInt ) {
|
||||||
// low poly interior
|
// low poly interior
|
||||||
if( FreeFlyModeFlag ? true : !Dynamic->mdKabina || !Dynamic->bDisplayCab ) {
|
if( FreeFlyModeFlag ? true : !Dynamic->mdKabina || !Dynamic->bDisplayCab ) {
|
||||||
|
/*
|
||||||
// enable cab light if needed
|
// enable cab light if needed
|
||||||
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||||
|
|
||||||
// crude way to light the cabin, until we have something more complete in place
|
// crude way to light the cabin, until we have something more complete in place
|
||||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( Dynamic->InteriorLight * Dynamic->InteriorLightLevel ) );
|
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( Dynamic->InteriorLight * Dynamic->InteriorLightLevel ) );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
Render_Alpha( Dynamic->mdLowPolyInt, Dynamic->Material(), squaredistance );
|
Render_Alpha( Dynamic->mdLowPolyInt, Dynamic->Material(), squaredistance );
|
||||||
|
/*
|
||||||
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||||
// reset the overall ambient
|
// reset the overall ambient
|
||||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( m_baseambient ) );
|
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( m_baseambient ) );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user