add frozen spheres

This commit is contained in:
Dan Frumin 2019-12-28 18:10:12 +01:00
parent dc3fcdb985
commit d617210b5f
1 changed files with 29 additions and 3 deletions

View File

@ -108,6 +108,31 @@
90)
2))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; the static spheres
(define sspheres
(let* ((calculate-noise-fn
(lambda (f)
(lambda (i j k)
(scale-number (f (scale-number i -10 10 -1 1)
(scale-number j -10 10 -1 1)
(scale-number k -10 10 -1 1))
-1 1
0 1))))
(noise1 (calculate-noise-fn simplex))
(noise2 (calculate-noise-fn perlin)))
(combine
(for*/list ([i (in-range -10 10)]
[j (in-range -10 10)]
[k (in-range -10 10)]
#:when (< (random) 0.31))
(with-color
(rgba (noise1 i j k) (noise1 k j i) (noise2 i j k))
(sphere (pos i j k) (* 0.25 (+ (random) 0.1))))))))
(define frozen-sspheres (freeze sspheres))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; the lights
@ -128,10 +153,11 @@
(point-at (camera-position s)
(camera-direction s)))
(make-sunlight (scene-state-dsun s))
(mesh t)
;; (move-y (road t) -1)
(spheres t)
(scene t)
;; (spheres t)
;; (scene t)
frozen-sspheres
(mesh t)
))
(define (on-key s n t k)