summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-11-23 20:45:30 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-11-23 20:45:30 -0500
commit1bbdaf63cbf1b747abe34b71a367861cbb751b73 (patch)
tree09049e72c4bc756c9eda1d1090762f4845f065dd
parent0363449c530a12c24905f4def4e6e0e4cd211b75 (diff)
render: Draw methods now accept a 'transform' parameter.
* sly/render/renderer.scm (transform-render-op): Delete. * sly/render/scene.scm (scene->renderer): Update usage of 'draw' method. * sly/render/mesh.scm (draw): Add 'transform' parameter.
-rw-r--r--sly/render/mesh.scm3
-rw-r--r--sly/render/renderer.scm9
-rw-r--r--sly/render/scene.scm2
3 files changed, 3 insertions, 11 deletions
diff --git a/sly/render/mesh.scm b/sly/render/mesh.scm
index 2aca38f..0f6a2b0 100644
--- a/sly/render/mesh.scm
+++ b/sly/render/mesh.scm
@@ -58,8 +58,9 @@
(%make-mesh (make-vertex-array indices positions textures)
shader texture))
-(define-method (draw (mesh <<mesh>>))
+(define-method (draw (mesh <<mesh>>) transform)
(make-render-op #:vertex-array (mesh-vao mesh)
#:texture (mesh-texture mesh)
#:shader (mesh-shader mesh)
+ #:transform transform
#:uniforms `(("color" ,white))))
diff --git a/sly/render/renderer.scm b/sly/render/renderer.scm
index f4c5edd..bb8f297 100644
--- a/sly/render/renderer.scm
+++ b/sly/render/renderer.scm
@@ -71,15 +71,6 @@ activated or not."
(%make-render-op transform vertex-array texture shader uniforms
blend-mode depth-test?))
-(define* (transform-render-op op transform)
- "Return a new render operation object that is the same as OP, but
-with its transformation matrix multiplied by TRANSFORM."
- (match op
- (($ <render-op> local-transform vertex-array texture shader uniforms
- blend-mode depth-test?)
- (%make-render-op (transform* transform local-transform) vertex-array
- texture shader uniforms blend-mode depth-test?))))
-
(define apply-render-op
;; Rendering should only ever happen from the main thread, so
;; mutating this transform is just fine.
diff --git a/sly/render/scene.scm b/sly/render/scene.scm
index 837bde8..333d60b 100644
--- a/sly/render/scene.scm
+++ b/sly/render/scene.scm
@@ -79,7 +79,7 @@ display the scene."
(map (cut iter <> transform) (scene-node-children node)))
'()))
(object
- (transform-render-op (draw object) parent-transform))))
+ (draw object parent-transform))))
(make-renderer context
(list camera)