summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/render/shapes.scm17
1 files changed, 12 insertions, 5 deletions
diff --git a/chickadee/render/shapes.scm b/chickadee/render/shapes.scm
index 70efef1..9c89928 100644
--- a/chickadee/render/shapes.scm
+++ b/chickadee/render/shapes.scm
@@ -106,7 +106,8 @@ void main (void) {
#:color color))))))
(define draw-line
- (let* ((vertex-buffer
+ (let* ((mvp (make-null-matrix4))
+ (vertex-buffer
(delay
(make-streaming-typed-buffer 'vec2 'float 4
#:name "line-typed-buffer")))
@@ -134,11 +135,11 @@ void main (void) {
in vec2 position;
in vec2 tex;
out vec2 frag_tex;
-uniform mat4 projection;
+uniform mat4 mvp;
void main(void) {
frag_tex = tex;
- gl_Position = projection * vec4(position.xy, 0.0, 1.0);
+ gl_Position = mvp * vec4(position.xy, 0.0, 1.0);
}
"
"
@@ -211,7 +212,8 @@ void main (void) {
(feather 1.0)
(cap 'round)
(color white)
- (shader (force default-shader)))
+ (shader (force default-shader))
+ matrix)
"Draw a line segment from START to END. The line will be
THICKNESS pixels thick with an antialiased border FEATHER pixels wide.
The line will be colored COLOR. CAP specifies the type of end cap that
@@ -272,7 +274,12 @@ may use SHADER to override the built-in line segment shader."
(f32vector-set! bv 7 t4)))
(with-blend-mode 'alpha
(gpu-apply shader (force vertex-array)
- #:projection (current-projection)
+ #:mvp (if matrix
+ (begin
+ (matrix4-mult! mvp matrix
+ (current-projection))
+ mvp)
+ (current-projection))
#:color color
#:w thickness
#:r feather