VRUT::FrameRate Class Reference

Frame rate counting class. More...

#include <framerate.h>

List of all members.

Public Member Functions

 FrameRate ()
 Class constructor.
float GetFPS () const
 Update and get frames per second.
void IncFrame ()
 Increment frame counter and update framerate.

Protected Attributes

unsigned long totalFrames
 Total frames counted.
unsigned long lastFrames
 totalFrames value from last notification
float fps
 Frames per second.
wxStopWatch stopWatch
 Stop watch for precise timing.


Detailed Description

Frame rate counting class.

Definition at line 21 of file framerate.h.


Constructor & Destructor Documentation

VRUT::FrameRate::FrameRate (  )  [inline]

Class constructor.

Definition at line 35 of file framerate.h.

00036               {
00037                      totalFrames = lastFrames = 0;
00038                      fps = 0;
00039               }


Member Function Documentation

float VRUT::FrameRate::GetFPS (  )  const [inline]

Update and get frames per second.

Definition at line 42 of file framerate.h.

00043               {
00044                      return fps;
00045               }

void VRUT::FrameRate::IncFrame (  )  [inline]

Increment frame counter and update framerate.

Definition at line 48 of file framerate.h.

00049               {
00050                      totalFrames++;
00051                      long currTime = stopWatch.Time();
00052                      if (currTime > 500)
00053                      {
00054                             fps = 1000.0f * double(totalFrames - lastFrames) / double(currTime);
00055                             if (totalFrames > 0x0fffffff)
00056                                    totalFrames = 0;
00057                             lastFrames = totalFrames;
00058                             stopWatch.Start();
00059                      }
00060               }


Member Data Documentation

unsigned long VRUT::FrameRate::totalFrames [protected]

Total frames counted.

Definition at line 25 of file framerate.h.

unsigned long VRUT::FrameRate::lastFrames [protected]

totalFrames value from last notification

Definition at line 27 of file framerate.h.

float VRUT::FrameRate::fps [protected]

Frames per second.

Definition at line 29 of file framerate.h.

wxStopWatch VRUT::FrameRate::stopWatch [protected]

Stop watch for precise timing.

Definition at line 31 of file framerate.h.


The documentation for this class was generated from the following file:

Generated on Tue Mar 10 14:41:42 2009 for VRUT by  doxygen 1.5.5