summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)))