Last active
April 2, 2017 03:13
-
-
Save Aeva/282135ae7b10e6623dcb76ee89d041f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use-modules (srfi srfi-1)) | |
(define (camera-layout) | |
'((matrix #:mat4))) | |
(define (camera property) | |
(find (lambda (record) (eq? (car record) property)) (camera-layout))) | |
(define (model-layout) | |
'((position #:vec3 #:vertex) | |
(matrix #:mat4) | |
(clip-space (* (camera 'matrix) (model 'matrix) (model 'position))))) | |
(define (model property) | |
(find (lambda (record) (eq? (car record) property)) (model-layout))) | |
(define (records) '(camera model)) | |
(define (record? symbol) | |
(let ([found (find (lambda (name) (eq? name symbol)) (records))]) | |
(cond | |
[found #t] | |
[else #f]))) | |
(define (solve thing) | |
(cond | |
[(eq? thing '()) '()] | |
[(and (list? thing) (record? (car thing))) (eval thing (interaction-environment))] | |
[(list? thing) (cons (solve (car thing)) (solve (cdr thing)))] | |
[else thing])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment