forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathframeRateMeter.I
More file actions
100 lines (91 loc) · 2.65 KB
/
frameRateMeter.I
File metadata and controls
100 lines (91 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file frameRateMeter.I
* @author drose
* @date 2003-12-23
*/
/**
* Returns the GraphicsOutput that was passed to setup_window(), or NULL if
* setup_window() has not been called.
*/
INLINE GraphicsOutput *FrameRateMeter::
get_window() const {
return _window;
}
/**
* Returns the DisplayRegion that the meter has created to render itself into
* the window to setup_window(), or NULL if setup_window() has not been
* called.
*/
INLINE DisplayRegion *FrameRateMeter::
get_display_region() const {
return _display_region;
}
/**
* Specifies the number of seconds that should elapse between updates to the
* frame rate indication. This should be reasonably slow (e.g. 0.2 to 1.0)
* so that the calculation of the frame rate text does not itself dominate the
* frame rate.
*/
INLINE void FrameRateMeter::
set_update_interval(double update_interval) {
_update_interval = update_interval;
}
/**
* Returns the number of seconds that will elapse between updates to the frame
* rate indication.
*/
INLINE double FrameRateMeter::
get_update_interval() const {
return _update_interval;
}
/**
* Sets the sprintf() pattern that is used to format the text. The string
* "%f" or some variant will be replaced with the current frame rate in frames
* per second.
*/
INLINE void FrameRateMeter::
set_text_pattern(const std::string &text_pattern) {
_text_pattern = text_pattern;
Thread *current_thread = Thread::get_current_thread();
do_update(current_thread);
}
/**
* Returns the sprintf() pattern that is used to format the text.
*/
INLINE const std::string &FrameRateMeter::
get_text_pattern() const {
return _text_pattern;
}
/**
* Sets the clock that is used to determine the frame rate. The default is
* the application's global clock (ClockObject::get_global_clock()).
*/
INLINE void FrameRateMeter::
set_clock_object(ClockObject *clock_object) {
_clock_object = clock_object;
_last_update = 0.0f;
}
/**
* Returns the clock that is used to determine the frame rate.
*/
INLINE ClockObject *FrameRateMeter::
get_clock_object() const {
return _clock_object;
}
/**
* You can call this to explicitly force the FrameRateMeter to update itself
* with the latest frame rate information. Normally, it is not necessary to
* call this explicitly.
*/
INLINE void FrameRateMeter::
update() {
Thread *current_thread = Thread::get_current_thread();
do_update(current_thread);
}