summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2017-01-25 22:16:19 -0500
committerDavid Thompson <dthompson2@worcester.edu>2017-01-25 22:16:19 -0500
commit92fbc130909cc0bfd17430c590c5b42475385682 (patch)
tree7cce4a19ec8b5452b1f832ce7dc53e444fc9cc70
parent2535e324770ea6d621aec4f9ef814c18aecce99b (diff)
render: shapes: Change draw-line to accept vector arguments.
* chickadee/render/shapes.scm (draw-line): Replace x1, y1, x2, y2 arguments with start and end arguments that are vec2s.
-rw-r--r--chickadee/render/shapes.scm18
1 files changed, 11 insertions, 7 deletions
diff --git a/chickadee/render/shapes.scm b/chickadee/render/shapes.scm
index 0e9c0a1..6981807 100644
--- a/chickadee/render/shapes.scm
+++ b/chickadee/render/shapes.scm
@@ -125,13 +125,17 @@ void main (void) {
}
}
"))))
- (lambda* (x1 y1 x2 y2 #:key
- (thickness 1.0)
- (feather 1.0)
- (cap 'round)
- (color white)
- (shader (force default-shader)))
- (let* ((dx (- x2 x1))
+ (lambda* (start end #:key
+ (thickness 0.5)
+ (feather 1.0)
+ (cap 'round)
+ (color white)
+ (shader (force default-shader)))
+ (let* ((x1 (vec2-x start))
+ (y1 (vec2-y start))
+ (x2 (vec2-x end))
+ (y2 (vec2-y end))
+ (dx (- x2 x1))
(dy (- y2 y1))
(length (sqrt (+ (expt dx 2) (expt dy 2))))
(padding (/ (ceiling (+ thickness (* feather 2.5))) 2.0))