Add a compute-fps function in render module
This commit is contained in:
parent
326fe654c2
commit
de99347555
1 changed files with 13 additions and 1 deletions
|
|
@ -21,6 +21,7 @@
|
|||
())
|
||||
|
||||
(defvar *render-thread* nil)
|
||||
(defvar *frames-per-second* 0.0)
|
||||
|
||||
(defun initialize (&optional argv)
|
||||
"Initialize the render module.
|
||||
|
|
@ -40,6 +41,16 @@ Destroy the opengl context and the related resources."
|
|||
|
||||
(defmodule stoe/engine/render :render)
|
||||
|
||||
(let ((time-counter 0.0)
|
||||
(frames-counter 0))
|
||||
(defun compute-fps (delta-time)
|
||||
(incf time-counter delta-time)
|
||||
(incf frames-counter)
|
||||
(when (> time-counter 1000000.0)
|
||||
(setf *frames-per-second* frames-counter)
|
||||
(setf time-counter 0.0)
|
||||
(setf frames-counter 0))))
|
||||
|
||||
(defun render-single-mesh (mesh transform)
|
||||
(using-program (program 'blue-shader)
|
||||
(with-locations (model-to-camera camera-to-clip) program
|
||||
|
|
@ -81,4 +92,5 @@ Destroy the opengl context and the related resources."
|
|||
(format t "Thread ~a: Running job ~a~%" (name thread) (id job))
|
||||
(job-run job thread)))
|
||||
(render-world (get-world)))
|
||||
(update-clock clock)))))
|
||||
(update-clock clock)
|
||||
(compute-fps (clock-delta clock))))))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue