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

render code relocation, mouse wheel zoom control

This commit is contained in:
tmj-fstate
2017-03-10 17:40:52 +01:00
parent b5ae395c42
commit 3708a01d26
20 changed files with 579 additions and 308 deletions

13
sun.cpp
View File

@@ -3,6 +3,7 @@
#include "sun.h"
#include "globals.h"
#include "mtable.h"
#include "usefull.h"
//////////////////////////////////////////////////////////////////////////////////////////
// cSun -- class responsible for dynamic calculation of position and intensity of the Sun,
@@ -94,6 +95,14 @@ void cSun::setLocation( float const Longitude, float const Latitude ) {
m_observer.latitude = (int)Latitude + (Latitude - (int)(Latitude)) * 100.0 / 60.0 ;
}
// sets current time, overriding one acquired from the system clock
void cSun::setTime( int const Hour, int const Minute, int const Second ) {
m_observer.hour = clamp( Hour, -1, 23 );
m_observer.minute = clamp( Minute, 0, 59 );
m_observer.second = clamp( Second, 0, 59 );
}
void cSun::setTemperature( float const Temperature ) {
m_observer.temp = Temperature;
@@ -112,6 +121,10 @@ void cSun::move() {
SYSTEMTIME localtime; // time for the calculation
time( &localtime );
if( m_observer.hour >= 0 ) { localtime.wHour = m_observer.hour; }
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
+ localtime.wSecond / 3600.0; // good enough in normal circumstances