play around with the lights
This commit is contained in:
parent
e29896e292
commit
2c271bfc03
35
outrun.rkt
35
outrun.rkt
|
@ -145,17 +145,30 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; the lights
|
;; the lights
|
||||||
|
|
||||||
(define (make-sunlight dsun)
|
(define (make-sunlight i)
|
||||||
|
(define cx (cos (degrees->radians i)))
|
||||||
|
(define sx (sin (degrees->radians i)))
|
||||||
|
(define cx2 (cos (* 8 (degrees->radians i))))
|
||||||
|
(define sx2 (sin (* 5 (degrees->radians i))))
|
||||||
|
(define light-pos
|
||||||
|
(pos (* 2 cx2) (* 3 sx2) (* 2 sx2)))
|
||||||
|
(combine
|
||||||
|
(with-emitted (emitted-hex "fffb96" 1/2)
|
||||||
|
(sphere light-pos 0.1))
|
||||||
|
(light light-pos (emitted-hex "fffb96" 10))
|
||||||
(sunlight
|
(sunlight
|
||||||
(angles->dir -30 (* 10 dsun))
|
(angles->dir -30 30)
|
||||||
(emitted-hex "fffb96" 1/2)))
|
(emitted "white" 1))))
|
||||||
|
|
||||||
;; Calculate camera position based on the state
|
;; Calculate camera position based on the state. Returns a `pos`.
|
||||||
(define (camera-position s)
|
(define (camera-position s)
|
||||||
(pos 0 (+ 4 (scene-state-dy s)) (- (scene-state-dz s) 4)))
|
(pos (scene-state-dx s) (+ 4 (scene-state-dy s)) (- (scene-state-dz s) 4)))
|
||||||
;; Calculate camera direction based on the state
|
|
||||||
|
;; Calculate camera direction based on the state. Returns a `dir` or a `pos`.
|
||||||
(define (camera-direction s)
|
(define (camera-direction s)
|
||||||
(angles->dir -90 55))
|
(angles->dir -90 55)
|
||||||
|
;;origin
|
||||||
|
)
|
||||||
|
|
||||||
(define (on-draw s n t)
|
(define (on-draw s n t)
|
||||||
(combine (basis 'camera
|
(combine (basis 'camera
|
||||||
|
@ -163,8 +176,8 @@
|
||||||
(camera-direction s)))
|
(camera-direction s)))
|
||||||
(make-sunlight (scene-state-dsun s))
|
(make-sunlight (scene-state-dsun s))
|
||||||
;; (move-y (road t) -1)
|
;; (move-y (road t) -1)
|
||||||
;; (spheres t)
|
(spheres t)
|
||||||
;; (scene t)
|
(scene t)
|
||||||
frozen-sspheres
|
frozen-sspheres
|
||||||
(mesh t)
|
(mesh t)
|
||||||
))
|
))
|
||||||
|
@ -184,6 +197,10 @@
|
||||||
[dz (+ (scene-state-dz s) 0.1)])]
|
[dz (+ (scene-state-dz s) 0.1)])]
|
||||||
[("s") (struct-copy scene-state s
|
[("s") (struct-copy scene-state s
|
||||||
[dz (- (scene-state-dz s) 0.1)])]
|
[dz (- (scene-state-dz s) 0.1)])]
|
||||||
|
[("a") (struct-copy scene-state s
|
||||||
|
[dx (+ (scene-state-dx s) 0.5)])]
|
||||||
|
[("d") (struct-copy scene-state s
|
||||||
|
[dx (- (scene-state-dx s) 0.5)])]
|
||||||
[else s]))
|
[else s]))
|
||||||
|
|
||||||
(define (stop-state? s n t) (scene-state-done? s))
|
(define (stop-state? s n t) (scene-state-done? s))
|
||||||
|
|
Loading…
Reference in New Issue