Megatest

Check-in [b7dfc5691b]
Login
Overview
Comment:junk
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65
Files: files | file ages | folders
SHA1: b7dfc5691b1deb29ddc0ff2d0d8417914960581f
User & Date: matt on 2019-04-04 01:51:15
Other Links: branch diff | manifest | tags
Context
2019-04-04
10:30
junk check-in: 3a76f000c0 user: mrwellan tags: v1.65
01:51
junk check-in: b7dfc5691b user: matt tags: v1.65
2019-04-01
12:45
ensure test status does not change to preq_fail if it already completed check-in: ab579cdb7a user: bjbarcla tags: v1.65
Changes

Added junk/cube.scm version [dfc5973f3b].













































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
(use gl glut 3viewer typed-records matchable)

(define red    '#f32(1 0 0 1))   ;;      
(define blue   '#f32(0 0 1 1))	  ;;	  
(define green  '#f32(0 1 0 1))	  ;;	  
(define yellow '#f32(1 1 0 1))	  ;;	  
(define white  '#f32(1 1 1 1))	  ;;	  
(define orange '#f32(1 0.5 0 1)) ;; 	  
(define black  '#f32(0 0 0 1)) ;;	 

(define colors
  `((1 . ,red    ) ;;  red    
    (2 . ,blue   ) ;;	 blue   
    (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)
  (gl:Materialfv 
   gl:FRONT_AND_BACK gl:AMBIENT_AND_DIFFUSE
   (if (object-highlighted? id)
       '#f32(1 1 0 1)
       col)))

(define (make-cuber cspec)
  (lambda (id)
    (gl:Translatef (cspec-x cspec)(cspec-y cspec)(cspec-z cspec))
    (draw-side id (cspec-w cspec)) ;; west side
    (gl:Translatef 0 1 0)
    (gl:Rotatef 90 1 0 0)
    (draw-side id (cspec-e cspec)) ;; east side
    (gl:Translatef 0 0 1)
    (gl:Rotatef 90 0 1 0)
    (draw-side id (cspec-n cspec)) ;; east side
    (gl:Translatef 0 0 1)
    (gl:Rotatef 90 0 1 0)
    (draw-side id (cspec-s cspec)) ;; east side
    (gl:Translatef 0 0 1)
    (gl:Rotatef 90 0 1 0)
    (draw-side id (cspec-t cspec)) ;; east side
    (gl:Translatef 0 1 0)
    (gl:Rotatef 90 1 0 0)
    (draw-side id (cspec-b cspec)) ;; east side
       ))
    
(define (draw-side id color)
  (colorize id color) ;; '#f32(1 0 0 1))
  (gl:Begin gl:POLYGON)
  (gl:Vertex2f 0 0) 
  (gl:Vertex2f 0 1) 
  (gl:Vertex2f 1 1) 
  (gl:Vertex2f 1 0) 
  (gl:End) 
  )

(define data
  (map (lambda (inl)
	 (map string->number (string-split inl)))
       (with-input-from-file "data.scm"
	 read-lines)))

(print "data: " data)

(use trace)

;; (add-object draw-cube animate: spin select: (lambda _ (print "oink!")))
;; (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)

Added junk/data.scm version [61f00175d7].







>
>
>
1
2
3
0 0 0 1 2 3 4 5 6
1 0 0 1 2 3 4 5 6
1 1 0 1 2 3 4 5 6