GlobeEngine
HikingEngine.h
Go to the documentation of this file.
1 //
2 // HikingEngine.h
3 // HikingEngine
4 //
5 // Created by Marco Bonzanigo on 27.12.11.
6 // Modified by Mathias Thöny
7 // Copyright (c) 2011 University of Zurich. All rights reserved.
8 #ifndef HikingEngine_h
9 #define HikingEngine_h
10 
11 #include <math.h>
12 #include <ctime>
13 #include <iostream>
14 #include <stdio.h>
15 #include <vector>
16 #include "OpenGL_Includes.h"
17 #include "Engine.h"
18 #include "Shader.h"
19 #include "FlightCamera.h"
20 #include "OrthographicMapCamera.h"
21 #include "Common.h"
22 #include "CoordinateSystem.h"
24 #include "SceneStateSet.h"
25 #include "Cone.h"
26 #include "DebugMap.h"
27 #include "DrawableComponent.h"
28 #include "SceneLoader.h"
30 #include "HikingComposition.h"
31 #include "HikingInfoWindow.h"
32 #include "HikingTerrainModule.h"
33 #include "HikingPath.h"
34 #include "DebugLogger.h"
35 #include "Timer.h"
36 
37 namespace geHikingViewer {
38 
40  {
43  };
44 
45  class HikingEngine : public ge::Engine
46  {
47 
48  public:
49  HikingEngine();
50  ~HikingEngine();
51 
52  void clear();
53  void destroy();
54  void create(std::string _pathFile);
55 
56  void initializeScene(std::string _pathFile = 0);
57  void drawScene();
58  void resize(int _w, int _h);
59  void update();
60 
61  void focusCamera();
62  void switchCameraToTop();
63  vmml::Vector3d calculateSight(bool glCoords);
64 
66 
67  // Terrain modifications
68  void switchTerrainShader();
69  void switchDanger();
70  bool isDangerEnabled();
71  void enableNorthSouth(bool e);
72  float getHeightScale();
73 
74  bool getDangerEnabled();
75  float getDangerHeight();
76  void setDangerOrientation(float o);
77  void setDangerSection(float s);
78  void increaseDangerHeight(float _value);
79 
80  int getRiskLevel();
81  void setRiskLevel(int level);
82  void disableDanger(bool disable);
83 
84  // placing modifications
85  void enablePlacing();
86  void disablePlacing();
87  bool isPlacingEnabled();
88 
89  // path handling new
90  void addNewCone(vmml::Vector3f _pos, vmml::Vector3d _color); //bool adjustPlacer,
91  bool addLineSegment(vmml::Vector2f _screenPos);
92  void setAdding(bool _in);
93  void setRemoving(bool _in);
94  void setShifting(bool _in);
95 
96  void selectPixel(int x, int y);
97  void pickFromFramebuffer();
98  void selectObject(int x, int y);
99  void unselectObject();
100 
101  void printFPS();
102 
103  //Controls
104  void compassUpdate(vmml::Vector2f _degrees);
105 
106  const std::shared_ptr<HikingPath> getHikingTrailInfo();
107  void updateHikingTrail();
108 
109  private:
110  using ge::Engine::create; // implicitly hidden
111 
112  float height;
113  float width;
114 
115  std::shared_ptr<SceneLoader> pLoader;
116  std::string shaderpath;
117  std::string pathfile;
118 
119  HikingComposition objectComposition;
120 
121  std::shared_ptr<ge::Shader> programForUtilities;
122  std::shared_ptr<ge::Shader> programForLines;
123  std::shared_ptr<ge::Shader> programForCones;
124  std::shared_ptr<ge::Shader> programForPlanes;
125  std::shared_ptr<ge::Shader> programForDebug;
126  std::shared_ptr<ge::Shader> programForHeight;
127 
128  std::vector< std::shared_ptr<ge::Cone> > cones;
129  std::shared_ptr<HikingPath> hikingtrail;
130 
131  HikingFrameBufferObject gbuffer;
132 
133  //danger
134  float localDangerOrientation;
135  float localDangerSection;
136  float localPreviousDangerSection;
137 
138  // CoordinateCross
139  ge::CoordinateSystem coordinateSystem;
140  ge::SceneStateSet sceneStates[1];
141 
142  // Elevation Data
143  float heightScale;
144  std::shared_ptr<HikingTerrainModule> terrainmodule;
145 
146  geUtil::DebugLogger openglDebugLogger;
147  geUtil::DebugMap debugmap;
148 
149  // states
150  bool placing;
151  bool removing;
152  bool adding;
153  bool shifting;
154 
155  // Picking result
156  HikingPickResult toPick;
157  HikingPickResult previous;
158  int selectedID;
159 
160  // fps printing
161  bool showFPS;
162  ge::Timer openglTimer;
163  };
164 }
165 #endif
int getRiskLevel()
Definition: HikingEngine.cpp:709
void drawScene()
Definition: HikingEngine.cpp:212
void resize(int _w, int _h)
Definition: HikingEngine.cpp:355
void setDangerOrientation(float o)
Definition: HikingEngine.cpp:697
void focusCamera()
Definition: HikingEngine.cpp:539
void setDangerSection(float s)
Definition: HikingEngine.cpp:615
void disablePlacing()
Definition: HikingEngine.cpp:519
Definition: HikingComposition.h:14
vmml::Vector3d calculateSight(bool glCoords)
Definition: HikingEngine.cpp:361
void update()
Definition: HikingEngine.cpp:189
bool isPlacingEnabled()
Definition: HikingEngine.cpp:535
void selectObject(int x, int y)
Definition: HikingEngine.cpp:569
void increaseDangerHeight(float _value)
Definition: HikingEngine.cpp:627
void clear()
Definition: HikingEngine.cpp:16
void switchDanger()
Definition: HikingEngine.cpp:504
Definition: DebugMap.h:18
void compassUpdate(vmml::Vector2f _degrees)
Definition: HikingEngine.cpp:553
const std::shared_ptr< HikingPath > getHikingTrailInfo()
Definition: HikingEngine.cpp:733
Definition: DebugLogger.h:22
void addNewCone(vmml::Vector3f _pos, vmml::Vector3d _color)
Definition: HikingEngine.cpp:175
void updateHikingTrail()
Definition: HikingEngine.cpp:334
bool getDangerEnabled()
Definition: HikingEngine.cpp:701
void printFPS()
Definition: HikingEngine.cpp:725
Definition: HikingComposition.h:16
virtual void create()
Definition: Engine.cpp:61
void switchCameraToTop()
Definition: HikingEngine.cpp:523
Definition: HikingEngine.h:45
void destroy()
Definition: HikingEngine.cpp:38
void setRiskLevel(int level)
Definition: HikingEngine.cpp:705
void setRemoving(bool _in)
Definition: HikingEngine.cpp:713
void switchTerrainShader()
Definition: HikingEngine.cpp:729
Definition: Engine.h:20
void unselectObject()
Definition: HikingEngine.cpp:596
float getHeightScale()
Definition: HikingEngine.cpp:737
Definition: HikingEngine.h:39
void disableDanger(bool disable)
Definition: HikingEngine.cpp:603
void selectPixel(int x, int y)
Definition: HikingEngine.cpp:558
void initializeScene(std::string _pathFile=0)
Definition: HikingEngine.cpp:49
void enableNorthSouth(bool e)
Definition: HikingEngine.cpp:689
int pickResultID
Definition: HikingEngine.h:42
void setAdding(bool _in)
Definition: HikingEngine.cpp:717
void setShifting(bool _in)
Definition: HikingEngine.cpp:721
void pickFromFramebuffer()
Definition: HikingEngine.cpp:268
Definition: SceneStateSet.h:41
Definition: HikingFrameBufferObject.h:12
void updateFramebufferStandardID()
Definition: HikingEngine.cpp:346
bool addLineSegment(vmml::Vector2f _screenPos)
Definition: HikingEngine.cpp:438
HikingEngine()
Definition: HikingEngine.cpp:5
bool isDangerEnabled()
Definition: HikingEngine.cpp:509
void enablePlacing()
Definition: HikingEngine.cpp:513
~HikingEngine()
Definition: HikingEngine.cpp:11
int pickCoordinates[2]
Definition: HikingEngine.h:41
Definition: Timer.h:17
Definition: CoordinateSystem.h:17
float getDangerHeight()
Definition: HikingEngine.cpp:685