From: jsancho Date: Sun, 20 Dec 2009 23:23:49 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=3c076309ea8727753bf689c3524d20116f45a0a3;p=gacela.git --- diff --git a/gacela.lisp b/gacela.lisp index 895bb38..73bc880 100644 --- a/gacela.lisp +++ b/gacela.lisp @@ -266,8 +266,7 @@ (setq running t) (do () ((quit?)) (glClear (+ GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT)) - (glLoadIdentity) -;(gluLookAt 0 0 50 0 0 0 0 1 0) + (to-origin) (when (functionp game-code) (funcall game-code)) (SDL_GL_SwapBuffers) (delay-frame) diff --git a/gacela_draw.lisp b/gacela_draw.lisp index dae68d4..15b61e0 100644 --- a/gacela_draw.lisp +++ b/gacela_draw.lisp @@ -168,4 +168,14 @@ (glRotatef rot 0 0 1)) (defun to-origin () - (glLoadIdentity)) + (glLoadIdentity) + (cond ((3d-mode?) (camera-look)))) + +(let ((camera-eye '(0 0 0)) (camera-center '(0 0 -100)) (camera-up '(0 1 0))) + (defun set-camera (&key eye center up) + (cond (eye (setq camera-eye eye))) + (cond (center (setq camera-center center))) + (cond (up (setq camera-up up)))) + + (defun camera-look () + (apply #'gluLookAt (concatenate 'list camera-eye camera-center camera-up))))