proper sun movement

This commit is contained in:
Dan Frumin 2019-12-27 19:25:24 +01:00
parent 904f4c89de
commit 2697b96f4e
1 changed files with 8 additions and 8 deletions

View File

@ -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))