mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-19 09:59:18 +02:00
build 170821.
This commit is contained in:
6
color.h
6
color.h
@@ -76,9 +76,9 @@ HSVtoRGB( glm::vec3 const &HSV ) {
|
||||
hh /= 60.0;
|
||||
int const i = (int)hh;
|
||||
float const ff = hh - i;
|
||||
float const p = HSV.z * ( 1.0 - HSV.y );
|
||||
float const q = HSV.z * ( 1.0 - ( HSV.y * ff ) );
|
||||
float const t = HSV.z * ( 1.0 - ( HSV.y * ( 1.0 - ff ) ) );
|
||||
float const p = HSV.z * ( 1.f - HSV.y );
|
||||
float const q = HSV.z * ( 1.f - ( HSV.y * ff ) );
|
||||
float const t = HSV.z * ( 1.f - ( HSV.y * ( 1.f - ff ) ) );
|
||||
|
||||
switch( i ) {
|
||||
case 0:
|
||||
|
||||
29
moon.cpp
29
moon.cpp
@@ -37,8 +37,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;
|
||||
}
|
||||
@@ -46,17 +46,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
|
||||
Math3D::vector3 position = m_position;
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( position.x, position.y, position.z );
|
||||
glVertex3f( position.x, 0.0f, position.z );
|
||||
glEnd();
|
||||
glPushMatrix();
|
||||
glTranslatef( position.x, position.y, position.z );
|
||||
gluSphere( moonsphere, /* (float)( Global::iWindowHeight / 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
|
||||
@@ -78,8 +77,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 ) {
|
||||
|
||||
29
sun.cpp
29
sun.cpp
@@ -34,8 +34,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;
|
||||
}
|
||||
@@ -43,24 +43,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
|
||||
Math3D::vector3 position = m_position;
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( position.x, position.y, position.z );
|
||||
glVertex3f( position.x, 0.0f, position.z );
|
||||
glEnd();
|
||||
glPushMatrix();
|
||||
glTranslatef( position.x, position.y, 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
|
||||
|
||||
Reference in New Issue
Block a user