Started initial performance testing on Lua-based keyboard controller

This commit is contained in:
Alexander Bock
2014-10-13 17:24:11 +02:00
parent 0518e8cf02
commit 8884f4cc36
5 changed files with 55 additions and 10 deletions

View File

@@ -24,6 +24,12 @@
#include <openspace/interaction/interactionhandler.h>
#include <ghoul/misc/highresclock.h>
namespace {
const std::string _loggerCat = "InteractionHandler";
}
namespace openspace {
namespace interaction {
@@ -91,24 +97,28 @@ const Camera* const InteractionHandler::camera() const {
}
void InteractionHandler::keyboardCallback(int key, int action) {
if (_keyboardController)
_keyboardController->keyPressed(KeyAction(action), Keys(key));
if (_keyboardController) {
auto start = ghoul::HighResClock::now();
_keyboardController->keyPressed(KeyAction(action), Keys(key));
auto end = ghoul::HighResClock::now();
LINFO("Keyboard timing: " << std::chrono::duration_cast<std::chrono::nanoseconds>(end - start).count() << "ns");
}
}
void InteractionHandler::mouseButtonCallback(int button, int action) {
if (_mouseController)
_mouseController->button(MouseAction(action), MouseButton(button));
_mouseController->button(MouseAction(action), MouseButton(button));
}
void InteractionHandler::mousePositionCallback(int x, int y) {
if (_mouseController)
// TODO Remap screen coordinates to [0,1]
_mouseController->move(float(x), float(y));
// TODO Remap screen coordinates to [0,1]
_mouseController->move(float(x), float(y));
}
void InteractionHandler::mouseScrollWheelCallback(int pos) {
if (_mouseController)
_mouseController->scrollWheel(float(pos));
_mouseController->scrollWheel(float(pos));
}
} // namespace interaction