aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--wheelwork.lisp11
1 files changed, 8 insertions, 3 deletions
diff --git a/wheelwork.lisp b/wheelwork.lisp
index 9d7571d..a1208a6 100644
--- a/wheelwork.lisp
+++ b/wheelwork.lisp
@@ -325,13 +325,18 @@ necessary."
(shutdown app))
(cleanup app)))))))
-(defgeneric render (thing))
-(defmethod render ((app application))
+(defun run-perframe (app)
(let ((table (perframe-table (listener app)))
(time (get-universal-time)))
(loop for target being the hash-key of table
for handlers = (slot-value (listener target) 'perframe)
- do (loop for handler in handlers do (funcall handler target time))))
+ ;; only fire perframe when target is in scene
+ when (or (eq app target) (unit-container target))
+ do (loop for handler in handlers do (funcall handler target time)))))
+
+(defgeneric render (thing))
+(defmethod render ((app application))
+ (run-perframe app)
(gl:clear-color 0.0 0.0 0.0 1.0)
(gl:clear :depth-buffer-bit :color-buffer-bit)
(dolist (thing (container-units app))