From 1ce6a9263d2718a2cd5bb30fd59b6ee7ab1d251b Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 28 Aug 2014 19:02:23 -0400 Subject: scene: Use quaternions for rotations. * sly/scene.scm (make-scene-node): Default rotation to identity-quaternion. (draw-scene-node): Convert quaternion to transformation matrix. --- sly/scene.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sly') 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)))))) -- cgit v1.2.3