summaryrefslogtreecommitdiff
path: root/src/mbgl/shader
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/shader')
-rw-r--r--src/mbgl/shader/circle_shader.cpp7
-rw-r--r--src/mbgl/shader/collision_box_shader.cpp14
-rw-r--r--src/mbgl/shader/icon_shader.cpp13
-rw-r--r--src/mbgl/shader/line_shader.cpp9
-rw-r--r--src/mbgl/shader/linepattern_shader.cpp12
-rw-r--r--src/mbgl/shader/linesdf_shader.cpp12
-rw-r--r--src/mbgl/shader/outline_shader.cpp7
-rw-r--r--src/mbgl/shader/outlinepattern_shader.cpp10
-rw-r--r--src/mbgl/shader/pattern_shader.cpp7
-rw-r--r--src/mbgl/shader/plain_shader.cpp7
-rw-r--r--src/mbgl/shader/raster_shader.cpp7
-rw-r--r--src/mbgl/shader/sdf_shader.cpp13
12 files changed, 71 insertions, 47 deletions
diff --git a/src/mbgl/shader/circle_shader.cpp b/src/mbgl/shader/circle_shader.cpp
index e1328bcbf1..9df5b01271 100644
--- a/src/mbgl/shader/circle_shader.cpp
+++ b/src/mbgl/shader/circle_shader.cpp
@@ -3,14 +3,15 @@
#include <mbgl/shader/circle.fragment.hpp>
#include <mbgl/gl/gl.hpp>
-using namespace mbgl;
-using namespace shaders::circle;
+namespace mbgl {
CircleShader::CircleShader(gl::ObjectStore& store)
- : Shader(::name, ::vertex, ::fragment, store) {
+ : Shader(shaders::circle::name, shaders::circle::vertex, shaders::circle::fragment, store) {
}
void CircleShader::bind(GLbyte* offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_SHORT, false, 4, offset));
}
+
+} // namespace mbgl
diff --git a/src/mbgl/shader/collision_box_shader.cpp b/src/mbgl/shader/collision_box_shader.cpp
index 7d6473ee29..81f44b44e6 100644
--- a/src/mbgl/shader/collision_box_shader.cpp
+++ b/src/mbgl/shader/collision_box_shader.cpp
@@ -3,13 +3,15 @@
#include <mbgl/shader/collisionbox.fragment.hpp>
#include <mbgl/gl/gl.hpp>
-using namespace mbgl;
-using namespace shaders::collisionbox;
+namespace mbgl {
CollisionBoxShader::CollisionBoxShader(gl::ObjectStore& store)
- : Shader(::name, ::vertex, ::fragment, store)
- , a_extrude(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_extrude")))
- , a_data(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data"))) {
+ : Shader(shaders::collisionbox::name,
+ shaders::collisionbox::vertex,
+ shaders::collisionbox::fragment,
+ store),
+ a_extrude(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_extrude"))),
+ a_data(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data"))) {
}
void CollisionBoxShader::bind(GLbyte *offset) {
@@ -25,3 +27,5 @@ void CollisionBoxShader::bind(GLbyte *offset) {
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data, 2, GL_UNSIGNED_BYTE, false, stride, offset + 8));
}
+
+} // namespace mbgl
diff --git a/src/mbgl/shader/icon_shader.cpp b/src/mbgl/shader/icon_shader.cpp
index f4568e6c3d..a6099a00cf 100644
--- a/src/mbgl/shader/icon_shader.cpp
+++ b/src/mbgl/shader/icon_shader.cpp
@@ -3,14 +3,13 @@
#include <mbgl/shader/icon.fragment.hpp>
#include <mbgl/gl/gl.hpp>
-using namespace mbgl;
-using namespace shaders::icon;
+namespace mbgl {
IconShader::IconShader(gl::ObjectStore& store)
- : Shader(::name, ::vertex, ::fragment, store)
- , a_offset(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_offset")))
- , a_data1(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data1")))
- , a_data2(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data2"))) {
+ : Shader(shaders::icon::name, shaders::icon::vertex, shaders::icon::fragment, store),
+ a_offset(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_offset"))),
+ a_data1(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data1"))),
+ a_data2(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data2"))) {
}
void IconShader::bind(GLbyte* offset) {
@@ -28,3 +27,5 @@ void IconShader::bind(GLbyte* offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data2));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data2, 4, GL_UNSIGNED_BYTE, false, stride, offset + 12));
}
+
+} // namespace mbgl
diff --git a/src/mbgl/shader/line_shader.cpp b/src/mbgl/shader/line_shader.cpp
index 729b34d557..300dc9f598 100644
--- a/src/mbgl/shader/line_shader.cpp
+++ b/src/mbgl/shader/line_shader.cpp
@@ -3,12 +3,11 @@
#include <mbgl/shader/line.fragment.hpp>
#include <mbgl/gl/gl.hpp>
-using namespace mbgl;
-using namespace shaders::line;
+namespace mbgl {
LineShader::LineShader(gl::ObjectStore& store)
- : Shader(::name, ::vertex, ::fragment, store)
- , a_data(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data"))) {
+ : Shader(shaders::line::name, shaders::line::vertex, shaders::line::fragment, store),
+ a_data(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data"))) {
}
void LineShader::bind(GLbyte* offset) {
@@ -18,3 +17,5 @@ void LineShader::bind(GLbyte* offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data, 4, GL_UNSIGNED_BYTE, false, 8, offset + 4));
}
+
+} // namespace mbgl
diff --git a/src/mbgl/shader/linepattern_shader.cpp b/src/mbgl/shader/linepattern_shader.cpp
index dc970a5661..2f3d93c03e 100644
--- a/src/mbgl/shader/linepattern_shader.cpp
+++ b/src/mbgl/shader/linepattern_shader.cpp
@@ -3,12 +3,14 @@
#include <mbgl/shader/linepattern.fragment.hpp>
#include <mbgl/gl/gl.hpp>
-using namespace mbgl;
-using namespace shaders::linepattern;
+namespace mbgl {
LinepatternShader::LinepatternShader(gl::ObjectStore& store)
- : Shader(::name, ::vertex, ::fragment, store)
- , a_data(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data"))) {
+ : Shader(shaders::linepattern::name,
+ shaders::linepattern::vertex,
+ shaders::linepattern::fragment,
+ store),
+ a_data(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data"))) {
}
void LinepatternShader::bind(GLbyte* offset) {
@@ -18,3 +20,5 @@ void LinepatternShader::bind(GLbyte* offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data, 4, GL_UNSIGNED_BYTE, false, 8, offset + 4));
}
+
+} // namespace mbgl
diff --git a/src/mbgl/shader/linesdf_shader.cpp b/src/mbgl/shader/linesdf_shader.cpp
index 29b67f4de5..8b6e2e1900 100644
--- a/src/mbgl/shader/linesdf_shader.cpp
+++ b/src/mbgl/shader/linesdf_shader.cpp
@@ -3,12 +3,14 @@
#include <mbgl/shader/linesdfpattern.fragment.hpp>
#include <mbgl/gl/gl.hpp>
-using namespace mbgl;
-using namespace shaders::linesdfpattern;
+namespace mbgl {
LineSDFShader::LineSDFShader(gl::ObjectStore& store)
- : Shader(::name, ::vertex, ::fragment, store)
- , a_data(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data"))) {
+ : Shader(shaders::linesdfpattern::name,
+ shaders::linesdfpattern::vertex,
+ shaders::linesdfpattern::fragment,
+ store),
+ a_data(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data"))) {
}
void LineSDFShader::bind(GLbyte* offset) {
@@ -18,3 +20,5 @@ void LineSDFShader::bind(GLbyte* offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data, 4, GL_UNSIGNED_BYTE, false, 8, offset + 4));
}
+
+} // namespace mbgl
diff --git a/src/mbgl/shader/outline_shader.cpp b/src/mbgl/shader/outline_shader.cpp
index 09aff361c3..aadbc08ada 100644
--- a/src/mbgl/shader/outline_shader.cpp
+++ b/src/mbgl/shader/outline_shader.cpp
@@ -3,14 +3,15 @@
#include <mbgl/shader/outline.fragment.hpp>
#include <mbgl/gl/gl.hpp>
-using namespace mbgl;
-using namespace shaders::outline;
+namespace mbgl {
OutlineShader::OutlineShader(gl::ObjectStore& store)
- : Shader(::name, ::vertex, ::fragment, store) {
+ : Shader(shaders::outline::name, shaders::outline::vertex, shaders::outline::fragment, store) {
}
void OutlineShader::bind(GLbyte* offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_SHORT, false, 0, offset));
}
+
+} // namespace mbgl
diff --git a/src/mbgl/shader/outlinepattern_shader.cpp b/src/mbgl/shader/outlinepattern_shader.cpp
index 0af8558587..8fde8dee74 100644
--- a/src/mbgl/shader/outlinepattern_shader.cpp
+++ b/src/mbgl/shader/outlinepattern_shader.cpp
@@ -3,14 +3,18 @@
#include <mbgl/shader/outlinepattern.fragment.hpp>
#include <mbgl/gl/gl.hpp>
-using namespace mbgl;
-using namespace shaders::outlinepattern;
+namespace mbgl {
OutlinePatternShader::OutlinePatternShader(gl::ObjectStore& store)
- : Shader(::name, ::vertex, ::fragment, store) {
+ : Shader(shaders::outlinepattern::name,
+ shaders::outlinepattern::vertex,
+ shaders::outlinepattern::fragment,
+ store) {
}
void OutlinePatternShader::bind(GLbyte *offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_SHORT, false, 0, offset));
}
+
+} // namespace mbgl
diff --git a/src/mbgl/shader/pattern_shader.cpp b/src/mbgl/shader/pattern_shader.cpp
index a7ddc681d4..f3027514f9 100644
--- a/src/mbgl/shader/pattern_shader.cpp
+++ b/src/mbgl/shader/pattern_shader.cpp
@@ -3,14 +3,15 @@
#include <mbgl/shader/pattern.fragment.hpp>
#include <mbgl/gl/gl.hpp>
-using namespace mbgl;
-using namespace shaders::pattern;
+namespace mbgl {
PatternShader::PatternShader(gl::ObjectStore& store)
- : Shader(::name, ::vertex, ::fragment, store) {
+ : Shader(shaders::pattern::name, shaders::pattern::vertex, shaders::pattern::fragment, store) {
}
void PatternShader::bind(GLbyte *offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_SHORT, false, 0, offset));
}
+
+} // namespace mbgl
diff --git a/src/mbgl/shader/plain_shader.cpp b/src/mbgl/shader/plain_shader.cpp
index 257f49e1e2..120481c272 100644
--- a/src/mbgl/shader/plain_shader.cpp
+++ b/src/mbgl/shader/plain_shader.cpp
@@ -3,14 +3,15 @@
#include <mbgl/shader/fill.fragment.hpp>
#include <mbgl/gl/gl.hpp>
-using namespace mbgl;
-using namespace shaders::fill;
+namespace mbgl {
PlainShader::PlainShader(gl::ObjectStore& store)
- : Shader(::name, ::vertex, ::fragment, store) {
+ : Shader(shaders::fill::name, shaders::fill::vertex, shaders::fill::fragment, store) {
}
void PlainShader::bind(GLbyte* offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_SHORT, false, 0, offset));
}
+
+} // namespace mbgl
diff --git a/src/mbgl/shader/raster_shader.cpp b/src/mbgl/shader/raster_shader.cpp
index b310212731..109c6e0d29 100644
--- a/src/mbgl/shader/raster_shader.cpp
+++ b/src/mbgl/shader/raster_shader.cpp
@@ -3,14 +3,15 @@
#include <mbgl/shader/raster.fragment.hpp>
#include <mbgl/gl/gl.hpp>
-using namespace mbgl;
-using namespace shaders::raster;
+namespace mbgl {
RasterShader::RasterShader(gl::ObjectStore& store)
- : Shader(::name, ::vertex, ::fragment, store) {
+ : Shader(shaders::raster::name, shaders::raster::vertex, shaders::raster::fragment, store) {
}
void RasterShader::bind(GLbyte* offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_SHORT, false, 0, offset));
}
+
+} // namespace mbgl
diff --git a/src/mbgl/shader/sdf_shader.cpp b/src/mbgl/shader/sdf_shader.cpp
index 1a08bef16e..faee224373 100644
--- a/src/mbgl/shader/sdf_shader.cpp
+++ b/src/mbgl/shader/sdf_shader.cpp
@@ -3,14 +3,13 @@
#include <mbgl/shader/sdf.fragment.hpp>
#include <mbgl/gl/gl.hpp>
-using namespace mbgl;
-using namespace shaders::sdf;
+namespace mbgl {
SDFShader::SDFShader(gl::ObjectStore& store)
- : Shader(::name, ::vertex, ::fragment, store)
- , a_offset(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_offset")))
- , a_data1(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data1")))
- , a_data2(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data2"))) {
+ : Shader(shaders::sdf::name, shaders::sdf::vertex, shaders::sdf::fragment, store),
+ a_offset(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_offset"))),
+ a_data1(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data1"))),
+ a_data2(MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data2"))) {
}
void SDFGlyphShader::bind(GLbyte* offset) {
@@ -44,3 +43,5 @@ void SDFIconShader::bind(GLbyte* offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data2));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data2, 4, GL_UNSIGNED_BYTE, false, stride, offset + 12));
}
+
+} // namespace mbgl