MeVisLab Toolbox Reference
SoShowFPS.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef SO_SHOW_FPS_H
14 #define SO_SHOW_FPS_H
15 
16 
18 
19 #include "SoUtilsSystem.h"
20 #include "mlTimeCounter.h"
21 #include <Inventor/fields/SoSFInt32.h>
22 #include <Inventor/fields/SoSFBool.h>
23 #include <Inventor/fields/SoSFColor.h>
24 #include <Inventor/fields/SoSFFloat.h>
25 
26 //=============================================================
28 //=============================================================
29 class SOUTILS_EXPORT SoShowFPS : public SoNode {
30 
31  SO_NODE_HEADER(SoShowFPS);
32 
33 public:
34  // Constructor
36 
38  static void initClass();
39 
41  void GLRender(SoGLRenderAction *action) override;
42 
44  bool affectsState() const override { return false; }
45 
46 
47  SoSFInt32 numAverageFrames;
48 
49  SoSFBool drawRepaintCount;
50  SoSFBool drawFPS;
51 
52  SoSFInt32 fontSize;
53 
54  SoSFColor color;
55 
56  SoSFFloat alpha;
57 
58 protected:
59  ~SoShowFPS() override;
60 
61 private:
62  ml::TimeCounter _timer;
63  std::vector<float> _recentTimeSpent;
64 
65  int _repaintCount;
66 };
67 
68 #endif
#define SOUTILS_EXPORT
System dependent includes. Disables some compiler/linker warnings.
Definition: SoUtilsSystem.h:31
SoShowFPS renders the current frame rate onto the scene.
Definition: SoShowFPS.h:29
SoSFBool drawFPS
Definition: SoShowFPS.h:50
SoSFInt32 fontSize
Definition: SoShowFPS.h:52
static void initClass()
inventor runtime system
void GLRender(SoGLRenderAction *action) override
derived render method that renders the FPS
SoSFFloat alpha
Definition: SoShowFPS.h:56
~SoShowFPS() override
SoSFBool drawRepaintCount
Definition: SoShowFPS.h:49
SoSFInt32 numAverageFrames
Definition: SoShowFPS.h:47
SoSFColor color
Definition: SoShowFPS.h:54
bool affectsState() const override
this node does not affect the state, so return false!
Definition: SoShowFPS.h:44
Class to measure precise time intervals.
Definition: mlTimeCounter.h:26