From: jsancho Date: Sun, 13 Dec 2009 22:58:00 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=ee0ee8aa7b6140f964ef3b04828f4144f831fcd4;p=gacela.git --- diff --git a/gacela_GL.lisp b/gacela_GL.lisp index c293bf5..e2032f8 100644 --- a/gacela_GL.lisp +++ b/gacela_GL.lisp @@ -206,6 +206,9 @@ (defcfun "int gacela_gluBuild2DMipmaps (int target, int internalFormat, int width, int height, int format, int type, int data)" 0 "return gluBuild2DMipmaps (target, internalFormat, width, height, format, type, data);") +(defcfun "void gacela_gluLookAt (double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ)" 0 + "gluLookAt (eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);") + (defentry glBegin (int) (void "gacela_glBegin")) (defentry glClear (int) (void "gacela_glClear")) (defentry glClearColor (float float float float) (void "gacela_glClearColor")) @@ -238,3 +241,4 @@ (defentry gluPerspective (double double double double) (void "gacela_gluPerspective")) (defentry gluBuild2DMipmaps (int int int int int int int) (int "gacela_gluBuild2DMipmaps")) +(defentry gluLookAt (float float float float float float float float float) (void "gacela_gluLookAt")) diff --git a/gacela_draw.lisp b/gacela_draw.lisp index 00eb551..fd2a717 100644 --- a/gacela_draw.lisp +++ b/gacela_draw.lisp @@ -105,14 +105,15 @@ (draw-rectangle (* f width) (* f height) :texture texture))))))) (defun draw-quad (v1 v2 v3 v4 &key texture) - (cond (texture (progn-textures - (glBindTexture GL_TEXTURE_2D (getf (get-resource texture) :id-texture)) - (begin-draw 4) - (draw-vertex v1 :texture-coord '(0 0)) - (draw-vertex v2 :texture-coord '(1 0)) - (draw-vertex v3 :texture-coord '(1 1)) - (draw-vertex v4 :texture-coord '(0 1)) - (glEnd))) + (cond (texture + (progn-textures + (glBindTexture GL_TEXTURE_2D (getf (get-resource texture) :id-texture)) + (begin-draw 4) + (draw-vertex v1 :texture-coord '(0 0)) + (draw-vertex v2 :texture-coord '(1 0)) + (draw-vertex v3 :texture-coord '(1 1)) + (draw-vertex v4 :texture-coord '(0 1)) + (glEnd))) (t (draw v1 v2 v3 v4)))) (defun draw-rectangle (width height &key texture) @@ -122,21 +123,21 @@ (defun draw-square (&key (size 1) texture) (draw-rectangle size size :texture texture)) -(defun draw-cube (&key size texture) +(defun draw-cube (&key size texture texture-1 texture-2 texture-3 texture-4 texture-5 texture-6) (let ((-size (neg size))) (progn-textures (glNormal3f 0 0 1) - (draw-quad (list -size size size) (list size size size) (list size -size size) (list -size -size size) :texture texture) + (draw-quad (list -size size size) (list size size size) (list size -size size) (list -size -size size) :texture (or texture-1 texture)) (glNormal3f 0 0 -1) - (draw-quad (list -size -size -size) (list size -size -size) (list size size -size) (list -size size -size) :texture texture) + (draw-quad (list -size -size -size) (list size -size -size) (list size size -size) (list -size size -size) :texture (or texture-2 texture)) (glNormal3f 0 1 0) - (draw-quad (list size size size) (list -size size size) (list -size size -size) (list size size -size) :texture texture) + (draw-quad (list size size size) (list -size size size) (list -size size -size) (list size size -size) :texture (or texture-3 texture)) (glNormal3f 0 -1 0) - (draw-quad (list -size -size size) (list size -size size) (list size -size -size) (list -size -size -size) :texture texture) + (draw-quad (list -size -size size) (list size -size size) (list size -size -size) (list -size -size -size) :texture (or texture-4 texture)) (glNormal3f 1 0 0) - (draw-quad (list size -size -size) (list size -size size) (list size size size) (list size size -size) :texture texture) + (draw-quad (list size -size -size) (list size -size size) (list size size size) (list size size -size) :texture (or texture-5 texture)) (glNormal3f -1 0 0) - (draw-quad (list -size -size size) (list -size -size -size) (list -size size -size) (list -size size size) :texture texture)))) + (draw-quad (list -size -size size) (list -size -size -size) (list -size size -size) (list -size size size) :texture (or texture-6 texture))))) (defun add-light (&key light position ambient (id GL_LIGHT1) (turn-on t)) (init-lighting)