From fe934aeec376c60dd23cd17bbc2de510a1974db1 Mon Sep 17 00:00:00 2001 From: John Connors Date: Mon, 25 Aug 2008 08:53:27 +0100 Subject: [PATCH] Bounding boxes work --- main.lisp | 6 +++-- npc.lisp | 85 ++++++++++++++++++++++++++++++++------------------------------- 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/main.lisp b/main.lisp index 816797a..43a49da 100644 --- a/main.lisp +++ b/main.lisp @@ -211,10 +211,12 @@ (defun begin-swank () (unless *swank-port* (setf *swank-port* (swank::start-session 4112)) - (format t "Please fire up your emacs and connect!~%") + (format t "Please fire up your emacs and connect.~%") (iterate (while (zerop (length swank::*connections*))) - (cl:sleep 0.1)))) + (cl:sleep 0.1) + (format t ".")) + (format t "~%Connected.~%"))) (defun end-swank () (when (not (zerop (length swank::*connections*))) diff --git a/npc.lisp b/npc.lisp index 70a1fe3..ae07922 100644 --- a/npc.lisp +++ b/npc.lisp @@ -82,49 +82,49 @@ (render-y-axis) (render-z-axis)))) -(defun render-aabb (mesh) +(defun render-aabb (mesh-aabb) (with-aabb - (aabb (gethash mesh *bounding-boxes*)) + (aabb mesh-aabb) (minx maxx miny maxy minz maxz) - (gl:with-begin gl:+lines+ - (gl:color-3f 1.0 1.0 1.0) - - (gl:vertex-3f minx miny minz) - (gl:vertex-3f maxx miny minz) - - (gl:vertex-3f maxx miny minz) - (gl:vertex-3f maxx miny maxz) - - (gl:vertex-3f maxx miny maxz) - (gl:vertex-3f minx miny maxz) - - (gl:vertex-3f minx miny maxz) - (gl:vertex-3f minx miny minz) - - (gl:vertex-3f minx maxy minz) - (gl:vertex-3f maxx maxy minz) - - (gl:vertex-3f maxx maxy minz) - (gl:vertex-3f maxx maxy maxz) - - (gl:vertex-3f maxx maxy maxz) - (gl:vertex-3f minx maxy maxz) - - (gl:vertex-3f minx maxy maxz) - (gl:vertex-3f minx maxy minz) - - (gl:vertex-3f minx miny minz) - (gl:vertex-3f minx maxy minz) - - (gl:vertex-3f maxx miny minz) - (gl:vertex-3f maxx maxy minz) - - (gl:vertex-3f maxx miny maxz) - (gl:vertex-3f maxx maxy maxz) - - (gl:vertex-3f minx miny maxz) - (gl:vertex-3f minx maxy maxz)))) - + (gl:with-begin gl:+lines+ + (gl:color-3f 1.0 1.0 1.0) + + (gl:vertex-3f minx miny minz) + (gl:vertex-3f maxx miny minz) + + (gl:vertex-3f maxx miny minz) + (gl:vertex-3f maxx miny maxz) + + (gl:vertex-3f maxx miny maxz) + (gl:vertex-3f minx miny maxz) + + (gl:vertex-3f minx miny maxz) + (gl:vertex-3f minx miny minz) + + (gl:vertex-3f minx maxy minz) + (gl:vertex-3f maxx maxy minz) + + (gl:vertex-3f maxx maxy minz) + (gl:vertex-3f maxx maxy maxz) + + (gl:vertex-3f maxx maxy maxz) + (gl:vertex-3f minx maxy maxz) + + (gl:vertex-3f minx maxy maxz) + (gl:vertex-3f minx maxy minz) + + (gl:vertex-3f minx miny minz) + (gl:vertex-3f minx maxy minz) + + (gl:vertex-3f maxx miny minz) + (gl:vertex-3f maxx maxy minz) + + (gl:vertex-3f maxx miny maxz) + (gl:vertex-3f maxx maxy maxz) + + (gl:vertex-3f minx miny maxz) + (gl:vertex-3f minx maxy maxz)))) + (let ((modelview-matrix (new-matrix44))) (defmethod render ((n npc)) (flet ((npc-modelview-matrix () @@ -147,7 +147,8 @@ (render (or (gethash (mesh-of n) mixamesh:*compiled-meshes*) (gethash (mesh-of n) mixamesh:*meshes*))) (let ((aabb (gethash (mesh-of n) mixamesh:*bounding-boxes*))) - (when aabb (render-aabb aabb))) + (when aabb + (render-aabb aabb))) (gl:pop-matrix)))) (defmethod make-npc (mesh) -- 2.11.4.GIT