From: Javier Sancho Date: Sun, 1 Jul 2012 07:52:56 +0000 (+0200) Subject: Defining basic meshes. X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=39f152a6692148c273b435f0b5047f5c885e5841;p=gacela.git Defining basic meshes. --- diff --git a/src/views.scm b/src/views.scm index 4f35b56..5fcf854 100644 --- a/src/views.scm +++ b/src/views.scm @@ -15,7 +15,7 @@ ;;; along with this program. If not, see . -(define-module (gacela draw) +(define-module (gacela views) #:use-module (gacela gacela) #:use-module ((gacela video) #:renamer (symbol-prefix-proc 'video:)) #:use-module ((gacela gl) #:select (glPushMatrix glPopMatrix)) @@ -26,8 +26,20 @@ (hash-set! active-views ',name (lambda () (video:glmatrix-block ,content))) ',name)) -(define (square . params) - (define-view tmp (apply video:draw-square params))) +(define-macro (lambda-mesh . content) + `(lambda () ,content)) + +(define-macro (define-basic-meshes . symbols) + (cond ((null? symbols) + `#t) + (else + `(begin + (define (,(caar symbols) . params) (lambda-visible (video:glmatrix-block (apply ,(cadar symbols) params)))) + (define-basic-meshes ,@(cdr symbols)))))) + +(define-basic-meshes + (rectangle video:draw-rectangle) + (square video:draw-square)) (module-map (lambda (sym var) (if (not (eq? sym '%module-public-interface))