fix runtime errors
This commit is contained in:
@@ -8,6 +8,7 @@ namespace llmr {
|
||||
class linevertexbuffer {
|
||||
public:
|
||||
linevertexbuffer();
|
||||
~linevertexbuffer();
|
||||
|
||||
void addDegenerate();
|
||||
void addCoordinate(int16_t x, int16_t y);
|
||||
|
||||
@@ -22,8 +22,8 @@ public:
|
||||
void moveBy(double dx, double dy);
|
||||
void scaleBy(double ds, double cx, double cy);
|
||||
void rotateBy(double cx, double cy, double sx, double sy, double ex, double ey);
|
||||
void tileLoaded(tile *tile);
|
||||
void tileFailed(tile *tile);
|
||||
void tileLoaded(std::shared_ptr<tile> tile);
|
||||
void tileFailed(std::shared_ptr<tile> tile);
|
||||
|
||||
private:
|
||||
void updateTiles();
|
||||
@@ -35,7 +35,7 @@ private:
|
||||
// int32_t min_zoom;
|
||||
// int32_t max_zoom;
|
||||
|
||||
std::vector<tile *> tiles;
|
||||
std::vector<std::shared_ptr<tile>> tiles;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -5,13 +5,18 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <llmr/util/vec2.hpp>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
class tile {
|
||||
public:
|
||||
typedef std::shared_ptr<tile> ptr;
|
||||
|
||||
public:
|
||||
tile(int32_t z, int32_t x, int32_t y);
|
||||
~tile();
|
||||
|
||||
void setData(uint8_t *data, uint32_t bytes);
|
||||
bool parse();
|
||||
@@ -21,8 +26,8 @@ public:
|
||||
|
||||
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);
|
||||
// static int64_t toID(int32_t z, int32_t x, int32_t y, int32_t w = 0);
|
||||
// static vec4<int32_t> fromID(int64_t id);
|
||||
|
||||
public:
|
||||
const int32_t z, x, y;
|
||||
@@ -31,6 +36,8 @@ public:
|
||||
linevertexbuffer lineVertex;
|
||||
|
||||
private:
|
||||
std::mutex mutex;
|
||||
|
||||
// Source data
|
||||
uint8_t *data;
|
||||
uint32_t bytes;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef LLMR_PLATFORM_IOS
|
||||
#define LLMR_PLATFORM_IOS
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
class tile;
|
||||
@@ -8,7 +10,7 @@ class tile;
|
||||
namespace platform {
|
||||
|
||||
void restart(void *obj);
|
||||
void request(void *obj, tile *tile);
|
||||
void request(void *obj, std::shared_ptr<tile> tile);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@ public:
|
||||
|
||||
|
||||
void clear();
|
||||
void render(tile *tile);
|
||||
void render(std::shared_ptr<tile> tile);
|
||||
|
||||
void switchShader(Shader *shader, float matrix[16]);
|
||||
|
||||
private:
|
||||
void setupShaders();
|
||||
void changeMatrix(tile *tile);
|
||||
void changeMatrix(std::shared_ptr<tile> tile);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -7,27 +7,27 @@ template <typename T = double>
|
||||
struct vec2 {
|
||||
T x, y;
|
||||
|
||||
// inline bool operator==(const vec2& rhs) const {
|
||||
// return x == rhs.x && y == rhs.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;
|
||||
// }
|
||||
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;
|
||||
// }
|
||||
inline bool operator==(const vec4& rhs) const {
|
||||
return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user