Skip to content

Commit

Permalink
Shaders: doc++
Browse files Browse the repository at this point in the history
  • Loading branch information
mosra committed Feb 1, 2025
1 parent 4aa896f commit 087dd92
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
7 changes: 4 additions & 3 deletions src/Magnum/Shaders/Line.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ enum class LineJoinStyle: UnsignedByte {
* @htmlinclude line-join-miter.svg
*
* In this style, the points `A`, `B` and `C` collapse to a zero-area
* triangle. If the miter length `l` would be larger than the limit set in
* triangle. If the miter length `l` would be larger than the limit set via
* @ref LineGL::setMiterLengthLimit() /
* @ref LineMaterialUniform::setMiterLengthLimit() or the angle between the
* two segments `α` would be less than the limit set in
* two segments `α` would be less than the limit set via
* @ref LineGL::setMiterAngleLimit() /
* @ref LineMaterialUniform::setMiterAngleLimit(), it switches to
* @ref LineJoinStyle::Bevel instead.
Expand Down Expand Up @@ -467,7 +467,8 @@ struct MAGNUM_SHADERS_EXPORT LineMaterialUniform {
*
* For convenience it's recommended to use the @ref setMiterLengthLimit()
* and @ref setMiterAngleLimit() helpers instead of setting this value
* directly.
* directly. Default value is @cpp 0.875f @ce, which corresponds to a
* length of @cpp 4.0f @ce and angle of approximately @cpp 28.955_degf @ce.
* @see @ref LineGL::setMiterLengthLimit(),
* @ref LineGL::setMiterAngleLimit()
*/
Expand Down
18 changes: 9 additions & 9 deletions src/Magnum/Shaders/Line.vert
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,14 @@ void main() {

/* Decide about the line direction vector `d` and edge direction vector `e`
from the `pointMarkerComponent` input. Quad corners 0 and 1 come from
segment endpoint A, are marked with the POINT_MARKER_BEGIN_MASK bit and
so their line direction is taken from `nextPosition`, quad corners 2 and
3 come from B and are *not* marked with POINT_MARKER_BEGIN_MASK and so
their line direction is taken from `previousPosition`, with the
direction being always from point A to point B. The edge direction is
then perpendicular to the line direction, with points 0 and 2 marked
with POINT_MARKER_UP_MASK using it directly, while points 1 and 3
don't have POINT_MARKER_UP_MASK and have to negate it:
segment endpoint A, are marked with the ANNOTATION_BEGIN_MASK bit and so
their line direction is taken from `nextPosition`, quad corners 2 and 3
come from B and are *not* marked with ANNOTATION_BEGIN_MASK and so their
line direction is taken from `previousPosition`, with the direction
being always from point A to point B. The edge direction is then
perpendicular to the line direction, with points 0 and 2 marked with
ANNOTATION_UP_MASK using it directly, while points 1 and 3 don't have
ANNOTATION_UP_MASK and have to negate it:
^ ^
e e
Expand All @@ -396,7 +396,7 @@ void main() {
e e
v v
The POINT_MARKER_CAP_MASK is then used below. */
The ANNOTATION_CAP_MASK is then used below. */
highp const vec2 lineDirection = bool(annotation & ANNOTATION_BEGIN_MASK) ?
transformedNextPosition - transformedPosition :
transformedPosition - transformedPreviousPosition;
Expand Down
3 changes: 2 additions & 1 deletion src/Magnum/Shaders/LineGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,8 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT LineGL<dimensions>:
*
* Unlike for example the SVG specification that uses
* @ref LineCapStyle::Butt by default, the default value is
* @ref LineCapStyle::Square, in order to make zero-length lines visible.
* @ref LineCapStyle::Square, in order to make zero-length lines
* visible.
* @see @ref LineGL::capStyle()
*/
Configuration& setCapStyle(LineCapStyle style) {
Expand Down

0 comments on commit 087dd92

Please sign in to comment.