cmake + tile loading
This commit is contained in:
@@ -11,7 +11,7 @@ class tile;
|
||||
|
||||
class map {
|
||||
public:
|
||||
map(class platform *platform);
|
||||
map();
|
||||
~map();
|
||||
|
||||
void setup();
|
||||
@@ -26,10 +26,15 @@ public:
|
||||
void tileFailed(tile *tile);
|
||||
|
||||
private:
|
||||
platform *platform;
|
||||
void updateTiles();
|
||||
|
||||
private:
|
||||
transform *transform;
|
||||
painter *painter;
|
||||
|
||||
// int32_t min_zoom;
|
||||
// int32_t max_zoom;
|
||||
|
||||
std::vector<tile *> tiles;
|
||||
};
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <llmr/util/vec2.hpp>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
@@ -18,9 +19,15 @@ public:
|
||||
void parseFeature(const uint8_t *data, uint32_t bytes);
|
||||
void loadGeometry(const uint8_t *data, uint32_t bytes);
|
||||
|
||||
void cancel();
|
||||
|
||||
static uint64_t toID(int32_t z, int32_t x, int32_t y, int32_t w = 0);
|
||||
static vec4<int32_t> fromID(uint64_t id);
|
||||
|
||||
public:
|
||||
const int32_t z, x, y;
|
||||
bool loaded;
|
||||
bool cancelled;
|
||||
linevertexbuffer lineVertex;
|
||||
|
||||
private:
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace llmr {
|
||||
|
||||
struct box;
|
||||
|
||||
class tile;
|
||||
|
||||
class transform {
|
||||
@@ -24,8 +27,13 @@ public:
|
||||
|
||||
// Getters
|
||||
void matrixFor(float matrix[16], uint32_t z, uint32_t x, uint32_t y) const;
|
||||
int32_t getZoom() const;
|
||||
void getLonLat(double& lon, double& lat) const;
|
||||
|
||||
|
||||
// Temporary
|
||||
void mapCornersToBox(uint32_t z, box& b) const;
|
||||
|
||||
private:
|
||||
double pixel_x() const;
|
||||
double pixel_y() const;
|
||||
@@ -40,6 +48,8 @@ private:
|
||||
double angle;
|
||||
double scale;
|
||||
|
||||
double min_scale, max_scale;
|
||||
|
||||
// tile size
|
||||
const int32_t size = 512;
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#elif TARGET_OS_MAC
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#error Unsupported Apple platform
|
||||
#endif
|
||||
|
||||
@@ -5,18 +5,13 @@ namespace llmr {
|
||||
|
||||
class tile;
|
||||
|
||||
class platform {
|
||||
public:
|
||||
platform(void *obj) : obj(obj) {}
|
||||
void restart();
|
||||
void request(tile *tile);
|
||||
namespace platform {
|
||||
|
||||
private:
|
||||
void *obj;
|
||||
};
|
||||
void restart(void *obj);
|
||||
void request(void *obj, tile *tile);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,13 +6,12 @@
|
||||
|
||||
namespace llmr {
|
||||
|
||||
class platform;
|
||||
class transform;
|
||||
class tile;
|
||||
|
||||
class painter {
|
||||
public:
|
||||
painter(class platform *platform, class transform *tranform);
|
||||
painter(class transform *tranform);
|
||||
|
||||
void setup();
|
||||
void teardown();
|
||||
@@ -31,7 +30,6 @@ private:
|
||||
public:
|
||||
|
||||
private:
|
||||
platform *platform;
|
||||
transform *transform;
|
||||
float matrix[16];
|
||||
|
||||
@@ -39,7 +37,7 @@ private:
|
||||
FillShader *fillShader;
|
||||
LineShader *lineShader;
|
||||
|
||||
uint32_t vertexArray;
|
||||
// uint32_t vertexArray;
|
||||
uint32_t triangleVertexBuffer;
|
||||
uint32_t fillVertexBuffer;
|
||||
};
|
||||
|
||||
40
include/llmr/util/vec2.hpp
Normal file
40
include/llmr/util/vec2.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef llmr_util_vec2_
|
||||
#define llmr_util_vec2_
|
||||
|
||||
namespace llmr {
|
||||
|
||||
template <typename T = double>
|
||||
struct vec2 {
|
||||
T x, y;
|
||||
|
||||
// inline bool operator==(const vec2& rhs) const {
|
||||
// return x == rhs.x && y == rhs.y;
|
||||
// }
|
||||
};
|
||||
|
||||
template <typename T = double>
|
||||
struct vec3 {
|
||||
T x, y, z;
|
||||
|
||||
// inline bool operator==(const vec3& rhs) const {
|
||||
// return x == rhs.x && y == rhs.y && z == rhs.z;
|
||||
// }
|
||||
};
|
||||
|
||||
template <typename T = double>
|
||||
struct vec4 {
|
||||
T x, y, z, w;
|
||||
|
||||
// inline bool operator==(const vec4& rhs) const {
|
||||
// return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w;
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
struct box {
|
||||
vec2<double> tl, tr, bl, br;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user