Megatest

Diff
Login

Differences From Artifact [a44db36c6b]:

To Artifact [81ad57f1fa]:


14
15
16
17
18
19
20

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    (3 . ,green  ) ;;	 green  
    (4 . ,yellow ) ;;	 yellow 
    (5 . ,white  ) ;;	 white  
    (6 . ,orange ) ;; 	 orange 
    (7 . ,black  ) ;;	 black
    ))


(define (get c)
  (alist-ref c colors))

(defstruct cspec
  (x 0)
  (y 0)
  (z 0)
  (n (get 1))   ;; north
  (s (get 1))   ;; south
  (e (get 1))   ;; east
  (w (get 1))   ;; west
  (t (get 1))   ;; top
  (b (get 1)))  ;; bottom

(define a 0)

(define (spin id)
  (set! a (modulo (+ a 1) 360)))

(define (colorize id col)







>
|






|
|
|
|
|
|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    (3 . ,green  ) ;;	 green  
    (4 . ,yellow ) ;;	 yellow 
    (5 . ,white  ) ;;	 white  
    (6 . ,orange ) ;; 	 orange 
    (7 . ,black  ) ;;	 black
    ))

;; retrive color
(define (rc c)
  (alist-ref c colors))

(defstruct cspec
  (x 0)
  (y 0)
  (z 0)
  (n (rc 1))   ;; north
  (s (rc 1))   ;; south
  (e (rc 1))   ;; east
  (w (rc 1))   ;; west
  (t (rc 1))   ;; top
  (b (rc 1)))  ;; bottom

(define a 0)

(define (spin id)
  (set! a (modulo (+ a 1) 360)))

(define (colorize id col)
89
90
91
92
93
94
95
96
97
98
99
100
101
102
;; (add-object draw-polygon animate: spin select: (lambda _ (print "oink!")))
(gl:Clear gl:COLOR_BUFFER_BIT)
(for-each
 (lambda (dat)
   ;; (let ((c1 (make-cspec e: red w: blue n: green s: yellow t: white b: orange)))
   (match dat
     ((x y z n s e w t b)
      (let ((c1 (make-cspec x: x y: y z: z n: (get n) s: (get s) e: (get e) w: (get w) t: (get t) b: (get b))))
	(pp (cspec->alist c1))
	(add-object (make-cuber c1) select: (lambda _ (print "oink!")))))
     (else (print "bad object " dat))))
 data)
(gl:Flush)      
(start-viewer)







|






90
91
92
93
94
95
96
97
98
99
100
101
102
103
;; (add-object draw-polygon animate: spin select: (lambda _ (print "oink!")))
(gl:Clear gl:COLOR_BUFFER_BIT)
(for-each
 (lambda (dat)
   ;; (let ((c1 (make-cspec e: red w: blue n: green s: yellow t: white b: orange)))
   (match dat
     ((x y z n s e w t b)
      (let ((c1 (make-cspec x: x y: y z: z n: (rc n) s: (rc s) e: (rc e) w: (rc w) t: (rc t) b: (rc b))))
	(pp (cspec->alist c1))
	(add-object (make-cuber c1) select: (lambda _ (print "oink!")))))
     (else (print "bad object " dat))))
 data)
(gl:Flush)      
(start-viewer)