summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2d/transform.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/2d/transform.scm b/2d/transform.scm
index e7b5c31..ea3061d 100644
--- a/2d/transform.scm
+++ b/2d/transform.scm
@@ -27,6 +27,7 @@
#:use-module (srfi srfi-42)
#:use-module (2d vector2)
#:export (make-transform
+ make-transform*
null-transform
identity-transform
transform?
@@ -74,6 +75,15 @@ column-major format."
(array-set! matrix dd 3 3)
(%make-transform matrix)))
+(define* (make-transform* #:optional #:key (translate null-vector2)
+ (scale (vector2 1 1)) (rotate 0))
+ "Return a new transform that is the result of the composition of the
+given TRANSLATE, SCALE, and ROTATE values. Both TRANSLATE and SCALE
+are vector2 values, while ROTATE is a number."
+ (transform* (transform-scale scale)
+ (transform-rotate rotate)
+ (transform-translate translate)))
+
(define null-transform
(%make-transform (make-4x4-matrix)))