GlobeEngine
TerrainExampleTerrainModule.h
Go to the documentation of this file.
1 
11 #ifndef GlobeEngine_TerrainExampleTerrainModule_h
12 #define GlobeEngine_TerrainExampleTerrainModule_h
13 
14 #include "OpenGL_Includes.h"
15 #include "TerrainModule.h"
16 #include "TerrainMessageQueue.h"
17 #include "DirectionalLight.h"
18 
19 namespace geTerrainExample {
20 
22  {
23  public:
26  void clear() override;
27  void create();
28  void update(std::shared_ptr<ge::Camera> _cam);
29  void updateQuadtree(std::shared_ptr<ge::Camera> _cam);
30 
31  void draw(std::shared_ptr<ge::Camera> _cam);
32  void loadTerrainService(std::string _shaderPath, std::string _terrainUrl, std::string _texUrl, int _midLoD, int _maxLoD);
33 
34  void loadTriangulationService(std::string _shaderPath, geRaster::TerrainTriangulationInfo _triangulationInfo);
35 
36  void createDebugPlane(std::string _shaderPath);
37  void drawDebugPlanes(std::shared_ptr<ge::Camera> _cam, bool _colored, std::shared_ptr<ge::Camera> _debugcam);
38 
39  private:
40  void updateGeometryForPosition(std::shared_ptr<ge::Camera> _cam);
41 
45  void loadElevationTile(int _tmsid, const std::shared_ptr<geSpatial::Tile> _tile);
46  void loadTextureTile(int _tmsid, const std::shared_ptr<geSpatial::Tile> _tile);
47 
48  std::shared_ptr<ge::Texture2Df> loadElevationTilePhase1(int, geSpatial::Tile const&);
49  void loadElevationTilePhase2(geSpatial::Tile const&, std::shared_ptr<ge::Texture2Df>);
50  std::shared_ptr<ge::Texture2Drgba> loadOrthoTilePhase1(int, geSpatial::Tile const&);
51  void loadOrthoTilePhase2(geSpatial::Tile const&, std::shared_ptr<ge::Texture2Drgba>);
52 
53 
54  void setupTileService(int _cacheSize);
55  void requestInitialTMSTiles(int _tmsid);
56  void getTilesFromTileService(int _tmsid);
57 
58  //void requestAsyncInitialTMSTiles(int _tmsid);
59  //void getAsyncTilesFromTileService(int _tmsid);
60 
61  private:
62  std::shared_ptr<geRaster::TerrainMessageQueue> tileServiceProvider;
63  std::shared_ptr<ge::Shader> programForTerrain;
64 
65  ge::Timer openglTimer;
66  std::shared_ptr<ge::Shader> programForDebugPlanes;
67  std::shared_ptr<ge::Plane> debugPlane;
68 
69  ge::DirectionalLight directionalLight;
70 
71  std::vector< std::shared_ptr<ge::Texture2Df> > heightIntermediate;
72  std::vector< std::shared_ptr<ge::Texture2Drgba> > colorIntermediate;
73  };
74 }
75 #endif
void clear() override
Definition: TerrainExampleTerrainModule.cpp:23
Definition: TerrainExampleTerrainModule.h:21
void draw(std::shared_ptr< ge::Camera > _cam)
Definition: TerrainExampleTerrainModule.cpp:188
Definition: TerrainConfigStructs.h:47
Definition: TerrainModule.h:24
Definition: DirectionalLight.h:17
Definition: Tile.h:35
void drawDebugPlanes(std::shared_ptr< ge::Camera > _cam, bool _colored, std::shared_ptr< ge::Camera > _debugcam)
Definition: TerrainExampleTerrainModule.cpp:202
Definition: TerrainExampleComposition.h:13
void loadTerrainService(std::string _shaderPath, std::string _terrainUrl, std::string _texUrl, int _midLoD, int _maxLoD)
Definition: TerrainExampleTerrainModule.cpp:46
~TerrainExampleTerrainModule()
Definition: TerrainExampleTerrainModule.cpp:18
void updateQuadtree(std::shared_ptr< ge::Camera > _cam)
Definition: TerrainExampleTerrainModule.cpp:111
void createDebugPlane(std::string _shaderPath)
Definition: TerrainExampleTerrainModule.cpp:429
TerrainExampleTerrainModule()
Definition: TerrainExampleTerrainModule.cpp:13
void update(std::shared_ptr< ge::Camera > _cam)
Definition: TerrainExampleTerrainModule.cpp:131
void loadTriangulationService(std::string _shaderPath, geRaster::TerrainTriangulationInfo _triangulationInfo)
Definition: TerrainExampleTerrainModule.cpp:77
Definition: Timer.h:17
void create()
Definition: TerrainExampleTerrainModule.cpp:28