buggy line support
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <llmr/util/vec.hpp>
|
||||
#include <llmr/util/animation.hpp>
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <forward_list>
|
||||
|
||||
@@ -40,6 +41,7 @@ public:
|
||||
// Getters
|
||||
void matrixFor(float matrix[16], const vec3<int32_t>& id) const;
|
||||
float getZoom() const;
|
||||
int32_t getIntegerZoom() const;
|
||||
double getScale() const;
|
||||
double getAngle() const;
|
||||
void getLonLat(double& lon, double& lat) const;
|
||||
@@ -54,19 +56,22 @@ private:
|
||||
|
||||
public:
|
||||
// logical dimensions
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t width = 0;
|
||||
uint32_t height = 0;
|
||||
|
||||
// physical (framebuffer) dimensions
|
||||
uint32_t fb_width;
|
||||
uint32_t fb_height;
|
||||
uint32_t fb_width = 0;
|
||||
uint32_t fb_height = 0;
|
||||
|
||||
double pixelRatio = 1;
|
||||
|
||||
private:
|
||||
double x, y; // pixel values of the map center in the current scale
|
||||
double angle;
|
||||
double scale;
|
||||
double x = 0, y = 0; // pixel values of the map center in the current scale
|
||||
double angle = 0;
|
||||
double scale = 1;
|
||||
|
||||
double min_scale, max_scale;
|
||||
double min_scale = pow(2, 0);
|
||||
double max_scale = pow(2, 20);
|
||||
|
||||
// tile size
|
||||
const int32_t size = 512;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define LLMR_RENDERER_LINEBUCKET
|
||||
|
||||
#include "bucket.hpp"
|
||||
#include <llmr/style/bucket_description.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -9,7 +10,6 @@ namespace llmr {
|
||||
|
||||
class Style;
|
||||
class LineBuffer;
|
||||
class BucketDescription;
|
||||
struct Coordinate;
|
||||
struct pbf;
|
||||
|
||||
@@ -22,10 +22,11 @@ public:
|
||||
void addGeometry(pbf& data, const BucketDescription& bucket_desc);
|
||||
void addGeometry(const std::vector<Coordinate>& line, const BucketDescription& bucket_desc);
|
||||
|
||||
private:
|
||||
public:
|
||||
std::shared_ptr<LineBuffer> buffer;
|
||||
uint32_t start;
|
||||
uint32_t length;
|
||||
JoinType join;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "shader-fill.hpp"
|
||||
#include "shader-plain.hpp"
|
||||
#include "shader-outline.hpp"
|
||||
#include "shader-line.hpp"
|
||||
|
||||
#include "../map/tile.hpp"
|
||||
|
||||
@@ -54,12 +55,15 @@ private:
|
||||
Transform& transform;
|
||||
Settings& settings;
|
||||
Style& style;
|
||||
|
||||
float matrix[16];
|
||||
float exMatrix[16];
|
||||
|
||||
std::shared_ptr<Shader> currentShader;
|
||||
std::shared_ptr<FillShader> fillShader;
|
||||
std::shared_ptr<PlainShader> plainShader;
|
||||
std::shared_ptr<OutlineShader> outlineShader;
|
||||
std::shared_ptr<LineShader> lineShader;
|
||||
|
||||
uint32_t tile_stencil_buffer;
|
||||
uint32_t tile_border_buffer;
|
||||
|
||||
29
include/llmr/renderer/shader-line.hpp
Normal file
29
include/llmr/renderer/shader-line.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef LLMR_RENDERER_SHADER_LINE
|
||||
#define LLMR_RENDERER_SHADER_LINE
|
||||
|
||||
#include "shader.hpp"
|
||||
|
||||
namespace llmr {
|
||||
|
||||
class LineShader : public Shader {
|
||||
public:
|
||||
LineShader();
|
||||
|
||||
int32_t a_pos;
|
||||
int32_t a_extrude;
|
||||
int32_t a_linesofar;
|
||||
|
||||
int32_t u_matrix;
|
||||
int32_t u_exmatrix;
|
||||
int32_t u_linewidth;
|
||||
int32_t u_color;
|
||||
int32_t u_debug;
|
||||
int32_t u_ratio;
|
||||
int32_t u_dasharray;
|
||||
int32_t u_point;
|
||||
int32_t u_gamma;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -12,6 +12,7 @@ struct shader_source {
|
||||
|
||||
enum {
|
||||
FILL_SHADER,
|
||||
LINE_SHADER,
|
||||
OUTLINE_SHADER,
|
||||
PLAIN_SHADER,
|
||||
SHADER_COUNT
|
||||
|
||||
Reference in New Issue
Block a user