From 20a4a2b23fc8309eda210e9f41ce36ca58dd0d89 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 12 Jul 2018 11:40:51 +0000 Subject: [PATCH] Avoid using `tan` as identifier in shaders. This conflicts with the tan() function, currently only on macOS. --- res/shaders/edge.vert | 4 ++-- res/shaders/outline.vert | 4 ++-- src/render/gl3shader.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/res/shaders/edge.vert b/res/shaders/edge.vert index 2217ee83..3c5af3b2 100644 --- a/res/shaders/edge.vert +++ b/res/shaders/edge.vert @@ -7,7 +7,7 @@ const float feather = 0.5; attribute vec3 pos; attribute vec3 loc; -attribute vec3 tan; +attribute vec3 tgt; uniform mat4 modelview; uniform mat4 projection; @@ -21,7 +21,7 @@ void main() { vec3 dir = vec3(modelview[0].z, modelview[1].z, modelview[2].z); // calculate line contour extension basis for constant width and caps - vec3 norm = normalize(cross(tan, dir)); + vec3 norm = normalize(cross(tgt, dir)); norm = normalize(norm - dir * dot(dir, norm)); vec3 perp = normalize(cross(dir, norm)); diff --git a/res/shaders/outline.vert b/res/shaders/outline.vert index 6bf1dfc0..7683a140 100644 --- a/res/shaders/outline.vert +++ b/res/shaders/outline.vert @@ -11,7 +11,7 @@ const float feather = 0.5; attribute vec3 pos; attribute vec4 loc; -attribute vec3 tan; +attribute vec3 tgt; attribute vec3 nol; attribute vec3 nor; @@ -40,7 +40,7 @@ void main() { (mode == EMPHASIZED_WITHOUT_CONTOUR && isTagged && !isOutline)); // calculate line contour extension basis for constant width and caps - vec3 norm = normalize(cross(tan, dir)); + vec3 norm = normalize(cross(tgt, dir)); norm = normalize(norm - dir * dot(dir, norm)); vec3 perp = normalize(cross(dir, norm)); diff --git a/src/render/gl3shader.cpp b/src/render/gl3shader.cpp index c224f13b..4fd6c666 100644 --- a/src/render/gl3shader.cpp +++ b/src/render/gl3shader.cpp @@ -453,7 +453,7 @@ void EdgeRenderer::Init(const StippleAtlas *a) { { { ATTRIB_POS, "pos" }, { ATTRIB_LOC, "loc" }, - { ATTRIB_TAN, "tan" } + { ATTRIB_TAN, "tgt" } } ); } @@ -638,7 +638,7 @@ void OutlineRenderer::Init(const StippleAtlas *a) { { { ATTRIB_POS, "pos" }, { ATTRIB_LOC, "loc" }, - { ATTRIB_TAN, "tan" }, + { ATTRIB_TAN, "tgt" }, { ATTRIB_NOL, "nol" }, { ATTRIB_NOR, "nor" } }