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

simulation time object

This commit is contained in:
tmj-fstate
2017-03-29 00:50:53 +02:00
parent 9dda5037d3
commit 848db5878b
16 changed files with 379 additions and 331 deletions

61
World.h
View File

@@ -21,6 +21,43 @@ http://mozilla.org/MPL/2.0/.
#include "mczapkie/mover.h"
#include "renderer.h"
// wrapper for simulation time
class simulation_time {
public:
simulation_time() { m_time.wHour = -1; m_time.wMinute = -1; }
void
init();
void
update( double const Deltatime );
SYSTEMTIME &
data() { return m_time; }
SYSTEMTIME const &
data() const { return m_time; }
double
second() const { return ( m_time.wMilliseconds * 0.001 + m_time.wSecond ); }
int
year_day() const { return m_yearday; }
private:
// calculates day of year from given date
int
yearday( int Day, int const Month, int const Year );
// calculates day and month from given day of year
void
daymonth( WORD &Day, WORD &Month, WORD const Year, WORD const Yearday );
SYSTEMTIME m_time;
int m_yearday;
char m_monthdaycounts[ 2 ][ 13 ];
};
namespace Simulation {
extern simulation_time Time;
}
// wrapper for environment elements -- sky, sun, stars, clouds etc
class world_environment {
@@ -47,11 +84,19 @@ class TWorld
void FollowView(bool wycisz = true);
void DistantView( bool const Near = false );
public:
public:
// types
// constructors
TWorld();
// destructor
~TWorld();
// methods
bool Init( GLFWwindow *w );
bool InitPerformed() { return m_init; }
GLFWwindow *window;
GLvoid glPrint(std::string const &Text);
void OnKeyDown(int cKey);
void OnKeyUp(int cKey);
// void UpdateWindow();
@@ -61,19 +106,14 @@ class TWorld
void TrainDelete(TDynamicObject *d = NULL);
// switches between static and dynamic daylight calculation
void ToggleDaylight();
TWorld();
~TWorld();
// double Aspect;
private:
std::string OutText1; // teksty na ekranie
std::string OutText2;
std::string OutText3;
std::string OutText4;
private:
void Update_Environment();
void Update_Camera( const double Deltatime );
void Update_UI();
void ResourceSweep();
void Render_Cab();
TCamera Camera;
TGround Ground;
world_environment Environment;
@@ -94,6 +134,7 @@ class TWorld
int tprev; // poprzedni czas
double Acc; // przyspieszenie styczne
bool m_init{ false }; // indicates whether initial update of the world was performed
public:
void ModifyTGA(std::string const &dir = "");
void CreateE3D(std::string const &dir = "", bool dyn = false);