Browse Source

Update README, add requirements.txt for scripts and add rapidjson dependency

Phyks (Lucas Verney) 4 years ago
parent
commit
dac20d3a81

+ 3
- 0
.gitmodules View File

@@ -1,3 +1,6 @@
1 1
 [submodule "src/3rdparty/linmath"]
2 2
 	path = src/3rdparty/linmath
3 3
 	url = https://github.com/datenwolf/linmath.h.git
4
+[submodule "src/3rdparty/rapidjson"]
5
+	path = src/3rdparty/rapidjson
6
+	url = https://github.com/Phyks/rapidjson

+ 9
- 0
README.md View File

@@ -22,3 +22,12 @@ The build system is based on a set of CMake files. This builds all the available
22 22
     * `src/core` contains the core code, for the app itself.
23 23
     * `src/framework` contains useful classes and a basic framework for the app.
24 24
     * `src/platform` contains platform-specific code, such as wrappers.
25
+
26
+
27
+## TODO
28
+
29
+* Heightmap handling
30
+* Buffer initialization
31
+* Compute normals
32
+* Config
33
+* Assets loading

+ 16
- 0
scripts/README.md View File

@@ -0,0 +1,16 @@
1
+This folder contains various scripts used to generate heightmaps.
2
+
3
+## Dataset filtering scripts
4
+
5
+* `bd_alti.py` converts the data from BD ALTI from IGN to XYZ gridded ASCII, filtering out the points outside the target area.
6
+* `srtm_alti.py` does the same for the SRTM dataset.
7
+
8
+
9
+## Dataset conversion scripts
10
+
11
+* `xyz_to_heightmap.py` generates a heightmap (16 bits black and white PNG) from the exported XYZ file.
12
+
13
+
14
+## POIs fetcher scripts
15
+
16
+* `osm_filter.py` TODO

+ 1
- 0
scripts/requirements.txt View File

@@ -0,0 +1 @@
1
+pyproj>=1.9.4

+ 1
- 0
src/3rdparty/CMakeLists.txt View File

@@ -0,0 +1 @@
1
+add_subdirectory("rapidjson")

+ 1
- 0
src/3rdparty/rapidjson

@@ -0,0 +1 @@
1
+Subproject commit 7eb117a26ecbd36eb9fa1c83df7d4f58dd5365d6

+ 19
- 0
src/core/Config.h View File

@@ -0,0 +1,19 @@
1
+#ifndef SKIMAP_CORE_CONFIG_H_
2
+#define SKIMAP_CORE_CONFIG_H_
3
+// TODO[Lucas]
4
+
5
+// System includes
6
+#include <string>
7
+
8
+// 3rd party includes
9
+#include "rapidjson/document.h"
10
+
11
+class Config {
12
+    Config(char* filename);
13
+
14
+    std::string getStringOption(std::string option_name);
15
+
16
+    int getIntOption(std::string option_name);
17
+};
18
+
19
+#endif SKIMAP_CORE_CONFIG_H_

+ 12
- 12
src/core/SkiMapRenderer.cc View File

@@ -5,16 +5,16 @@
5 5
 #include <cmath>
6 6
 
7 7
 // Local headers
8
-#include "config.h"
8
+#include "constants.h"
9 9
 #include "platform_gl.h"
10 10
 
11 11
 
12 12
 SkiMapRenderer::SkiMapRenderer(int width, int height)
13 13
     : Renderer(width, height)
14
-    , terrain_(config::VERTEX_SHADER_FILENAME, config::VERTEX_SHADER_FILENAME)
14
+    , terrain_(constants::VERTEX_SHADER_FILENAME, constants::VERTEX_SHADER_FILENAME)
15 15
     , directional_light_()
