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