diff --git a/moon.cpp b/moon.cpp index 9722140f..4bf7e8c5 100644 --- a/moon.cpp +++ b/moon.cpp @@ -118,10 +118,11 @@ void cMoon::move() { if( m_observer.second >= 0 ) { localtime.wSecond = m_observer.second; } double ut = localtime.wHour - + localtime.wMinute / 60.0 // too low resolution, noticeable skips - + localtime.wSecond / 3600.0; // good enough in normal circumstances + + localtime.wMinute / 60.0; // too low resolution, noticeable skips + // NOTE: finer resolution disabled to reduce shadow crawl in current implementation /* - + localtime.wMilliseconds / 3600000.0; // for really smooth movement + + localtime.wSecond / 3600.0 // good enough in normal circumstances + + localtime.wMilliseconds / 3600000.0; // for really smooth movement */ double daynumber = 367 * localtime.wYear - 7 * ( localtime.wYear + ( localtime.wMonth + 9 ) / 12 ) / 4 diff --git a/sun.cpp b/sun.cpp index 5fdbabeb..0dc2f98b 100644 --- a/sun.cpp +++ b/sun.cpp @@ -50,7 +50,7 @@ void cSun::update() { move(); - glm::vec3 position( 0.f, 0.f, -2000.f * Global.fDistanceFactor ); + glm::vec3 position( 0.f, 0.f, -1.f ); position = glm::rotateX( position, glm::radians( static_cast( m_body.elevref ) ) ); position = glm::rotateY( position, glm::radians( static_cast( -m_body.hrang ) ) ); @@ -72,11 +72,17 @@ cSun::render() { ::gluSphere( sunsphere, m_body.distance * 9.359157, 12, 12 ); ::glPopMatrix(); } - +/* +glm::vec3 +cSun::getPosition() { + + return m_position * 1000.f * Global.fDistanceFactor; +} +*/ glm::vec3 cSun::getDirection() { - return glm::normalize( m_position ); + return m_position; } float @@ -84,7 +90,14 @@ cSun::getAngle() { return (float)m_body.elevref; } - + +// return current hour angle +double +cSun::getHourAngle() const { + + return m_body.hrang; +} + float cSun::getIntensity() { irradiance(); @@ -128,10 +141,11 @@ void cSun::move() { if( m_observer.second >= 0 ) { localtime.wSecond = m_observer.second; } double ut = localtime.wHour - + localtime.wMinute / 60.0 // too low resolution, noticeable skips - + localtime.wSecond / 3600.0; // good enough in normal circumstances + + localtime.wMinute / 60.0; // too low resolution, noticeable skips + // NOTE: finer resolution disabled to reduce shadow crawl in current implementation /* - + localtime.wMilliseconds / 3600000.0; // for really smooth movement + + localtime.wSecond / 3600.0 // good enough in normal circumstances + + localtime.wMilliseconds / 3600000.0; // for really smooth movement */ double daynumber = 367 * localtime.wYear - 7 * ( localtime.wYear + ( localtime.wMonth + 9 ) / 12 ) / 4 diff --git a/sun.h b/sun.h index 4ab54d10..babc14af 100644 --- a/sun.h +++ b/sun.h @@ -18,13 +18,17 @@ public: void init(); void update(); void render(); +/* // returns location of the sun in the 3d scene - glm::vec3 getPosition() { return m_position; } + glm::vec3 getPosition(); +*/ // returns vector pointing at the sun glm::vec3 getDirection(); // returns current elevation above horizon float getAngle(); - // returns current intensity of the sun + // return current hour angle + double getHourAngle() const; + // returns current intensity of the sun float getIntensity(); // sets current time, overriding one acquired from the system clock void setTime( int const Hour, int const Minute, int const Second ); diff --git a/version.h b/version.h index e50d1e4f..3fa33005 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #pragma once #define VERSION_MAJOR 18 -#define VERSION_MINOR 202 +#define VERSION_MINOR 210 #define VERSION_REVISION 0