GlobeEngine
ClimateViewerEngine.h
Go to the documentation of this file.
1 
9 #ifndef GlobeEngine_ClimateViewerEngine_h
10 #define GlobeEngine_ClimateViewerEngine_h
11 
12 #include <math.h>
13 #include <ctime>
14 #include <iostream>
15 #include <stdio.h>
16 #include <vector>
17 #include "OpenGL_Includes.h"
18 #include "Engine.h"
19 #include "Shader.h"
20 #include "FlightCamera.h"
21 #include "Common.h"
22 #include "CoordinateSystem.h"
23 #include "SceneStateSet.h"
24 #include "DrawableComponent.h"
25 #include "Cube.h"
26 #include "Sphere.h"
27 #include "DebugLogger.h"
28 #include "Timer.h"
29 #include "MemoryState.h"
30 #include "DebugMap.h"
32 #include "Plane.h"
33 #include "ArrowField.h"
34 #include "Streamlines.h"
36 #include "Jzon.h"
37 #include "WeatherData.h"
38 
39 namespace geClimateViewer {
41  int seeds;
43  float dt;
44  float minDistance;
46  };
47 
48  struct UISettings{
51  float dt;
52  float minDistance;
53  bool showvector;
55  bool drawRandom;
56  bool drawTopo;
57  int lineSteps;
58  int activePoint=-1;
59  int activeRegion=0;
61  bool showperp=true;
62  int x=0;
63  int y=0;
64  int sizeX=0;
65  int sizeY=0;
66  int sizeZ=1;
67  float arrowsLength;
68  float topologyDt;
70  float simpEpsilon;
71  int colormap;
72  float sphereSize;
73  float bgr,bgg,bgb;
74  int currTimestep=0;
76  };
77 
78  class ClimateViewerUI;
79 
81  {
82  public:
83  ClimateViewerEngine(std::string _sceneFilePath);
85 
86  void clear();
87  void destroy();
88  void create();
89 
90  // overrides from ge::Engine
91  void initializeScene(std::string _projectsrcPath=0);
92  void drawScene();
93  void resize(int _w, int _h);
94  void update();
95 
96  void createArrowsFromClimateData(std::shared_ptr<VectorField> _data);
97 
99  void createStreamlines();
101  void loadData();
102  void calculateTopology();
103  void calculatePerpLines();
104 
106 
107  void updateUiSettings(UISettings _newSettings);
108  void highlightStreamline();
109 
110  void saveCurrentStateToSHP(std::string _path);
111  void saveStreamlinesToSHP(std::string _path);
112  void saveTopologyToSHP(std::string _path);
113  void setUi(ClimateViewerUI *_ui);//{ui=_ui;};
114  void play();
115  void progress(int _p);
116  void direct(std::string _path);
117 
118  private:
119  std::shared_ptr<ge::Shader> programForUtilities;
120  std::shared_ptr<ge::Shader> programForArrows;
121  std::shared_ptr<ge::Shader> programForStreamlines;
122  std::shared_ptr<ge::Shader> programForStreamlinesRandom;
123  std::shared_ptr<ge::Shader> programForSpheres;
124  std::shared_ptr<ge::Shader> programForDebug;
125  std::shared_ptr<ge::Shader> programForCube;
126  std::shared_ptr<ge::Shader> programForPlanes;
127  std::shared_ptr<ge::Shader> programForMultiline;
128  ge::SceneStateSet sceneStates[1];
129 
130  //std::shared_ptr<ge::Cube> cube;
131  ge::CoordinateSystem coordinateSystem;
132 
133  std::shared_ptr<ge::Plane> plane;
134  std::shared_ptr<ge::Sphere> sphere;
135  std::shared_ptr<ge::Texture2Drgba> spheretex;
136  std::shared_ptr<ge::Cube> testCube;
137  std::vector<std::shared_ptr<geFlow::ArrowField>> arrowFields;
138  std::shared_ptr<geFlow::ArrowField> arrowFieldDeriv;
139  std::vector<std::shared_ptr<Streamlines>> streamlinesRandom;
140 
141  float rot;
142 
143  // Debugger functionality
144  geUtil::DebugLogger openglDebugLogger;
145  ge::Timer openglTimer;
146  geUtil::MemoryState openglMemory;
147  geUtil::DebugMap debugmaps[2];
148 
149  ClimateViewerComposition uiComposition;
150 
151  ge::FrameBufferObject climateGBuffer;
152 
153  int screenWidth;
154  int screenHeight;
155 
156  // path to xml command line argument
157  std::string sceneFilePath;
158 
159  std::vector<std::shared_ptr<VectorField> > climateData;
160  std::vector<std::shared_ptr< ge::Sphere> > criticalPointsSpheres;
161  std::vector<vmml::Vector3f> seedPoints;
162  PolyLineExt highlight;
163  // std::vector<std::shared_ptr<ClimateData>> data;
164  std::shared_ptr<geFlow::WeatherData> data;
165  vmml::Vector3f pos;
166  std::string shaderpath;
167 
168  // ge::Timer openglTimer;
169  ClimateViewerUI *ui;
170  float progressed;
171 
172  };
173 }
174 #endif
void loadData()
Definition: ClimateViewerEngine.cpp:437
int seedsNumber
Definition: ClimateViewerEngine.h:50
bool drawTopo
Definition: ClimateViewerEngine.h:56
float arrowsLength
Definition: ClimateViewerEngine.h:67
void play()
Definition: ClimateViewerEngine.cpp:502
int sizeX
Definition: ClimateViewerEngine.h:64
float sphereSize
Definition: ClimateViewerEngine.h:72
Definition: MemoryState.h:16
void createArrowsFromClimateData(std::shared_ptr< VectorField > _data)
Definition: ClimateViewerEngine.cpp:473
float topologyDt
Definition: ClimateViewerEngine.h:68
int y
Definition: ClimateViewerEngine.h:63
UISettings uiSettings
Definition: ClimateViewerEngine.h:105
int activePoint
Definition: ClimateViewerEngine.h:58
void updateFramebufferStandardID()
Definition: ClimateViewerEngine.cpp:190
int colormap
Definition: ClimateViewerEngine.h:71
Definition: DebugMap.h:18
Definition: DebugLogger.h:22
Definition: PolyLineExt.h:18
void clear()
Definition: ClimateViewerEngine.cpp:17
Definition: FrameBufferObject.h:20
void create()
Definition: ClimateViewerEngine.cpp:36
float minDistance
Definition: ClimateViewerEngine.h:52
int lineLength
Definition: ClimateViewerEngine.h:42
float bgr
Definition: ClimateViewerEngine.h:73
void createStreamlinesRandom()
Definition: ClimateViewerEngine.cpp:316
int timeStepFrom
Definition: ClimateViewerEngine.h:75
void saveCurrentStateToSHP(std::string _path)
Definition: ClimateViewerEngine.cpp:367
float dt
Definition: ClimateViewerEngine.h:51
Definition: ClimateViewerUI.h:22
void drawScene()
Definition: ClimateViewerEngine.cpp:145
bool checkMinDistance
Definition: ClimateViewerEngine.h:54
float bgb
Definition: ClimateViewerEngine.h:73
void setUi(ClimateViewerUI *_ui)
Definition: ClimateViewerEngine.cpp:498
void updateUiSettings(UISettings _newSettings)
Definition: ClimateViewerEngine.cpp:232
bool drawRandom
Definition: ClimateViewerEngine.h:55
bool showvector
Definition: ClimateViewerEngine.h:53
Definition: Engine.h:20
int currTimestep
Definition: ClimateViewerEngine.h:74
Definition: ClimateViewerEngine.h:48
int sizeY
Definition: ClimateViewerEngine.h:65
Definition: ClimateViewerComposition.h:15
void resize(int _w, int _h)
Definition: ClimateViewerEngine.cpp:177
Definition: ClimateViewerEngine.h:40
void direct(std::string _path)
Definition: ClimateViewerEngine.cpp:531
int sizeZ
Definition: ClimateViewerEngine.h:66
void saveStreamlinesToSHP(std::string _path)
Definition: ClimateViewerEngine.cpp:512
void initializeScene(std::string _projectsrcPath=0)
Definition: ClimateViewerEngine.cpp:41
void calculateTopology()
Definition: ClimateViewerEngine.cpp:373
bool checkMinDistance
Definition: ClimateViewerEngine.h:45
Definition: ClimateViewerEngine.h:80
void update()
Definition: ClimateViewerEngine.cpp:134
int timeStepTo
Definition: ClimateViewerEngine.h:75
int x
Definition: ClimateViewerEngine.h:62
void createStreamlines()
Definition: ClimateViewerEngine.cpp:200
bool showperp
Definition: ClimateViewerEngine.h:61
int lineLength
Definition: ClimateViewerEngine.h:49
void progress(int _p)
Definition: ClimateViewerEngine.cpp:524
Definition: SceneStateSet.h:41
Definition: ClimateViewerComposition.h:13
float simpEpsilon
Definition: ClimateViewerEngine.h:70
~ClimateViewerEngine()
Definition: ClimateViewerEngine.cpp:13
float dt
Definition: ClimateViewerEngine.h:43
int activeRegion
Definition: ClimateViewerEngine.h:59
int seeds
Definition: ClimateViewerEngine.h:41
void highlightStreamline()
Definition: ClimateViewerEngine.cpp:278
int lineSteps
Definition: ClimateViewerEngine.h:57
void calculatePerpLines()
Definition: ClimateViewerEngine.cpp:407
void saveTopologyToSHP(std::string _path)
Definition: ClimateViewerEngine.cpp:518
float bgg
Definition: ClimateViewerEngine.h:73
ClimateViewerEngine(std::string _sceneFilePath)
Definition: ClimateViewerEngine.cpp:7
Definition: Timer.h:17
void destroy()
Definition: ClimateViewerEngine.cpp:31
Definition: CoordinateSystem.h:17
float topologyPerpDt
Definition: ClimateViewerEngine.h:69
int activeStreamline
Definition: ClimateViewerEngine.h:60
float minDistance
Definition: ClimateViewerEngine.h:44