@@ 53,9 53,19 @@ borderFragmentShader = B8.pack $ unlines [
"",
" vec2 pos = coord;",
" if (side == RIGHT || side == BOTTOM) pos = boxSize - coord;",
- " if (side == TOP || side == BOTTOM) pos = pos.xy;",
+ " if (side == LEFT || side == RIGHT) pos = pos.yx;",
"",
+ " int segment = int(floor(pos.x/widths[side]/2));",
+ " float width = widths[side];",
+ " vec2 dotCenter = vec2(segment*width*2 + width, width/2);",
+ " int stroke3 = int(floor(3*pos.y/widths[side]));",
" if (styles[side] == SOLID) fcolour = colours[side];",
+ " else if (styles[side] == DASHED)",
+ " fcolour = segment % 2 == 0 ? colours[side] : vec4(0);",
+ " else if (styles[side] == DOTTED)",
+ " fcolour = distance(pos, dotCenter) < widths[side]/2 ?",
+ " colours[side] : vec4(0);",
+ " else if (styles[side] == DOUBLE && stroke3 != 1) fcolour = colours[side];",
" else fcolour = vec4(0.0);",
"}"
]