mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-19 09:59:18 +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->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,
|
||||
// światła w rozrządczym zależą od
|
||||
// stanu w silnikowym
|
||||
if (MoverParameters->Couplers[iDirection].AllowedFlag &
|
||||
ctrain_depot) // gdy sprzęgi łączone warsztatowo (powiedzmy)
|
||||
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
|
||||
// światła w rozrządczym zależą od stanu w silnikowym
|
||||
if (MoverParameters->Couplers[iDirection].AllowedFlag & ctrain_depot) // gdy sprzęgi łączone warsztatowo (powiedzmy)
|
||||
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) &&
|
||||
(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
|
||||
// załączane, a w tym bez tylko widoczne
|
||||
Object->iLights = MoverParameters->iLights; // to w tym z mocą będą światła załączane, a w tym bez tylko widoczne
|
||||
*/
|
||||
return;
|
||||
// SetPneumatic(1,1); //Ra: to i tak się nie wykonywało po return
|
||||
// SetPneumatic(1,0);
|
||||
|
||||
@@ -73,16 +73,18 @@ light_array::update() {
|
||||
else {
|
||||
light.intensity = 0.0f;
|
||||
}
|
||||
|
||||
/*
|
||||
// crude catch for unmanned modules which share the light state with the controlled unit.
|
||||
// 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
|
||||
// NOTE: should be no longer needed, test and delete if there's no ill effects
|
||||
if( ( light.owner->Controller == AIdriver )
|
||||
&& ( light.owner->Mechanik == nullptr ) ) {
|
||||
|
||||
light.intensity = 0.0f;
|
||||
light.count = 0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
else {
|
||||
// with battery off the lights are off
|
||||
|
||||
67
renderer.cpp
67
renderer.cpp
@@ -363,34 +363,63 @@ opengl_renderer::Render_Alpha( TDynamicObject *Dynamic ) {
|
||||
::glTranslated( Dynamic->vPosition.x, Dynamic->vPosition.y, Dynamic->vPosition.z ); // standardowe przesunięcie względem początku scenerii
|
||||
|
||||
::glMultMatrixd( Dynamic->mMatrix.getArray() );
|
||||
// wersja Display Lists
|
||||
// NOTE: VBO path is removed
|
||||
|
||||
// TODO: implement universal render path down the road
|
||||
if( Dynamic->mdLowPolyInt ) {
|
||||
// low poly interior
|
||||
if( FreeFlyModeFlag ? true : !Dynamic->mdKabina || !Dynamic->bDisplayCab ) {
|
||||
// enable cab light if needed
|
||||
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||
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 );
|
||||
}
|
||||
// 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 );
|
||||
}
|
||||
|
||||
Render_Alpha( Dynamic->mdLowPolyInt, Dynamic->Material(), squaredistance );
|
||||
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 );
|
||||
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 ) {
|
||||
// low poly interior
|
||||
if( FreeFlyModeFlag ? true : !Dynamic->mdKabina || !Dynamic->bDisplayCab ) {
|
||||
// enable cab light if needed
|
||||
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||
|
||||
Render_Alpha( Dynamic->mdModel, Dynamic->Material(), squaredistance );
|
||||
// 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 );
|
||||
}
|
||||
|
||||
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
|
||||
Render_Alpha( Dynamic->mdLoad, Dynamic->Material(), squaredistance );
|
||||
Render_Alpha( Dynamic->mdLowPolyInt, Dynamic->Material(), squaredistance );
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Render_Alpha( Dynamic->mdModel, Dynamic->Material(), squaredistance );
|
||||
|
||||
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
|
||||
Render_Alpha( Dynamic->mdLoad, Dynamic->Material(), squaredistance );
|
||||
}
|
||||
|
||||
::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
|
||||
|
||||
::glPointSize( 2.0f );
|
||||
if( Global::bUseVBO ) {
|
||||
m_stars.RaRender( 1.0, 0 );
|
||||
}
|
||||
else {
|
||||
#ifdef EU07_USE_OLD_RENDERCODE
|
||||
m_stars.Render( 1.0 );
|
||||
m_stars.Render( 1.0 );
|
||||
#else
|
||||
GfxRenderer.Render( &m_stars, nullptr, 1.0 );
|
||||
GfxRenderer.Render( &m_stars, nullptr, 1.0 );
|
||||
#endif
|
||||
}
|
||||
::glPointSize( 3.0f );
|
||||
|
||||
::glPopMatrix();
|
||||
|
||||
Reference in New Issue
Block a user