no pneumatic relay sound on brake acting speed change, enabled playback of multiple bookend sounds, extra pantograph control for ai during longer stops, shadow angle calculation tweak, moon appearance tweak, minor bug fixes

This commit is contained in:
tmj-fstate
2018-02-13 23:58:31 +01:00
parent e65e01a7a2
commit 62327d5d08
17 changed files with 185 additions and 140 deletions

26
sun.cpp
View File

@@ -54,7 +54,7 @@ cSun::update() {
position = glm::rotateX( position, glm::radians( static_cast<float>( m_body.elevref ) ) );
position = glm::rotateY( position, glm::radians( static_cast<float>( -m_body.hrang ) ) );
m_position = position;
m_position = glm::normalize( position );
}
void
@@ -62,12 +62,13 @@ cSun::render() {
::glColor4f( 255.f / 255.f, 242.f / 255.f, 231.f / 255.f, 1.f );
// debug line to locate the sun easier
::glBegin( GL_LINES );
::glVertex3fv( glm::value_ptr( m_position ) );
::glVertex3f( m_position.x, 0.f, m_position.z );
auto const position { m_position * 2000.f };
::glBegin( GL_LINES );
::glVertex3fv( glm::value_ptr( position ) );
::glVertex3f( position.x, 0.f, position.z );
::glEnd();
::glPushMatrix();
::glTranslatef( m_position.x, m_position.y, m_position.z );
::glTranslatef( position.x, position.y, position.z );
// radius is a result of scaling true distance down to 2km -- it's scaled by equal ratio
::gluSphere( sunsphere, m_body.distance * 9.359157, 12, 12 );
::glPopMatrix();
@@ -140,14 +141,15 @@ void cSun::move() {
if( m_observer.minute >= 0 ) { localtime.wMinute = m_observer.minute; }
if( m_observer.second >= 0 ) { localtime.wSecond = m_observer.second; }
double ut = localtime.wHour
+ localtime.wMinute / 60.0; // too low resolution, noticeable skips
// NOTE: finer resolution disabled to reduce shadow crawl in current implementation
/*
+ localtime.wSecond / 3600.0 // good enough in normal circumstances
double ut =
localtime.wHour
+ localtime.wMinute / 60.0 // too low resolution, noticeable skips
+ localtime.wSecond / 3600.0; // good enough in normal circumstances
/*
+ localtime.wMilliseconds / 3600000.0; // for really smooth movement
*/
double daynumber = 367 * localtime.wYear
*/
double daynumber =
367 * localtime.wYear
- 7 * ( localtime.wYear + ( localtime.wMonth + 9 ) / 12 ) / 4
+ 275 * localtime.wMonth / 9
+ localtime.wDay