summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-10-23 19:45:07 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-10-23 19:45:07 -0400
commit13b18b33261391ff5f7748336ec0db9e83e03309 (patch)
treeeaa627692e9674834fb8ecd7ebbf3cfc63b8f5f7
parentdda297a7dfb9a39eedcd668ffdb395e7e90abd34 (diff)
transform: Add build-transform procedure.
* sly/transform.scm (build-transform): New procedure.
-rw-r--r--sly/transform.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/sly/transform.scm b/sly/transform.scm
index 205ecbe..252c123 100644
--- a/sly/transform.scm
+++ b/sly/transform.scm
@@ -34,6 +34,7 @@
transpose transform-vector2
transform+ transform*
scale translate rotate-x rotate-y rotate-z rotate
+ build-transform
orthographic-projection perspective-projection
look-at))
@@ -202,6 +203,14 @@ identity-transform if called without any arguments."
(- 1 (* 2 (square x)) (* 2 (square y)))
0 0 0 0 1))))
+(define build-transform
+ (let ((%scale scale))
+ (lambda* (#:optional #:key (position (vector3 0 0 0))
+ (scale 1) (rotation null-quaternion))
+ (transform* (translate position)
+ (%scale scale)
+ (rotate rotation)))))
+
(define (orthographic-projection left right top bottom near far)
"Return a new transform that represents an orthographic projection
for the vertical clipping plane LEFT and RIGHT, the horizontal