16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 07:49:19 +02:00

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

28
sun.cpp
View File

@@ -41,8 +41,8 @@ cSun::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;
}
@@ -50,23 +50,17 @@ cSun::update() {
void
cSun::render() {
/*
glLightfv(GL_LIGHT0, GL_POSITION, position.getVector() ); // sun
GLfloat LightPosition[]= { 10.0f, 50.0f, -5.0f, 1.0f }; // ambient
glLightfv(GL_LIGHT1, GL_POSITION, LightPosition );
*/
glColor4f( 255.0f/255.0f, 242.0f/255.0f, 231.0f/255.0f, 1.f );
::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 );
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 );
::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 );
// radius is a result of scaling true distance down to 2km -- it's scaled by equal ratio
gluSphere( sunsphere, (float)(m_body.distance * 9.359157), 12, 12 );
glPopMatrix();
::gluSphere( sunsphere, m_body.distance * 9.359157, 12, 12 );
::glPopMatrix();
}
glm::vec3