diff --git a/src/Magnum/Shaders/Implementation/lineMiterLimit.h b/src/Magnum/Shaders/Implementation/lineMiterLimit.h index 7ce223aa1..53ad972cb 100644 --- a/src/Magnum/Shaders/Implementation/lineMiterLimit.h +++ b/src/Magnum/Shaders/Implementation/lineMiterLimit.h @@ -32,6 +32,9 @@ namespace Magnum { namespace Shaders { namespace Implementation { +/* These helpers, along with tests, are copied verbatim between the Shaders and + Ui libraries */ + inline Float lineMiterLengthLimit(const char* #if !defined(CORRADE_NO_ASSERT) && !defined(CORRADE_STANDARD_ASSERT) const name diff --git a/src/Magnum/Shaders/Line.h b/src/Magnum/Shaders/Line.h index d10a1a73e..fd69817ee 100644 --- a/src/Magnum/Shaders/Line.h +++ b/src/Magnum/Shaders/Line.h @@ -46,6 +46,9 @@ namespace Magnum { namespace Shaders { @see @ref LineGL::capStyle(), @ref LineGL::Configuration::setCapStyle() */ enum class LineCapStyle: UnsignedByte { + /* Keep these in sync with Ui::LineCapStyle (except for the related links, + of course). The images are used directly from there. */ + /** * [Butt cap](https://en.wikipedia.org/wiki/Butt_joint). The line is cut * off right at the endpoint. Lines of zero length will be invisible. @@ -95,6 +98,9 @@ enum class LineCapStyle: UnsignedByte { @see @ref LineGL::joinStyle(), @ref LineGL::Configuration::setJoinStyle() */ enum class LineJoinStyle: UnsignedByte { + /* Keep these in sync with Ui::LineJoinStyle (except for the related links, + of course). The images are used directly from there. */ + /** * [Miter join](https://en.wikipedia.org/wiki/Miter_joint). The outer edges * of both line segments extend until they intersect. @@ -156,6 +162,9 @@ The type is 32-bit in order to match the default type of the bits. */ enum class LineVertexAnnotation: UnsignedInt { + /* Keep these in sync with the internal Ui::LineLayer LineVertexAnnotation* + constants and ANNOTATION_* defines in Line.in.vert. */ + /** * The point extends upwards assuming a left-to-right direction of the line * segment. If not set, it extends downwards. Visualized as `U` in the diff --git a/src/Magnum/Shaders/Line.in.frag b/src/Magnum/Shaders/Line.in.frag index 913bbe430..034888b3a 100644 --- a/src/Magnum/Shaders/Line.in.frag +++ b/src/Magnum/Shaders/Line.in.frag @@ -24,6 +24,9 @@ DEALINGS IN THE SOFTWARE. */ +/* This file, along with *.in.vert, is copied verbatim between the Shaders + and Ui libraries */ + mediump float lineBlendFactor( in highp vec2 centerDistanceSigned, in highp float halfSegmentLength, diff --git a/src/Magnum/Shaders/Line.in.vert b/src/Magnum/Shaders/Line.in.vert index 8dbdeddeb..2f0073f03 100644 --- a/src/Magnum/Shaders/Line.in.vert +++ b/src/Magnum/Shaders/Line.in.vert @@ -24,6 +24,9 @@ DEALINGS IN THE SOFTWARE. */ +/* This file, along with *.in.frag, is copied verbatim between the Shaders + and Ui libraries */ + /* Point annotation, matching the LineVertexAnnotation enum bits */ #define ANNOTATION_UP_MASK 1u #define ANNOTATION_JOIN_MASK 2u diff --git a/src/Magnum/Shaders/LineGL.cpp b/src/Magnum/Shaders/LineGL.cpp index b41c1e66b..9bbf9e572 100644 --- a/src/Magnum/Shaders/LineGL.cpp +++ b/src/Magnum/Shaders/LineGL.cpp @@ -124,7 +124,8 @@ template typename LineGL::CompileState LineG #endif /* Cap and join style is needed by both the vertex and fragment shader, - prepare their defines just once for both */ + prepare their defines just once for both. This snippet is shared between + Shaders::LineGL and Ui::LineLayerGL, keep in sync. */ Containers::StringView capStyleDefine, joinStyleDefine; switch(configuration.capStyle()) { case LineCapStyle::Butt: diff --git a/src/Magnum/Shaders/Test/LineTest.cpp b/src/Magnum/Shaders/Test/LineTest.cpp index 3282379de..58995c75f 100644 --- a/src/Magnum/Shaders/Test/LineTest.cpp +++ b/src/Magnum/Shaders/Test/LineTest.cpp @@ -49,6 +49,8 @@ struct LineTest: TestSuite::Tester { void materialUniformConstructNoInit(); void materialUniformSetters(); + /* Miter limit tests are copied verbatim between the Shaders and Ui + libraries */ void materialUniformMiterLimit(); void materialUniformMiterLengthLimitInvalid(); void materialUniformMiterAngleLimitInvalid();