iMSTK
Interactive Medical Simulation Toolkit
imstkFpsTxtCounter.h
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #pragma once
8 
9 #include "imstkComponent.h"
10 
11 namespace imstk
12 {
13 class SceneManager;
14 class TextVisualModel;
15 class Viewer;
16 
24 {
25 public:
26  FpsTxtCounter(const std::string& name = "FpsTxtCounter");
27 
31  void visualUpdate(const double& dt);
32 
33  void setViewer(std::weak_ptr<Viewer> viewer) { m_viewer = viewer; }
34  void setSceneManager(std::weak_ptr<SceneManager> sceneManager) { m_sceneManager = sceneManager; }
35 
36 protected:
37  void init() override;
38 
39 protected:
40  std::shared_ptr<TextVisualModel> m_fpsTextVisualModel;
41  std::weak_ptr<Viewer> m_viewer;
42  std::weak_ptr<SceneManager> m_sceneManager;
43  int m_prevInfoLevel = -1;
44  double m_lastUpdate = 0.0;
45  double m_fpsUpdateDelay = 0.5;
46 };
47 } // namespace imstk
void visualUpdate(const double &dt)
Update the display of the last frames update times.
Compound Geometry.
A Behaviour represents a single component system A template is used here for UpdateInfo to keep the C...
Base class for viewer that manages render window and the renderers /// Creates backend-specific rende...
Displays visual and physics framerates through dependent TextVisualModel.
void init() override
Initialize the component, called at a later time after all component construction is complete...