Merge branch 'tmj-dev' into nogfx

This commit is contained in:
milek7
2017-08-21 20:40:16 +02:00
14 changed files with 130 additions and 861 deletions

View File

@@ -45,8 +45,8 @@ cMoon::update() {
move();
glm::vec3 position( 0.f, 0.f, -2000.f * Global::fDistanceFactor );
position = glm::rotateX( position, glm::radians<float>( m_body.elevref ) );
position = glm::rotateY( position, glm::radians<float>( -m_body.hrang ) );
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;
}
@@ -54,16 +54,16 @@ cMoon::update() {
void
cMoon::render() {
glColor4f( 225.0f/255.0f, 225.0f/255.0f, 255.0f/255.0f, 1.f );
// debug line to locate the sun easier
glBegin( GL_LINES );
glVertex3f( m_position.x, m_position.y, m_position.z );
glVertex3f( m_position.x, 0.0f, m_position.z );
glEnd();
glPushMatrix();
glTranslatef( m_position.x, m_position.y, m_position.z );
gluSphere( moonsphere, /* (float)( Global::ScreenHeight / Global::FieldOfView ) * 0.5 * */ ( m_body.distance / 60.2666 ) * 9.037461, 12, 12 );
glPopMatrix();
::glColor4f( 225.f / 255.f, 225.f / 255.f, 255.f / 255.f, 1.f );
// debug line to locate the moon easier
::glBegin( GL_LINES );
::glVertex3fv( glm::value_ptr( m_position ) );
::glVertex3f( m_position.x, 0.f, m_position.z );
::glEnd();
::glPushMatrix();
::glTranslatef( m_position.x, m_position.y, m_position.z );
::gluSphere( moonsphere, /* (float)( Global::iWindowHeight / Global::FieldOfView ) * 0.5 * */ ( m_body.distance / 60.2666 ) * 9.037461, 12, 12 );
::glPopMatrix();
}
glm::vec3
@@ -85,8 +85,8 @@ float cMoon::getIntensity() {
// calculating intensity of the sun instead, and returning 15% of the value,
// which roughly matches how much sunlight is reflected by the moon
// We alter the intensity further based on current phase of the moon
auto const phasefactor = 1.0f - std::abs( m_phase - 29.53f * 0.5f ) / ( 29.53 * 0.5f );
return (float)( m_body.etr/ 1399.0 ) * phasefactor * 0.15f; // arbitrary scaling factor taken from etrn value
auto const phasefactor = 1.0f - std::abs( m_phase - 29.53f * 0.5f ) / ( 29.53f * 0.5f );
return static_cast<float>( ( m_body.etr/ 1399.0 ) * phasefactor * 0.15 ); // arbitrary scaling factor taken from etrn value
}
void cMoon::setLocation( float const Longitude, float const Latitude ) {