modify spheres

This commit is contained in:
Dan Frumin 2019-12-29 11:55:45 +01:00
parent d617210b5f
commit e29896e292
1 changed files with 23 additions and 14 deletions

View File

@ -11,10 +11,15 @@
(define init-scene-state
(scene-state #f 0 0 0 0))
(current-material (material #:ambient 0.1
#:diffuse 0.6
#:specular 0.3
#:roughness 0.5))
;; (current-material (material #:ambient 0.1
;; #:diffuse 0.6
;; #:specular 0.3
;; #:roughness 0.5))
(current-material (material #:ambient 0.05
#:diffuse 0.70
#:specular 0.25
#:roughness 0.1))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; the wavy road thingie
@ -111,7 +116,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; the static spheres
(define sspheres
(define (sspheres amount)
(let* ((calculate-noise-fn
(lambda (f)
(lambda (i j k)
@ -121,17 +126,21 @@
-1 1
0 1))))
(noise1 (calculate-noise-fn simplex))
(noise2 (calculate-noise-fn perlin)))
(noise2 (calculate-noise-fn perlin))
(random-position (lambda ()
(pos (* (- (random) 0.5) 15)
(* (- (random) 0.5) 15)
(* (- (random) 0.5) 15)))))
(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))))))))
(for/list ([_ (in-range amount)])
(match-let* ([(pos i j k) (random-position)]
[red (noise1 i j k)]
[green (noise2 i j k)]
[blue (noise1 red green 0)])
(with-color (rgba red green blue)
(sphere (pos i j k) (* 0.25 (+ (random) 0.1)))))))))
(define frozen-sspheres (freeze sspheres))
(define frozen-sspheres (freeze (sspheres 1000)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; the lights