]> git.jsancho.org Git - gacela.git/blobdiff - src/views.scm
Functions for playing with arguments when apply to procedures.
[gacela.git] / src / views.scm
index 06625778d0edb1e20d8536ae4c43c48a71ffc2a5..c19bf338100064fbf0eda3d5f842f18c2adeeac0 100644 (file)
@@ -42,7 +42,7 @@
            (video:rotate ax ay az)
            (video:translate x y z)
            (video:rotate rx ry rz)
-           (primitive)))
+           (primitive (assoc-ref properties 'args))))
          ((translate)
           (set! x (+ x (car params)))
           (set! y (+ y (cadr params)))
           (set! properties (assoc-set! properties (car params) (cadr params)))))))))
 
 (define* (show mesh #:optional (view default-view))
-  (let ((id (mesh 'get-property 'id)))
+  (let ((id (mesh 'inner-property 'id)))
     (if (not (hash-ref view id))
        (hash-set! view id mesh))))
 
 (define* (hide mesh #:optional (view default-view))
-  (hash-remove! view (mesh 'get-property 'id)))
+  (hash-remove! view (mesh 'inner-property 'id)))
 
 (define* (translate mesh x y #:optional (z 0))
   (mesh 'translate x y z)
       (mesh 'rotate 0 0 (car params)))
   mesh)
 
+
+;;; Primitives
+
+(define-macro (primitive proc)
+  `(lambda (. params)
+     (let ((m (mesh (lambda (args) (apply ,proc args)))))
+       (m 'property-set! 'args params)
+       m)))
+
 (define-macro (define-primitives . symbols)
   (cond ((null? symbols)
         `#t)