From b9fa5959cbd7ad512566029b202d00a443ea3f15 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 21 Sep 2021 20:05:17 -0400 Subject: math: vector: Deprecate #v syntax and remove uses of it. --- chickadee/graphics/pbr.scm | 4 ++-- chickadee/math/bezier.scm | 2 +- chickadee/math/vector.scm | 2 ++ doc/api.texi | 7 ------- examples/9-patch.scm | 2 +- examples/model.scm | 2 +- examples/sprite.scm | 2 +- examples/text.scm | 2 +- 8 files changed, 9 insertions(+), 14 deletions(-) diff --git a/chickadee/graphics/pbr.scm b/chickadee/graphics/pbr.scm index e1641ec..bc224e0 100644 --- a/chickadee/graphics/pbr.scm +++ b/chickadee/graphics/pbr.scm @@ -64,14 +64,14 @@ (float alpha-cutoff pbr-properties-alpha-cutoff)) (define default-pbr-properties - (make-pbr-properties #:base-color-factor #v(1.0 1.0 1.0) + (make-pbr-properties #:base-color-factor (vec3 1.0 1.0 1.0) #:base-color-texcoord 0 #:metallic-factor 1.0 #:roughness-factor 1.0 #:metallic-roughness-texcoord 0 #:normal-texcoord 0 #:occlusion-texcoord 0 - #:emissive-factor #v(1.0 1.0 1.0) + #:emissive-factor (vec3 1.0 1.0 1.0) #:emissive-texcoord 0 #:alpha-mode 0 #:alpha-cutoff 0.5)) diff --git a/chickadee/math/bezier.scm b/chickadee/math/bezier.scm index e3dfbba..fa41b40 100644 --- a/chickadee/math/bezier.scm +++ b/chickadee/math/bezier.scm @@ -67,7 +67,7 @@ to the 2D vector DEST." (define (bezier-curve-point-at bezier t) "Return the coordinates for BEZIER at T (a value in the range [0, 1]) as a 2D vector." - (let ((v #v(0.0 0.0))) + (let ((v (vec2 0.0 0.0))) (bezier-curve-point-at! v bezier t) v)) diff --git a/chickadee/math/vector.scm b/chickadee/math/vector.scm index 680fb0f..747200e 100644 --- a/chickadee/math/vector.scm +++ b/chickadee/math/vector.scm @@ -402,6 +402,8 @@ polar coordinate (R, THETA) with an arbitrary ORIGIN point." (when (char-whitespace? (peek-char port)) (read-char port) (consume-whitespace port))) + (display "warning: #v syntax is deprecated, use vec2, vec3, etc. instead.\n" + (current-error-port)) (if (eq? (peek-char port) #\() (read-char port) (error "expected opening #\\(")) diff --git a/doc/api.texi b/doc/api.texi index b22fd57..3946ecd 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -627,13 +627,6 @@ Here's a quick example of adding two vectors: (define v (vec2+ (vec2 1 2) (vec2 3 4))) @end example -Since vectors are used so frequently, the reader macro @code{#v} is -used to cut down on typing: - -@example -(define v (vec2+ #v(1 2) #v(3 4))) -@end example - @emph{A Note About Performance} A lot of time has been spent making Chickadee's vector operations diff --git a/examples/9-patch.scm b/examples/9-patch.scm index 451f079..feb02b0 100644 --- a/examples/9-patch.scm +++ b/examples/9-patch.scm @@ -12,6 +12,6 @@ (define (draw alpha) (draw-9-patch image (make-rect 192.0 192.0 256.0 96.0) #:margin 4.0) - (draw-text "I am error." #v(200.0 266.0))) + (draw-text "I am error." (vec2 200.0 266.0))) (run-game #:load load #:draw draw) diff --git a/examples/model.scm b/examples/model.scm index 00441a1..8ba9b4a 100644 --- a/examples/model.scm +++ b/examples/model.scm @@ -14,7 +14,7 @@ (define position (vec3 0.0 0.0 0.0)) (define velocity (vec3 0.0 0.0 0.0)) (define model #f) -(define text-position #v(4.0 464.0)) +(define text-position (vec2 4.0 464.0)) (define text "") (define y-rotation 0.0) diff --git a/examples/sprite.scm b/examples/sprite.scm index a132c92..eb79161 100644 --- a/examples/sprite.scm +++ b/examples/sprite.scm @@ -9,6 +9,6 @@ (set! sprite (load-image "images/chickadee.png"))) (define (draw alpha) - (draw-sprite sprite #v(256.0 176.0))) + (draw-sprite sprite (vec2 256.0 176.0))) (run-game #:load load #:draw draw) diff --git a/examples/text.scm b/examples/text.scm index dd9c83a..3d2b3b5 100644 --- a/examples/text.scm +++ b/examples/text.scm @@ -4,6 +4,6 @@ (define (draw alpha) (draw-text "The quick brown fox jumps over the lazy dog.\nFive hexing wizard bots jump quickly." - #v(140.0 240.0))) + (vec2 140.0 240.0))) (run-game #:draw draw) -- cgit v1.2.3