summaryrefslogtreecommitdiff
path: root/src/mbgl/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/shaders')
-rw-r--r--src/mbgl/shaders/line.cpp9
-rw-r--r--src/mbgl/shaders/line_pattern.cpp9
-rw-r--r--src/mbgl/shaders/line_sdf.cpp9
3 files changed, 9 insertions, 18 deletions
diff --git a/src/mbgl/shaders/line.cpp b/src/mbgl/shaders/line.cpp
index ce62ecb3bd..aa59181fb4 100644
--- a/src/mbgl/shaders/line.cpp
+++ b/src/mbgl/shaders/line.cpp
@@ -21,7 +21,7 @@ const char* line::vertexSource = R"MBGL_SHADER(
// #define scale 63.0
#define scale 0.015873016
-attribute vec3 a_pos_normal;
+attribute vec4 a_pos_normal;
attribute vec4 a_data;
uniform mat4 u_matrix;
@@ -109,12 +109,9 @@ void main() {
vec2 pos = a_pos_normal.xy;
- // transform y normal so that 0 => -1 and 1 => 1
- // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap
+ // x is 1 if it's a round cap, 0 otherwise
// y is 1 if the normal points up, and -1 if it points down
- mediump vec2 normal = unpack_float(a_pos_normal.z);
- normal.y = sign(normal.y - 0.5);
-
+ mediump vec2 normal = a_pos_normal.zw;
v_normal = normal;
// these transformations used to be applied in the JS and native code bases.
diff --git a/src/mbgl/shaders/line_pattern.cpp b/src/mbgl/shaders/line_pattern.cpp
index f43b3a3cf7..d46858aa9e 100644
--- a/src/mbgl/shaders/line_pattern.cpp
+++ b/src/mbgl/shaders/line_pattern.cpp
@@ -23,7 +23,7 @@ const char* line_pattern::vertexSource = R"MBGL_SHADER(
// Retina devices need a smaller distance to avoid aliasing.
#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0
-attribute vec3 a_pos_normal;
+attribute vec4 a_pos_normal;
attribute vec4 a_data;
uniform mat4 u_matrix;
@@ -99,12 +99,9 @@ void main() {
vec2 pos = a_pos_normal.xy;
- // transform y normal so that 0 => -1 and 1 => 1
- // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap
+ // x is 1 if it's a round cap, 0 otherwise
// y is 1 if the normal points up, and -1 if it points down
- mediump vec2 normal = unpack_float(a_pos_normal.z);
- normal.y = sign(normal.y - 0.5);
-
+ mediump vec2 normal = a_pos_normal.zw;
v_normal = normal;
// these transformations used to be applied in the JS and native code bases.
diff --git a/src/mbgl/shaders/line_sdf.cpp b/src/mbgl/shaders/line_sdf.cpp
index 24b7153c7f..fb6046d8a5 100644
--- a/src/mbgl/shaders/line_sdf.cpp
+++ b/src/mbgl/shaders/line_sdf.cpp
@@ -23,7 +23,7 @@ const char* line_sdf::vertexSource = R"MBGL_SHADER(
// Retina devices need a smaller distance to avoid aliasing.
#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0
-attribute vec3 a_pos_normal;
+attribute vec4 a_pos_normal;
attribute vec4 a_data;
uniform mat4 u_matrix;
@@ -118,12 +118,9 @@ void main() {
vec2 pos = a_pos_normal.xy;
- // transform y normal so that 0 => -1 and 1 => 1
- // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap
+ // x is 1 if it's a round cap, 0 otherwise
// y is 1 if the normal points up, and -1 if it points down
- mediump vec2 normal = unpack_float(a_pos_normal.z);
- normal.y = sign(normal.y - 0.5);
-
+ mediump vec2 normal = a_pos_normal.zw;
v_normal = normal;
// these transformations used to be applied in the JS and native code bases.