summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-11-08 07:43:21 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-11-08 07:43:21 -0500
commita4fd060c95cb19969e69a2d63a217cd82af1978d (patch)
tree3165c208d77e301bd4e1e80f2217a8486129abb3
parentc9cbd41bb6ec00bbdb0b62907ed5aef5a202af1a (diff)
render: Move scene module to sly/render directory.
* sly/scene.scm: Delete. * sly/render/scene.scm: New file. * Makefile.am (SOURCES): Add new file. Delete old one. * examples/simple.scm: Use (sly render scene). * examples/tilemap.scm: Likewise.
-rw-r--r--Makefile.am2
-rw-r--r--examples/simple.scm2
-rw-r--r--examples/tilemap.scm2
-rw-r--r--sly/render/scene.scm (renamed from sly/scene.scm)29
4 files changed, 31 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am
index e99fb61..d7640e3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,7 +40,6 @@ SOURCES = \
sly/quaternion.scm \
sly/rect.scm \
sly/repl.scm \
- sly/scene.scm \
sly/signal.scm \
sly/transform.scm \
sly/transition.scm \
@@ -51,6 +50,7 @@ SOURCES = \
sly/render/framebuffer.scm \
sly/render/mesh.scm \
sly/render/texture.scm \
+ sly/render/scene.scm \
sly/render/shader.scm \
sly/render/shape.scm \
sly/render/sprite.scm \
diff --git a/examples/simple.scm b/examples/simple.scm
index 92a2010..c6ba69f 100644
--- a/examples/simple.scm
+++ b/examples/simple.scm
@@ -18,7 +18,7 @@
(use-modules (sly camera)
(sly game)
(sly rect)
- (sly scene)
+ (sly render scene)
(sly render sprite)
(sly transform)
(sly vector)
diff --git a/examples/tilemap.scm b/examples/tilemap.scm
index 079aa13..d05f8d9 100644
--- a/examples/tilemap.scm
+++ b/examples/tilemap.scm
@@ -25,7 +25,7 @@
(sly render tileset)
(sly vector)
(sly window)
- (sly scene)
+ (sly render scene)
(sly signal)
(sly camera)
(sly color)
diff --git a/sly/scene.scm b/sly/render/scene.scm
index 6cd3a5d..19d4629 100644
--- a/sly/scene.scm
+++ b/sly/render/scene.scm
@@ -22,7 +22,7 @@
;;
;;; Code:
-(define-module (sly scene)
+(define-module (sly render scene)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
@@ -67,6 +67,32 @@ whether to draw the node and all of its children or not."
(cons elem memo)))
'() lst))
+(define (set-identity! t)
+ (let ((matrix (transform-matrix t)))
+ (array-set! matrix 1 0 0)
+ (array-set! matrix 0 0 1)
+ (array-set! matrix 0 0 2)
+ (array-set! matrix 0 0 3)
+ (array-set! matrix 0 1 0)
+ (array-set! matrix 1 1 1)
+ (array-set! matrix 0 1 2)
+ (array-set! matrix 0 1 3)
+ (array-set! matrix 0 2 0)
+ (array-set! matrix 0 2 1)
+ (array-set! matrix 1 2 2)
+ (array-set! matrix 0 2 3)
+ (array-set! matrix 0 3 0)
+ (array-set! matrix 0 3 1)
+ (array-set! matrix 0 3 2)
+ (array-set! matrix 1 3 3)))
+
+(define t (make-transform 0 0 0 0
+ 0 0 0 0
+ 0 0 0 0
+ 0 0 0 0))
+
+(set-identity! t)
+
(define (scene->renderer node camera)
"Traverse the scene graph defined by NODE and its children, as seen
by CAMERA, and return a list of the render operations needed to
@@ -77,6 +103,7 @@ display the scene."
(let ((transform (transform* parent-transform
(scene-node-transform node)))
(object (scene-node-object node)))
+ ;; (transform*! t parent-transform (scene-node-transform node))
(cons (if object
(transform-render-op (draw (scene-node-object node))
transform)