16 16
 {
17
-    directional_light_ = config::DIRECTIONAL_LIGHT;
17
+    directional_light_ = constants::DIRECTIONAL_LIGHT;
18 18
 
19 19
     on_surface_created();
20 20
     on_surface_changed();
@@ -24,10 +24,10 @@ SkiMapRenderer::SkiMapRenderer(int width, int height)
24 24
 void SkiMapRenderer::on_surface_created(void) {
25 25
     // Set background color
26 26
     glClearColor(
27
-            config::CLEAR_COLOR[0],
28
-            config::CLEAR_COLOR[1],
29
-            config::CLEAR_COLOR[2],
30
-            config::CLEAR_COLOR[3]);
27
+            constants::CLEAR_COLOR[0],
28
+            constants::CLEAR_COLOR[1],
29
+            constants::CLEAR_COLOR[2],
30
+            constants::CLEAR_COLOR[3]);
31 31
 
32 32
     // Enable depth
33 33
     glEnable(GL_DEPTH_TEST);
@@ -41,16 +41,16 @@ void SkiMapRenderer::on_surface_changed(void) {
41 41
     glViewport(0, 0, width_, height_);
42 42
 
43 43
     // Set the projection matrix (perspective)
44
-    const float fov = config::FOV * 180 / M_PI;
44
+    const float fov = constants::FOV * 180 / M_PI;
45 45
     const float aspect = static_cast<float>(width_) / static_cast<float>(height_);
46
-    mat4x4_perspective(projection_matrix_, fov, aspect, config::NEAR, config::FAR);
46
+    mat4x4_perspective(projection_matrix_, fov, aspect, constants::NEAR, constants::FAR);
47 47
 
48 48
     // Set the camera position and orientation
49 49
     mat4x4_look_at(
50 50
             view_matrix_,
51
-            const_cast<float*>(config::DEFAULT_EYE),
52
-            const_cast<float*>(config::DEFAULT_CENTER),
53
-            const_cast<float*>(config::DEFAULT_UP));
51
+            const_cast<float*>(constants::DEFAULT_EYE),
52
+            const_cast<float*>(constants::DEFAULT_CENTER),
53
+            const_cast<float*>(constants::DEFAULT_UP));
54 54
 
55 55
     // Enable culling
56 56
     glEnable(GL_CULL_FACE);

+ 2
- 2
src/core/Terrain.cc View File

@@ -2,7 +2,7 @@
2 2
 #include "Terrain.h"
3 3
 
4 4
 // Local includes
5
-#include "config.h"
5
+#include "constants.h"
6 6
 #include "Buffer.h"
7 7
 
8 8
 
@@ -23,7 +23,7 @@ Terrain::Terrain(
23 23
         const std::string vertex_shader_filename,
24 24
         const std::string fragment_shader_filename)
25 25
     : program_(vertex_shader_filename, fragment_shader_filename)
26
-    , material_(config::TERRAIN_MATERIAL)
26
+    , material_(constants::TERRAIN_MATERIAL)
27 27
     , model_matrix_()
28 28
     , terrainData_()
29 29
     , buffer_id_(0)

src/core/config.h → src/core/constants.h View File

@@ -1,5 +1,5 @@
1
-#ifndef SKIMAP_CORE_CONFIG_H_
2
-#define SKIMAP_CORE_CONFIG_H_
1
+#ifndef SKIMAP_CORE_CONSTANTS_H_
2
+#define SKIMAP_CORE_CONSTANTS_H_
3 3
 
4 4
 // 3rd party includes
5 5
 #include <linmath/linmath.h>
@@ -8,7 +8,7 @@
8 8
 #include "Terrain.h"
9 9
 
10 10
 
11
-namespace config {
11
+namespace constants {
12 12
     static const char* VERTEX_SHADER_FILENAME = "";
13 13
     static const char* FRAGMENT_SHADER_FILENAME = "";
14 14
 
@@ -38,4 +38,4 @@ namespace config {
38 38
     };
39 39
 }
40 40
 
41
-#endif  // SKIMAP_CORE_CONFIG_H_
41
+#endif  // SKIMAP_CORE_CONSTANTS_H_

+ 1
- 1
src/platform/emscripten/CMakeLists.txt View File

@@ -13,4 +13,4 @@ add_executable (out.html
13 13
     ${SKIMAP_CORE_SRC}
14 14
     ${SKIMAP_PLATFORM_EMSCRIPTEN_SRC})
15 15
 
16
-target_include_directories (out.html PUBLIC "../../3rdparty" "../../framework" "../../core" ".")
16
+target_include_directories (out.html PUBLIC "../../3rdparty" "../../3rdparty/rapidjson/include" "../../framework" "../../core" ".")