mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 03:09:18 +02:00
build 181016. freespot color override, vehicle start jolt sound, switch trackbed generation fixes
This commit is contained in:
35
renderer.cpp
35
renderer.cpp
@@ -2579,6 +2579,11 @@ opengl_renderer::Render( TSubModel *Submodel ) {
|
||||
auto const unitstate = m_unitstate;
|
||||
switch_units( m_unitstate.diffuse, false, false );
|
||||
|
||||
auto const *lightcolor {
|
||||
Submodel->DiffuseOverride.r < 0.f ? // -1 indicates no override
|
||||
glm::value_ptr( Submodel->f4Diffuse ) :
|
||||
glm::value_ptr( Submodel->DiffuseOverride ) };
|
||||
|
||||
// main draw call
|
||||
if( Global.Overcast > 1.f ) {
|
||||
// fake fog halo
|
||||
@@ -2587,11 +2592,12 @@ opengl_renderer::Render( TSubModel *Submodel ) {
|
||||
2.f, 1.f,
|
||||
clamp<float>( Global.fFogEnd / 2000, 0.f, 1.f ) )
|
||||
* std::max( 1.f, Global.Overcast ) };
|
||||
|
||||
::glPointSize( pointsize * fogfactor );
|
||||
::glColor4f(
|
||||
Submodel->f4Diffuse[ 0 ],
|
||||
Submodel->f4Diffuse[ 1 ],
|
||||
Submodel->f4Diffuse[ 2 ],
|
||||
lightcolor[ 0 ],
|
||||
lightcolor[ 1 ],
|
||||
lightcolor[ 2 ],
|
||||
Submodel->fVisible * std::min( 1.f, lightlevel ) * 0.5f );
|
||||
::glDepthMask( GL_FALSE );
|
||||
m_geometry.draw( Submodel->m_geometry );
|
||||
@@ -2599,9 +2605,9 @@ opengl_renderer::Render( TSubModel *Submodel ) {
|
||||
}
|
||||
::glPointSize( pointsize );
|
||||
::glColor4f(
|
||||
Submodel->f4Diffuse[ 0 ],
|
||||
Submodel->f4Diffuse[ 1 ],
|
||||
Submodel->f4Diffuse[ 2 ],
|
||||
lightcolor[ 0 ],
|
||||
lightcolor[ 1 ],
|
||||
lightcolor[ 2 ],
|
||||
Submodel->fVisible * std::min( 1.f, lightlevel ) );
|
||||
m_geometry.draw( Submodel->m_geometry );
|
||||
|
||||
@@ -3507,7 +3513,6 @@ opengl_renderer::Render_Alpha( TSubModel *Submodel ) {
|
||||
::glPushAttrib( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT );
|
||||
|
||||
Bind_Texture( m_glaretexture );
|
||||
::glColor4f( Submodel->f4Diffuse[ 0 ], Submodel->f4Diffuse[ 1 ], Submodel->f4Diffuse[ 2 ], Submodel->fVisible * glarelevel );
|
||||
::glDisable( GL_LIGHTING );
|
||||
::glDisable( GL_FOG );
|
||||
::glDepthMask( GL_FALSE );
|
||||
@@ -3518,12 +3523,19 @@ opengl_renderer::Render_Alpha( TSubModel *Submodel ) {
|
||||
::glTranslatef( lightcenter.x, lightcenter.y, lightcenter.z ); // początek układu zostaje bez zmian
|
||||
::glRotated( std::atan2( lightcenter.x, lightcenter.z ) * 180.0 / M_PI, 0.0, 1.0, 0.0 ); // jedynie obracamy w pionie o kąt
|
||||
// disable shadows so they don't obstruct self-lit items
|
||||
/*
|
||||
setup_shadow_color( colors::white );
|
||||
*/
|
||||
auto const unitstate = m_unitstate;
|
||||
switch_units( unitstate.diffuse, false, false );
|
||||
|
||||
auto const *lightcolor {
|
||||
Submodel->DiffuseOverride.r < 0.f ? // -1 indicates no override
|
||||
glm::value_ptr( Submodel->f4Diffuse ) :
|
||||
glm::value_ptr( Submodel->DiffuseOverride ) };
|
||||
::glColor4f(
|
||||
lightcolor[ 0 ],
|
||||
lightcolor[ 1 ],
|
||||
lightcolor[ 2 ],
|
||||
Submodel->fVisible * glarelevel );
|
||||
|
||||
// main draw call
|
||||
m_geometry.draw( m_billboardgeometry );
|
||||
/*
|
||||
@@ -3535,9 +3547,6 @@ opengl_renderer::Render_Alpha( TSubModel *Submodel ) {
|
||||
// ...etc instead IF we had easy access to camera's forward and right vectors. TODO: check if Camera matrix is accessible
|
||||
*/
|
||||
// post-render cleanup
|
||||
/*
|
||||
setup_shadow_color( m_shadowcolor );
|
||||
*/
|
||||
switch_units( unitstate.diffuse, unitstate.shadows, unitstate.reflections );
|
||||
|
||||
::glPopMatrix();
|
||||
|
||||
Reference in New Issue
Block a user