summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-11-09 19:56:07 -0500
committerDavid Thompson <dthompson2@worcester.edu>2015-11-09 19:56:07 -0500
commit9b4ec44a8e60e556f50da27b11f542a3993f2d03 (patch)
treefe12ee2deee0c10ed018caadac92d430ed4c1d38
parent88e22a04493153f3840965e15fe791bc9f870e3d (diff)
render: camera: Add 3d-camera procedure.
* sly/render/camera.scm (3d-camera): New procedure.
-rw-r--r--sly/render/camera.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/sly/render/camera.scm b/sly/render/camera.scm
index d943896..5b69808 100644
--- a/sly/render/camera.scm
+++ b/sly/render/camera.scm
@@ -41,7 +41,8 @@
camera-location
camera-viewport
with-camera
- 2d-camera))
+ 2d-camera
+ 3d-camera))
(define-record-type <camera>
(make-camera projection location viewport)
@@ -79,3 +80,13 @@ The origin is used as the default location."
(rect-height area) 0
z-near z-far)))
(make-camera projection location viewport)))
+
+(define* (3d-camera #:key (z-near 1) (z-far 10) (area (make-rect 0 0 640 480))
+ (field-of-vision 90) (aspect-ratio (/ 4 3))
+ (location (vector3 0 0 0)) (clear-color black)
+ (clear-flags %standard-clear-flags))
+ (let ((viewport (make-viewport area #:clear-color clear-color
+ #:clear-flags clear-flags))
+ (projection (perspective-projection field-of-vision aspect-ratio
+ z-near z-far)))
+ (make-camera projection location viewport)))