summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-08-28 19:02:23 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-08-28 19:02:23 -0400
commit1ce6a9263d2718a2cd5bb30fd59b6ee7ab1d251b (patch)
treeaddc0abda6874d39b28956ab4c9db551cdc7db0b
parent109f669470cce934af6231db967c4385389b2a68 (diff)
scene: Use quaternions for rotations.
* sly/scene.scm (make-scene-node): Default rotation to identity-quaternion. (draw-scene-node): Convert quaternion to transformation matrix.
-rw-r--r--sly/scene.scm5
1 files changed, 3 insertions, 2 deletions
diff --git a/sly/scene.scm b/sly/scene.scm
index e33ac48..9314eac 100644
--- a/sly/scene.scm
+++ b/sly/scene.scm
@@ -25,6 +25,7 @@
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-26)
#:use-module (sly mesh)
+ #:use-module (sly quaternion)
#:use-module (sly signal)
#:use-module (sly transform)
#:use-module (sly transition)
@@ -51,7 +52,7 @@
(define* (make-scene-node #:optional #:key
(position #(0 0))
(scale 1)
- (rotation 0)
+ (rotation identity-quaternion)
(uniforms '())
(children '())
#:allow-other-keys)
@@ -94,6 +95,6 @@
(interpolate position
(scene-node-prev-position node)
alpha))
- (rotate-z rotation)
+ (quaternion->transform rotation)
(scale %scale))))
(for-each (cut draw-scene-node <> alpha transform) children))))))