summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-11-08 08:11:53 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-11-08 08:14:54 -0500
commitd371b26178d98001beaec3429bc65ad892bd31a1 (patch)
tree844884ca27ce7db4d1682b25bf432acba5ae2209
parent232b8b81e91367e8a32361e51df97446ba6f2ae1 (diff)
math: Move transform module to sly/math directory.
* sly/transform.scm: Delete. * sly/render/transform.scm: New file. * Makefile.am (SOURCES): Add new file. Delete old one. * sly/render/camera.scm: Use (sly math transform). * sly/render/mesh.scm: Likewise. * sly/render/renderer.scm: Likewise. * sly/render/scene.scm: Likewise. * sly/render/shader.scm: Likewise. * sly/window.scm: Likewise. * examples/simple.scm: Likewise.
-rw-r--r--Makefile.am2
-rw-r--r--examples/simple.scm2
-rw-r--r--sly/math/transform.scm (renamed from sly/transform.scm)11
-rw-r--r--sly/render/camera.scm2
-rw-r--r--sly/render/mesh.scm2
-rw-r--r--sly/render/renderer.scm2
-rw-r--r--sly/render/scene.scm2
-rw-r--r--sly/render/shader.scm2
-rw-r--r--sly/window.scm2
9 files changed, 17 insertions, 10 deletions
diff --git a/Makefile.am b/Makefile.am
index 4f34e98..190cfa9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,12 +36,12 @@ SOURCES = \
sly/live-reload.scm \
sly/math.scm \
sly/math/quaternion.scm \
+ sly/math/transform.scm \
sly/math/vector.scm \
sly/mouse.scm \
sly/rect.scm \
sly/repl.scm \
sly/signal.scm \
- sly/transform.scm \
sly/transition.scm \
sly/window.scm \
sly/joystick.scm \
diff --git a/examples/simple.scm b/examples/simple.scm
index c6ba69f..b11f3ac 100644
--- a/examples/simple.scm
+++ b/examples/simple.scm
@@ -20,7 +20,7 @@
(sly rect)
(sly render scene)
(sly render sprite)
- (sly transform)
+ (sly math transform)
(sly vector)
(sly window)
(sly color))
diff --git a/sly/transform.scm b/sly/math/transform.scm
index 865153e..7ec582e 100644
--- a/sly/transform.scm
+++ b/sly/math/transform.scm
@@ -21,7 +21,7 @@
;;
;;; Code:
-(define-module (sly transform)
+(define-module (sly math transform)
#:use-module (system foreign)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
@@ -35,7 +35,7 @@
transform? transform-matrix
transpose transform-vector2
transform-position
- transform+ transform*
+ transform+ transform* transform*!
scale translate rotate-x rotate-y rotate-z rotate
build-transform
orthographic-projection perspective-projection
@@ -142,6 +142,13 @@ identity-transform if called without any arguments."
result))
(reduce mul identity-transform transforms))
+(define (transform*! dest a b)
+ (cblas-sgemm cblas-row-major cblas-no-trans cblas-no-trans
+ 4 4 4 1
+ (transform->pointer a) 4
+ (transform->pointer b) 4
+ 0 (transform->pointer dest) 4))
+
(define translate
(match-lambda
(($ <vector2> x y)
diff --git a/sly/render/camera.scm b/sly/render/camera.scm
index 7a56112..e869bef 100644
--- a/sly/render/camera.scm
+++ b/sly/render/camera.scm
@@ -31,7 +31,7 @@
#:use-module (sly utils)
#:use-module (sly color)
#:use-module (sly rect)
- #:use-module (sly transform)
+ #:use-module (sly math transform)
#:export (make-viewport viewport?
viewport-area viewport-clear-color viewport-clear-flags
%standard-clear-flags apply-viewport
diff --git a/sly/render/mesh.scm b/sly/render/mesh.scm
index 0222cd5..a7ed468 100644
--- a/sly/render/mesh.scm
+++ b/sly/render/mesh.scm
@@ -34,7 +34,7 @@
#:use-module (sly render texture)
#:use-module (sly math vector)
#:use-module (sly signal)
- #:use-module (sly transform)
+ #:use-module (sly math transform)
#:use-module (sly render utils)
#:use-module (sly render vertex-array)
#:use-module (sly render renderer)
diff --git a/sly/render/renderer.scm b/sly/render/renderer.scm
index d2c1f7b..dc48a32 100644
--- a/sly/render/renderer.scm
+++ b/sly/render/renderer.scm
@@ -30,7 +30,7 @@
#:use-module (gl low-level)
#:use-module (sly render shader)
#:use-module (sly render texture)
- #:use-module (sly transform)
+ #:use-module (sly math transform)
#:use-module (sly math vector)
#:use-module (sly render utils)
#:use-module (sly render context)
diff --git a/sly/render/scene.scm b/sly/render/scene.scm
index 19d4629..7d66ef0 100644
--- a/sly/render/scene.scm
+++ b/sly/render/scene.scm
@@ -28,7 +28,7 @@
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-26)
#:use-module (sly signal)
- #:use-module (sly transform)
+ #:use-module (sly math transform)
#:use-module (sly math vector)
#:use-module (sly render utils)
#:use-module (sly render camera)
diff --git a/sly/render/shader.scm b/sly/render/shader.scm
index 7a6c9c0..93c5217 100644
--- a/sly/render/shader.scm
+++ b/sly/render/shader.scm
@@ -26,7 +26,7 @@
#:use-module (gl)
#:use-module (gl low-level)
#:use-module (sly utils)
- #:use-module (sly transform)
+ #:use-module (sly math transform)
#:use-module (sly math vector)
#:use-module (sly color)
#:use-module (sly config)
diff --git a/sly/window.scm b/sly/window.scm
index 10aee4d..bb41661 100644
--- a/sly/window.scm
+++ b/sly/window.scm
@@ -27,7 +27,7 @@
#:use-module ((sdl mixer) #:prefix SDL:)
#:use-module (sly event)
#:use-module (sly signal)
- #:use-module (sly transform)
+ #:use-module (sly math transform)
#:use-module (sly math vector)
#:export (make-window
window?