Skip to content
Permalink
Browse files

Minor

  • Loading branch information...
Shinmera committed Oct 5, 2019
1 parent 4eb9063 commit 1a188058e8819ce25d9fce50e3aeb76403da7be8
Showing with 29 additions and 27 deletions.
  1. +28 −27 renderable.lisp
  2. +1 −0 scene.lisp
@@ -34,30 +34,31 @@
(declare (optimize speed))
(let ((fc 0))
(declare (type fixnum fc))
(with-retry-restart (reset-render-loop "Reset the render loop timing, not catching up with lost frames.")
(let ((tt 0.0d0)
(dt (coerce (delta-time renderable) 'double-float))
(current-time (current-time))
(accumulator 0.0d0)
(new-time 0.0d0)
(frame-time 0.0d0))
(declare (type double-float tt dt current-time
accumulator new-time frame-time))
(unwind-protect
(with-error-logging (:trial.renderable "Error in render thread")
(loop while (thread renderable)
do (setf new-time (current-time))
(setf frame-time (- new-time current-time))
(setf current-time new-time)
(incf accumulator frame-time)
(loop while (<= dt accumulator)
do (update renderable tt dt fc)
(decf accumulator dt)
(incf tt dt))
;; FIXME: interpolate state
;; See http://gafferongames.com/game-physics/fix-your-timestep/
(setf (frame-time renderable) frame-time)
(with-simple-restart (abort "Abort the update and retry.")
(render renderable renderable)
(incf fc))))
(v:info :trial.renderable "Exiting render-loop for ~a." renderable))))))
(with-simple-restart (exit-render-loop "Exit the render loop entirely.")
(with-retry-restart (reset-render-loop "Reset the render loop timing, not catching up with lost frames.")
(let ((tt 0.0d0)
(dt (coerce (delta-time renderable) 'double-float))
(current-time (current-time))
(accumulator 0.0d0)
(new-time 0.0d0)
(frame-time 0.0d0))
(declare (type double-float tt dt current-time
accumulator new-time frame-time))
(unwind-protect
(with-error-logging (:trial.renderable "Error in render thread")
(loop while (thread renderable)
do (setf new-time (current-time))
(setf frame-time (- new-time current-time))
(setf current-time new-time)
(incf accumulator frame-time)
(loop while (<= dt accumulator)
do (update renderable tt dt fc)
(decf accumulator dt)
(incf tt dt))
;; FIXME: interpolate state
;; See http://gafferongames.com/game-physics/fix-your-timestep/
(setf (frame-time renderable) frame-time)
(with-simple-restart (abort "Abort the update and retry.")
(render renderable renderable)
(incf fc))))
(v:info :trial.renderable "Exiting render-loop for ~a." renderable)))))))
@@ -6,6 +6,7 @@

(in-package #:org.shirakumo.fraf.trial)

;; FIXME: get rid of this shit or at least find a better way to do this stuff.
(defvar *scene*)

(defclass scene (flare:scene event-loop entity)

0 comments on commit 1a18805

Please sign in to comment.
You can’t perform that action at this time.