add visualization of cpu time usage (set SHOW_DEBUG_INFO = true)
parent
a8fafbdaec
commit
762fae3da4
|
@ -166,7 +166,9 @@ void Engine::printDebugInfo() const {
|
||||||
|
|
||||||
|
|
||||||
screen->drawText(
|
screen->drawText(
|
||||||
timerName.substr(2, timerName.size()) + " (" + std::to_string((int) (100 * timer.elapsedMilliseconds() / totalTime)) + "%)",
|
timerName.substr(2, timerName.size()) + ":\t" +
|
||||||
|
std::to_string((int) (1.0 / timer.elapsedMilliseconds())) + " / s \t (" +
|
||||||
|
std::to_string((int) (100 * timer.elapsedMilliseconds() / totalTime)) + "%)",
|
||||||
Vec2D{xPos + 10, yPos + height * i + 5}, 30,
|
Vec2D{xPos + 10, yPos + height * i + 5}, 30,
|
||||||
sf::Color(0, 0, 0, 100));
|
sf::Color(0, 0, 0, 100));
|
||||||
|
|
||||||
|
@ -184,7 +186,8 @@ void Engine::printDebugInfo() const {
|
||||||
0, 100});
|
0, 100});
|
||||||
|
|
||||||
|
|
||||||
screen->drawText("other (" + std::to_string((int) (100 * (totalTime - timeSum) / totalTime)) + "%)",
|
screen->drawText("other:\t" + std::to_string((int) (1.0 / (totalTime - timeSum))) + " / s \t (" +
|
||||||
|
std::to_string((int) (100 * (totalTime - timeSum) / totalTime)) + "%)",
|
||||||
Vec2D{xPos + 10, yPos + height * i + 5}, 30,
|
Vec2D{xPos + 10, yPos + height * i + 5}, 30,
|
||||||
sf::Color(0, 0, 0, 100));
|
sf::Color(0, 0, 0, 100));
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ double Vec3D::abs() const {
|
||||||
Vec3D Vec3D::normalized() const {
|
Vec3D Vec3D::normalized() const {
|
||||||
double vecAbs = abs();
|
double vecAbs = abs();
|
||||||
if (vecAbs > Consts::EPS) {
|
if (vecAbs > Consts::EPS) {
|
||||||
return Vec3D(*this) / abs();
|
return Vec3D(*this) / vecAbs;
|
||||||
} else {
|
} else {
|
||||||
return Vec3D(1);
|
return Vec3D(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ private:
|
||||||
t * Matrix4x4::Scale(Vec3D{1, 1, 1} + (_scalingValue - Vec3D{1, 1, 1}) * progress()));
|
t * Matrix4x4::Scale(Vec3D{1, 1, 1} + (_scalingValue - Vec3D{1, 1, 1}) * progress()));
|
||||||
}
|
}
|
||||||
_object.lock()->setTriangles(newTriangles);
|
_object.lock()->setTriangles(newTriangles);
|
||||||
return updateState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue