(case option
((draw)
(video:glmatrix-block
- (video:rotate rx ry rz)
- (video:translate x y z)
(video:rotate ax ay az)
+ (video:translate x y z)
+ (video:rotate rx ry rz)
(primitive)))
((translate)
(set! x (+ x (car params)))
(set! y (+ y (cadr params)))
(set! z (+ z (caddr params))))
+ ((turn)
+ (set! ax (+ ax (car params)))
+ (set! ay (+ ay (cadr params)))
+ (set! az (+ az (caddr params))))
+ ((rotate)
+ (set! rx (+ rx (car params)))
+ (set! ry (+ ry (cadr params)))
+ (set! rz (+ rz (caddr params))))
((get-properties)
(get-properties))
((get-property)
(assoc-ref (get-properties) (car params))))))))
-(define* (show-mesh mesh #:optional (view default-view))
+(define* (show mesh #:optional (view default-view))
(let ((id (mesh 'get-property 'id)))
(if (not (hash-ref view id))
(hash-set! view id mesh))))
-(define* (hide-mesh mesh #:optional (view default-view))
+(define* (hide mesh #:optional (view default-view))
(hash-remove! view (mesh 'get-property 'id)))
(define* (translate mesh x y #:optional (z 0))
(mesh 'translate x y z)
mesh)
+(define (turn mesh . params)
+ (if (>= (length params) 3)
+ (apply mesh (cons 'turn params))
+ (mesh 'turn 0 0 (car params)))
+ mesh)
+
+(define (rotate mesh . params)
+ (if (>= (length params) 3)
+ (apply mesh (cons 'rotate params))
+ (mesh 'rotate 0 0 (car params)))
+ mesh)
+
(define-macro (define-primitives . symbols)
(cond ((null? symbols)
`#t)