Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
iMSTK
iMSTK
Commits
51c5d7bd
Commit
51c5d7bd
authored
Jun 10, 2019
by
Sreekanth Arikatla
Browse files
ENH: Display fps on the screen along with the render fps
parent
fa7d2f16
Changes
3
Show whitespace changes
Inline
Side-by-side
Source/Scene/imstkScene.h
View file @
51c5d7bd
...
...
@@ -166,6 +166,12 @@ public:
///
void
reset
();
///
/// \brief Set/Get the FPS
///
void
setFPS
(
const
size_t
fps
)
{
m_fps
=
fps
;
}
size_t
getFPS
()
{
return
m_fps
;
}
protected:
std
::
string
m_name
;
///> Name of the scene
...
...
@@ -178,6 +184,8 @@ protected:
std
::
vector
<
std
::
shared_ptr
<
SolverBase
>>
m_solvers
;
///> List of non-linear solvers
std
::
vector
<
std
::
shared_ptr
<
SceneObjectControllerBase
>>
m_objectControllers
;
///> List of controllers
size_t
m_fps
=
0
;
bool
m_isInitialized
=
false
;
};
}
// imstk
...
...
Source/SimulationManager/VTKRenderer/imstkVTKInteractorStyle.cpp
View file @
51c5d7bd
...
...
@@ -83,18 +83,29 @@ VTKInteractorStyle::OnTimer()
// Update framerate value display
auto
now
=
std
::
chrono
::
high_resolution_clock
::
now
();
double
fps
=
1e6
/
(
double
)
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
now
-
m_pre
).
count
();
double
fps
=
1e6
/
(
double
)
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
now
-
m_pre
).
count
();
fps
=
0.1
*
fps
+
0.9
*
m_lastFps
;
m_lastFps
=
fps
;
int
t
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
now
-
m_lastFpsUpdate
).
count
();
if
(
t
>
10
0
)
//wait
10
0ms before updating displayed value
if
(
t
>
25
0
)
//wait
25
0ms before updating displayed value
{
std
::
string
fpsStr
=
std
::
to_string
((
int
)
fps
)
+
" fps"
;
m_fpsActor
->
SetInput
(
fpsStr
.
c_str
());
std
::
string
fpsVisualStr
=
"V: "
+
std
::
to_string
((
int
)
fps
);
std
::
string
fpsPhysicalStr
;
if
(
m_simManager
->
getStatus
()
!=
SimulationStatus
::
PAUSED
)
{
fpsPhysicalStr
=
"P: "
+
std
::
to_string
((
int
)
m_simManager
->
getActiveScene
()
->
getFPS
());
}
else
{
fpsPhysicalStr
=
"P: PAUSED"
;
}
m_fpsActor
->
SetInput
((
fpsVisualStr
+
std
::
string
(
" | "
)
+
fpsPhysicalStr
).
c_str
());
m_lastFpsUpdate
=
now
;
}
m_pre
=
now
;
// Render
this
->
Interactor
->
Render
();
m_post
=
std
::
chrono
::
high_resolution_clock
::
now
();
...
...
Source/SimulationManager/imstkSceneManager.cpp
View file @
51c5d7bd
...
...
@@ -180,6 +180,8 @@ SceneManager::runModule()
}
}
}
m_scene
->
setFPS
((
size_t
)(
1.
/
wwt
.
getTimeElapsed
(
StopWatch
::
TimeUnitType
::
seconds
)));
}
void
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment