Merge branch 'master' into outdoors-style

Conflicts:
	bin/style.js
	include/llmr/map/transform.hpp
	src/renderer/painter.cpp
	src/text/placement.cpp
This commit is contained in:
Konstantin Käfer
2014-05-14 17:42:10 +02:00
30 changed files with 176 additions and 169 deletions

View File

@@ -33,7 +33,7 @@ public:
: w((x < 0 ? x - (1 << z) + 1 : x) / (1 << z)), z(z), x(x), y(y) {}
inline uint64_t to_uint64() const {
return ((pow(2, z) * y + x) * 32) + z;
return ((std::pow(2, z) * y + x) * 32) + z;
}
inline operator std::string() const {

View File

@@ -81,8 +81,8 @@ private:
// Limit the amount of zooming possible on the map.
// TODO: make these modifiable from outside.
const double min_scale = pow(2, 0);
const double max_scale = pow(2, 18);
const double min_scale = std::pow(2, 0);
const double max_scale = std::pow(2, 18);
// cache values for spherical mercator math
double zc, Bc, Cc;

View File

@@ -89,8 +89,7 @@ public:
bool needsAnimation() const;
private:
void setupShaders();
void translateLayer(const std::array<float, 2> &translation, const Tile::ID &id, bool reverse = false);
mat4 translatedMatrix(const std::array<float, 2> &translation, const Tile::ID &id, TranslateAnchor anchor = TranslateAnchor::Map);
const mat4 &translatedMatrix(const std::array<float, 2> &translation, const Tile::ID &id, TranslateAnchor anchor = TranslateAnchor::Map);
void prepareTile(const Tile& tile);
void useProgram(uint32_t program);
@@ -99,6 +98,7 @@ private:
public:
mat4 matrix;
mat4 vtxMatrix;
mat4 projMatrix;
mat4 nativeMatrix;
mat4 extrudeMatrix;

View File

@@ -63,6 +63,7 @@ struct FunctionProperty {
struct PointClass {
FunctionProperty enabled = true;
std::array<FunctionProperty, 2> translate = {{ 0, 0 }};
TranslateAnchor translateAnchor = TranslateAnchor::Map;
FunctionProperty size;
Color color = {{ 0, 0, 0, 1 }};
FunctionProperty opacity = 1;
@@ -74,6 +75,7 @@ struct PointClass {
struct PointProperties {
bool enabled = true;
std::array<float, 2> translate = {{ 0, 0 }};
TranslateAnchor translateAnchor = TranslateAnchor::Map;
float size = 0;
Color color = {{ 0, 0, 0, 1 }};
float opacity = 1.0;
@@ -85,6 +87,7 @@ struct PointProperties {
struct LineClass {
FunctionProperty enabled = true;
std::array<FunctionProperty, 2> translate = {{ 0, 0 }};
TranslateAnchor translateAnchor = TranslateAnchor::Map;
FunctionProperty width;
FunctionProperty offset;
Color color = {{ 0, 0, 0, 1 }};
@@ -95,6 +98,7 @@ struct LineClass {
struct LineProperties {
bool enabled = true;
std::array<float, 2> translate = {{ 0, 0 }};
TranslateAnchor translateAnchor = TranslateAnchor::Map;
float width = 0;
float offset = 0;
Color color = {{ 0, 0, 0, 1 }};
@@ -105,6 +109,7 @@ struct LineProperties {
struct FillClass {
FunctionProperty enabled = true;
std::array<FunctionProperty, 2> translate = {{ 0, 0 }};
TranslateAnchor translateAnchor = TranslateAnchor::Map;
Winding winding = Winding::NonZero;
FunctionProperty antialias = true;
Color fill_color = {{ 0, 0, 0, 1 }};
@@ -116,6 +121,7 @@ struct FillClass {
struct FillProperties {
bool enabled = true;
std::array<float, 2> translate = {{ 0, 0 }};
TranslateAnchor translateAnchor = TranslateAnchor::Map;
Winding winding = Winding::NonZero;
bool antialias = true;
Color fill_color = {{ 0, 0, 0, 1 }};

View File

@@ -44,7 +44,7 @@ inline T min(T a, T b, T c, T d) {
// a x b = |a||b|sin(θ) for θ.
template <typename T = double, typename S>
inline T angle_between(S ax, S ay, S bx, S by) {
return atan2((ax * by - ay * bx), ax * bx + ay * by);
return std::atan2((ax * by - ay * bx), ax * bx + ay * by);
}
template <typename T = double, typename S>
@@ -54,7 +54,7 @@ inline T angle_between(const vec2<S>& a, const vec2<S>& b) {
template <typename T = double, typename S>
inline T angle_to(const vec2<S>& a, const vec2<S>& b) {
return atan2(a.y - b.y, a.x - b.x);
return std::atan2(a.y - b.y, a.x - b.x);
}
template <typename T, typename S1, typename S2>
@@ -75,7 +75,7 @@ template <typename T, typename S1, typename S2>
inline vec2<T> normal(const S1& a, const S2& b) {
T dx = b.x - a.x;
T dy = b.y - a.y;
T c = sqrt(dx * dx + dy * dy);
T c = std::sqrt(dx * dx + dy * dy);
return { dx / c, dy / c };
}
@@ -83,14 +83,14 @@ template <typename T, typename S1, typename S2>
inline T dist(const S1& a, const S2& b) {
T dx = b.x - a.x;
T dy = b.y - a.y;
T c = sqrt(dx * dx + dy * dy);
T c = std::sqrt(dx * dx + dy * dy);
return c;
}
// Take the magnitude of vector a.
template <typename T = double, typename S>
inline T mag(const S& a) {
return sqrt(a.x * a.x + a.y * a.y);
return std::sqrt(a.x * a.x + a.y * a.y);
}
}