diff options
author | Colin Okay <colin@cicadas.surf> | 2022-06-29 06:34:57 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-06-29 06:34:57 -0500 |
commit | ff0d86e99de2ce0fb61efd82070b758de0bb107f (patch) | |
tree | 6376336974b4795f2688c3805fee4494bbcbb110 /wheelwork.lisp | |
parent | 581e6a0c52cc7cb1e6fd5e0d65a83630a00f8551 (diff) |
[refactor] factored run-perframe out of render (app)
Diffstat (limited to 'wheelwork.lisp')
-rw-r--r-- | wheelwork.lisp | 11 |
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)) |