tweaks
This commit is contained in:
		
							
								
								
									
										33
									
								
								outrun.rkt
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								outrun.rkt
									
									
									
									
									
								
							@@ -16,6 +16,9 @@
 | 
				
			|||||||
                            #:specular 0.3
 | 
					                            #:specular 0.3
 | 
				
			||||||
                            #:roughness 0.5))
 | 
					                            #:roughness 0.5))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
 | 
					;;; the wavy road thingie
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (road t)
 | 
					(define (road t)
 | 
				
			||||||
  (define i-range-start -11)
 | 
					  (define i-range-start -11)
 | 
				
			||||||
  (define i-range-end 11)
 | 
					  (define i-range-end 11)
 | 
				
			||||||
@@ -48,6 +51,9 @@
 | 
				
			|||||||
                  #:back? #t))])
 | 
					                  #:back? #t))])
 | 
				
			||||||
    (combine mesh)))
 | 
					    (combine mesh)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
 | 
					;; the jumping spheres
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (spheres t)
 | 
					(define (spheres t)
 | 
				
			||||||
  (define (calculate-noise i j)
 | 
					  (define (calculate-noise i j)
 | 
				
			||||||
    (scale-number (perlin (scale-number i -10 10 -1 1)
 | 
					    (scale-number (perlin (scale-number i -10 10 -1 1)
 | 
				
			||||||
@@ -73,6 +79,9 @@
 | 
				
			|||||||
          (sphere (pos x y z) 0.2)))))
 | 
					          (sphere (pos x y z) 0.2)))))
 | 
				
			||||||
  (combine spheres))
 | 
					  (combine spheres))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
 | 
					;; the static mesh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (mesh t)
 | 
					(define (mesh t)
 | 
				
			||||||
  (let* ([lines
 | 
					  (let* ([lines
 | 
				
			||||||
          (for*/list ([i (in-range -10 10)]
 | 
					          (for*/list ([i (in-range -10 10)]
 | 
				
			||||||
@@ -81,12 +90,15 @@
 | 
				
			|||||||
              (move (cylinder (pos (- 0.1) (- 0.1) -5)
 | 
					              (move (cylinder (pos (- 0.1) (- 0.1) -5)
 | 
				
			||||||
                              (pos 0.1 0.1 10))
 | 
					                              (pos 0.1 0.1 10))
 | 
				
			||||||
                    (dir i 0 j))))]
 | 
					                    (dir i 0 j))))]
 | 
				
			||||||
         [lines-frozen (freeze (apply combine lines))])
 | 
					         [lines-comb (apply combine lines)])
 | 
				
			||||||
    (combine lines-frozen
 | 
					    (freeze (combine lines
 | 
				
			||||||
             (move (rotate-y lines-frozen 90)
 | 
					                     (move (rotate-y lines-comb 90)
 | 
				
			||||||
                   (dir -7 0 5)))))
 | 
					                           (dir -7 0 5))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define my-pipe (tessellate (pipe origin (dir 1 1/2 1))))
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
 | 
					;; the bendy pipe
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define my-pipe (tessellate (with-color (rgba-hex "01cdfe") (pipe origin (dir 1 1/2 1)))))
 | 
				
			||||||
(define (bend+ p x y z)
 | 
					(define (bend+ p x y z)
 | 
				
			||||||
  (bend p
 | 
					  (bend p
 | 
				
			||||||
        (scale-number (perlin x y z) -1 1 -180 180)))
 | 
					        (scale-number (perlin x y z) -1 1 -180 180)))
 | 
				
			||||||
@@ -96,10 +108,13 @@
 | 
				
			|||||||
           90)
 | 
					           90)
 | 
				
			||||||
          2))
 | 
					          2))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
 | 
					;; the lights
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (make-sunlight dsun)
 | 
					(define (make-sunlight dsun)
 | 
				
			||||||
  (sunlight
 | 
					  (sunlight
 | 
				
			||||||
   (angles->dir -30 (* 10 dsun))
 | 
					   (angles->dir -30 (* 10 dsun))
 | 
				
			||||||
   (emitted "white" 1/2)))
 | 
					   (emitted-hex "fffb96" 1/2)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; Calculate camera position based on the state
 | 
					;; Calculate camera position based on the state
 | 
				
			||||||
(define (camera-position s)
 | 
					(define (camera-position s)
 | 
				
			||||||
@@ -114,9 +129,9 @@
 | 
				
			|||||||
                            (camera-direction s)))
 | 
					                            (camera-direction s)))
 | 
				
			||||||
           (make-sunlight (scene-state-dsun s))
 | 
					           (make-sunlight (scene-state-dsun s))
 | 
				
			||||||
           (mesh t)
 | 
					           (mesh t)
 | 
				
			||||||
           (move-y (road t) -1)
 | 
					           ;; (move-y (road t) -1)
 | 
				
			||||||
           ;;(spheres t)
 | 
					           (spheres t)
 | 
				
			||||||
           ;;(scene t)
 | 
					           (scene t)
 | 
				
			||||||
           ))
 | 
					           ))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (on-key s n t k)
 | 
					(define (on-key s n t k)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user