add a road effect
This commit is contained in:
parent
eba4fd5d5e
commit
3361c239d9
61
outrun.rkt
61
outrun.rkt
|
@ -16,7 +16,46 @@
|
|||
#:specular 0.3
|
||||
#:roughness 0.5))
|
||||
|
||||
(define (road t)
|
||||
(define i-range-start -10)
|
||||
(define i-range-end 10)
|
||||
(define j-range-start -2)
|
||||
(define j-range-end 10)
|
||||
(define (calculate-noise-fn f)
|
||||
(lambda (i j)
|
||||
(scale-number (f (scale-number i i-range-start i-range-end -1 1)
|
||||
(scale-number j j-range-start j-range-end -1 1)
|
||||
(scale-number t 0 9000 -1 1))
|
||||
-1 1
|
||||
0 1)))
|
||||
(define calculate-noise (calculate-noise-fn perlin))
|
||||
(define calculate-noise-simplex (calculate-noise-fn simplex))
|
||||
(let* ([rgba-noise (lambda (i j)
|
||||
(let* ([r (calculate-noise i j)]
|
||||
[g (calculate-noise-simplex i j)]
|
||||
[b (calculate-noise-simplex r g)])
|
||||
(rgba r g b 1)))]
|
||||
[vertex-with-noise (lambda (i j)
|
||||
(vertex (pos i -1 j) #:color (rgba-noise i j)))]
|
||||
[mesh
|
||||
(for*/list ([i (in-range i-range-start i-range-end)]
|
||||
[j (in-range j-range-start j-range-end)])
|
||||
(quad (vertex-with-noise (add1 i) (add1 j))
|
||||
(vertex-with-noise i (add1 j))
|
||||
(vertex-with-noise i j)
|
||||
(vertex-with-noise (add1 i) j)
|
||||
#:back? #t))])
|
||||
(combine mesh)))
|
||||
|
||||
(define (mesh t)
|
||||
(define (calculate-noise i j)
|
||||
(scale-number (perlin (scale-number i -10 10 -1 1)
|
||||
(scale-number j -1 10 -1 1)
|
||||
(scale-number t 0 3000 -1 1))
|
||||
-1 1
|
||||
0 4))
|
||||
(define (calculate-pos i j)
|
||||
(pos i (calculate-noise i j) j))
|
||||
(let* ([lines
|
||||
(for*/list ([i (in-range -10 10)]
|
||||
[j (in-range 0 10)])
|
||||
|
@ -29,19 +68,15 @@
|
|||
[j (in-range -1 10)])
|
||||
(let ([x i]
|
||||
[z j]
|
||||
[y (scale-number
|
||||
(perlin (scale-number i -10 10 -1 1)
|
||||
(scale-number j -1 10 -1 1)
|
||||
(scale-number t 0 2000 -1 1))
|
||||
-1 1
|
||||
0 4)]
|
||||
[y (calculate-noise i j)]
|
||||
[alpha (scale-number
|
||||
(simplex (scale-number i -10 10 -1 1)
|
||||
(scale-number j -1 10 -1 1)
|
||||
(scale-number t 0 2000 -1 1))
|
||||
-1 1
|
||||
0.1 0.8)])
|
||||
(with-color (rgba-hex "ff71ce" alpha) (sphere (pos x y z) 0.2))))])
|
||||
0.33 1)])
|
||||
(with-color (rgba-hex "ff71ce" alpha)
|
||||
(sphere (pos x y z) 0.2))))])
|
||||
(combine lines-frozen
|
||||
spheres
|
||||
(move (rotate-y lines-frozen 90)
|
||||
|
@ -52,9 +87,10 @@
|
|||
(bend p
|
||||
(scale-number (perlin x y z) -1 1 -180 180)))
|
||||
(define (scene t)
|
||||
(rotate-x
|
||||
(bend+ my-pipe (/ t 1000) (/ t 1200) 69)
|
||||
90))
|
||||
(move-y (rotate-x
|
||||
(bend+ my-pipe (/ t 3000) (/ t 4000) 69)
|
||||
90)
|
||||
2))
|
||||
|
||||
(define (make-sunlight dsun)
|
||||
(sunlight
|
||||
|
@ -74,7 +110,8 @@
|
|||
(camera-direction s)))
|
||||
(make-sunlight (scene-state-dsun s))
|
||||
(mesh t)
|
||||
(move-y (scene t) 2)))
|
||||
(road t)
|
||||
(scene t)))
|
||||
|
||||
(define (on-key s n t k)
|
||||
(case k
|
||||
|
|
Loading…
Reference in New Issue