From 2697b96f4edb64be5e045383d0a6f9364598758d Mon Sep 17 00:00:00 2001 From: Dan Frumin Date: Fri, 27 Dec 2019 19:25:24 +0100 Subject: [PATCH] proper sun movement --- outrun.rkt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/outrun.rkt b/outrun.rkt index c381ac8..5ec1e09 100644 --- a/outrun.rkt +++ b/outrun.rkt @@ -5,11 +5,11 @@ "noise.rkt") (struct scene-state - (done? dx dy sun-dir) + (done? dx dy dsun) #:transparent) (define init-scene-state - (scene-state #f 0 0 (dir 1 (- 3) 0))) + (scene-state #f 0 0 0)) (current-material (material #:ambient 0.1 #:diffuse 0.6 @@ -41,7 +41,7 @@ (scale-number t 0 2000 -1 1)) -1 1 0.1 0.8)]) - (with-emitted (emitted-hex "ff71ce" alpha) (sphere (pos x y z) 0.2))))]) + (with-color (rgba-hex "ff71ce" alpha) (sphere (pos x y z) 0.2))))]) (combine lines-frozen spheres (move (rotate-y lines-frozen 90) @@ -50,15 +50,15 @@ (define scene (rotate-y (cube (pos 0 0 0) 1) 30)) -(define (make-sunlight d) +(define (make-sunlight dsun) (sunlight - d + (angles->dir -30 (* 10 dsun)) (emitted "white" 1/2))) (define (on-draw s n t) (combine (basis 'camera (point-at (pos 0 4 -6) origin)) - (make-sunlight (scene-state-sun-dir s)) + (make-sunlight (scene-state-dsun s)) (mesh t) ;; (move-y (rotate-x scene (/ t 20)) 2) )) @@ -67,9 +67,9 @@ (case k [("escape" "q") (struct-copy scene-state s [done? #t])] [("right") (struct-copy scene-state s - [sun-dir (dir+ +x (scene-state-sun-dir s))])] + [dsun (add1 (scene-state-dsun s))])] [("left") (struct-copy scene-state s - [sun-dir (dir+ -x (scene-state-sun-dir s))])] + [dsun (sub1 (scene-state-dsun s))])] [else s])) (define (stop-state? s n t) (scene-state-done? s))