mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 22:09:19 +02:00
fixed light controls in EZT modules, added missing vbo code
This commit is contained in:
19
DynObj.cpp
19
DynObj.cpp
@@ -2451,19 +2451,18 @@ void TDynamicObject::AttachPrev(TDynamicObject *Object, int iType)
|
|||||||
Object->NextConnected = this; // on ma nas z tyłu
|
Object->NextConnected = this; // on ma nas z tyłu
|
||||||
Object->NextConnectedNo = iDirection;
|
Object->NextConnectedNo = iDirection;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
// NOTE: this appears unnecessary and only messes things for the programmable lights function, which walks along
|
||||||
|
// whole trainset and expects each module to point to its own lights. Disabled, TBD, TODO: test for side-effects and delete if there's none
|
||||||
if (MoverParameters->TrainType & dt_EZT) // w przypadku łączenia członów,
|
if (MoverParameters->TrainType & dt_EZT) // w przypadku łączenia członów,
|
||||||
// światła w rozrządczym zależą od
|
// światła w rozrządczym zależą od stanu w silnikowym
|
||||||
// stanu w silnikowym
|
if (MoverParameters->Couplers[iDirection].AllowedFlag & ctrain_depot) // gdy sprzęgi łączone warsztatowo (powiedzmy)
|
||||||
if (MoverParameters->Couplers[iDirection].AllowedFlag &
|
if ((MoverParameters->Power < 1.0) && (Object->MoverParameters->Power > 1.0)) // my nie mamy mocy, ale ten drugi ma
|
||||||
ctrain_depot) // gdy sprzęgi łączone warsztatowo (powiedzmy)
|
iLights = Object->MoverParameters->iLights; // to w tym z mocą będą światła załączane, a w tym bez tylko widoczne
|
||||||
if ((MoverParameters->Power < 1.0) &&
|
|
||||||
(Object->MoverParameters->Power > 1.0)) // my nie mamy mocy, ale ten drugi ma
|
|
||||||
iLights = Object->MoverParameters->iLights; // to w tym z mocą będą światła
|
|
||||||
// załączane, a w tym bez tylko widoczne
|
|
||||||
else if ((MoverParameters->Power > 1.0) &&
|
else if ((MoverParameters->Power > 1.0) &&
|
||||||
(Object->MoverParameters->Power < 1.0)) // my mamy moc, ale ten drugi nie ma
|
(Object->MoverParameters->Power < 1.0)) // my mamy moc, ale ten drugi nie ma
|
||||||
Object->iLights = MoverParameters->iLights; // to w tym z mocą będą światła
|
Object->iLights = MoverParameters->iLights; // to w tym z mocą będą światła załączane, a w tym bez tylko widoczne
|
||||||
// załączane, a w tym bez tylko widoczne
|
*/
|
||||||
return;
|
return;
|
||||||
// SetPneumatic(1,1); //Ra: to i tak się nie wykonywało po return
|
// SetPneumatic(1,1); //Ra: to i tak się nie wykonywało po return
|
||||||
// SetPneumatic(1,0);
|
// SetPneumatic(1,0);
|
||||||
|
|||||||
@@ -73,16 +73,18 @@ light_array::update() {
|
|||||||
else {
|
else {
|
||||||
light.intensity = 0.0f;
|
light.intensity = 0.0f;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
// crude catch for unmanned modules which share the light state with the controlled unit.
|
// crude catch for unmanned modules which share the light state with the controlled unit.
|
||||||
// why don't they get their own light bits btw ._.
|
// why don't they get their own light bits btw ._.
|
||||||
// TODO, TBD: have separate light bits for each vehicle, so this override isn't necessary
|
// TODO, TBD: have separate light bits for each vehicle, so this override isn't necessary
|
||||||
|
// NOTE: should be no longer needed, test and delete if there's no ill effects
|
||||||
if( ( light.owner->Controller == AIdriver )
|
if( ( light.owner->Controller == AIdriver )
|
||||||
&& ( light.owner->Mechanik == nullptr ) ) {
|
&& ( light.owner->Mechanik == nullptr ) ) {
|
||||||
|
|
||||||
light.intensity = 0.0f;
|
light.intensity = 0.0f;
|
||||||
light.count = 0;
|
light.count = 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// with battery off the lights are off
|
// with battery off the lights are off
|
||||||
|
|||||||
33
renderer.cpp
33
renderer.cpp
@@ -363,9 +363,37 @@ opengl_renderer::Render_Alpha( TDynamicObject *Dynamic ) {
|
|||||||
::glTranslated( Dynamic->vPosition.x, Dynamic->vPosition.y, Dynamic->vPosition.z ); // standardowe przesunięcie względem początku scenerii
|
::glTranslated( Dynamic->vPosition.x, Dynamic->vPosition.y, Dynamic->vPosition.z ); // standardowe przesunięcie względem początku scenerii
|
||||||
|
|
||||||
::glMultMatrixd( Dynamic->mMatrix.getArray() );
|
::glMultMatrixd( Dynamic->mMatrix.getArray() );
|
||||||
// wersja Display Lists
|
|
||||||
// NOTE: VBO path is removed
|
|
||||||
// TODO: implement universal render path down the road
|
// TODO: implement universal render path down the road
|
||||||
|
if( Global::bUseVBO ) {
|
||||||
|
// wersja VBO
|
||||||
|
if( Dynamic->mdLowPolyInt ) {
|
||||||
|
if( FreeFlyModeFlag ? true : !Dynamic->mdKabina || !Dynamic->bDisplayCab ) {
|
||||||
|
// enable cab light if needed
|
||||||
|
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||||
|
|
||||||
|
// crude way to light the cabin, until we have something more complete in place
|
||||||
|
auto const cablight = Dynamic->InteriorLight * Dynamic->InteriorLightLevel;
|
||||||
|
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, &cablight.x );
|
||||||
|
}
|
||||||
|
|
||||||
|
Dynamic->mdLowPolyInt->RaRenderAlpha( squaredistance, Dynamic->Material()->replacable_skins, Dynamic->Material()->textures_alpha );
|
||||||
|
|
||||||
|
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||||
|
// reset the overall ambient
|
||||||
|
GLfloat ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||||
|
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, ambient );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Dynamic->mdModel->RaRenderAlpha( squaredistance, Dynamic->Material()->replacable_skins, Dynamic->Material()->textures_alpha );
|
||||||
|
|
||||||
|
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
|
||||||
|
Dynamic->mdLoad->RaRenderAlpha( squaredistance, Dynamic->Material()->replacable_skins, Dynamic->Material()->textures_alpha );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// wersja Display Lists
|
||||||
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 ) {
|
||||||
@@ -391,6 +419,7 @@ opengl_renderer::Render_Alpha( TDynamicObject *Dynamic ) {
|
|||||||
|
|
||||||
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
|
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
|
||||||
Render_Alpha( Dynamic->mdLoad, Dynamic->Material(), squaredistance );
|
Render_Alpha( Dynamic->mdLoad, Dynamic->Material(), squaredistance );
|
||||||
|
}
|
||||||
|
|
||||||
::glPopMatrix();
|
::glPopMatrix();
|
||||||
|
|
||||||
|
|||||||
@@ -21,11 +21,16 @@ cStars::render() {
|
|||||||
::glRotatef( -std::fmod( Global::fTimeAngleDeg, 360.0f ), 0.0f, 1.0f, 0.0f ); // obrót dobowy osi OX
|
::glRotatef( -std::fmod( Global::fTimeAngleDeg, 360.0f ), 0.0f, 1.0f, 0.0f ); // obrót dobowy osi OX
|
||||||
|
|
||||||
::glPointSize( 2.0f );
|
::glPointSize( 2.0f );
|
||||||
|
if( Global::bUseVBO ) {
|
||||||
|
m_stars.RaRender( 1.0, 0 );
|
||||||
|
}
|
||||||
|
else {
|
||||||
#ifdef EU07_USE_OLD_RENDERCODE
|
#ifdef EU07_USE_OLD_RENDERCODE
|
||||||
m_stars.Render( 1.0 );
|
m_stars.Render( 1.0 );
|
||||||
#else
|
#else
|
||||||
GfxRenderer.Render( &m_stars, nullptr, 1.0 );
|
GfxRenderer.Render( &m_stars, nullptr, 1.0 );
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
::glPointSize( 3.0f );
|
::glPointSize( 3.0f );
|
||||||
|
|
||||||
::glPopMatrix();
|
::glPopMatrix();
|
||||||
|
|||||||
Reference in New Issue
Block a user