summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry/line_buffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/geometry/line_buffer.cpp')
-rw-r--r--src/mbgl/geometry/line_buffer.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mbgl/geometry/line_buffer.cpp b/src/mbgl/geometry/line_buffer.cpp
new file mode 100644
index 0000000000..50a6e66b93
--- /dev/null
+++ b/src/mbgl/geometry/line_buffer.cpp
@@ -0,0 +1,23 @@
+#include <mbgl/geometry/line_buffer.hpp>
+#include <mbgl/platform/gl.hpp>
+
+#include <cmath>
+
+using namespace mbgl;
+
+size_t LineVertexBuffer::add(vertex_type x, vertex_type y, float ex, float ey, int8_t tx, int8_t ty, int32_t linesofar) {
+ size_t idx = index();
+ void *data = addElement();
+
+ int16_t *coords = static_cast<int16_t *>(data);
+ coords[0] = (x * 2) | tx;
+ coords[1] = (y * 2) | ty;
+
+ int8_t *extrude = static_cast<int8_t *>(data);
+ extrude[4] = std::round(extrudeScale * ex);
+ extrude[5] = std::round(extrudeScale * ey);
+
+ coords[3] = linesofar;
+
+ return idx;
+}