Skip to content
Snippets Groups Projects
Commit d26a07cb authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Remove recon disp, fix key controls

parent a766c238
No related branches found
No related tags found
No related merge requests found
......@@ -128,6 +128,7 @@ class FTLApplication : public nanogui::Screen {
lookPoint_ = Eigen::Vector3f(0.0f,0.0f,-4.0f);
lerpSpeed_ = 0.4f;
depth_ = false;
ftime_ = (float)glfwGetTime();
mShader.init("RGBDShader", defaultImageViewVertexShader,
defaultImageViewFragmentShader);
......@@ -175,14 +176,14 @@ class FTLApplication : public nanogui::Screen {
if (Screen::keyboardEvent(key, scancode, action, modifiers)) {
return true;
} else {
LOG(INFO) << "Key press" << key << " - " << action;
if (key == 81 || key == 83) {
LOG(INFO) << "Key press " << key << " - " << action;
if (key == 263 || key == 262) {
// TODO Should rotate around lookAt object, but requires correct depth
Eigen::Quaternion<float> q; q = Eigen::AngleAxis<float>((key == 81) ? 0.01f : -0.01f, up_);
Eigen::Quaternion<float> q; q = Eigen::AngleAxis<float>((key == 262) ? 0.01f : -0.01f, up_);
eye_ = (q * (eye_ - centre_)) + centre_;
return true;
} else if (key == 84 || key == 82) {
float scalar = (key == 84) ? 0.99f : 1.01f;
} else if (key == 264 || key == 265) {
float scalar = (key == 264) ? 0.99f : 1.01f;
eye_ = ((eye_ - centre_) * scalar) + centre_;
return true;
}
......@@ -196,9 +197,13 @@ class FTLApplication : public nanogui::Screen {
auto src_ = swindow_->getSource();
Vector2f imageSize(0, 0);
float now = (float)glfwGetTime();
float delta = now - ftime_;
ftime_ = now;
if (src_) {
cv::Mat rgb, depth;
centre_ += (lookPoint_ - centre_) * (lerpSpeed_ * 0.1f);
centre_ += (lookPoint_ - centre_) * (lerpSpeed_ * delta);
Eigen::Matrix4f viewPose = lookAt<float>(eye_,centre_,up_).inverse();
src_->setPose(viewPose);
......@@ -267,6 +272,7 @@ class FTLApplication : public nanogui::Screen {
Eigen::Vector3f lookPoint_;
float lerpSpeed_;
bool depth_;
float ftime_;
};
int main(int argc, char **argv) {
......
......@@ -156,7 +156,7 @@ static void run(ftl::Configurable *root) {
LOG(INFO) << "Using sources:";
for (auto &input : inputs) { LOG(INFO) << " " + (string) input.source->getURI(); }
ftl::rgbd::Display *display = ftl::create<ftl::rgbd::Display>(root, "display");
//ftl::rgbd::Display *display = ftl::create<ftl::rgbd::Display>(root, "display");
ftl::rgbd::Source *virt = ftl::create<ftl::rgbd::Source>(root, "virtual", net);
auto virtimpl = new ftl::rgbd::VirtualSource(virt);
......@@ -164,7 +164,7 @@ static void run(ftl::Configurable *root) {
ftl::voxhash::SceneRep *scene = ftl::create<ftl::voxhash::SceneRep>(root, "voxelhash");
virtimpl->setScene(scene);
display->setSource(virt);
//display->setSource(virt);
ftl::rgbd::Streamer *stream = ftl::create<ftl::rgbd::Streamer>(root, "stream", net);
stream->add(virt);
......@@ -177,12 +177,12 @@ static void run(ftl::Configurable *root) {
bool paused = false;
// Keyboard camera controls
display->onKey([&paused](int key) {
if (key == 32) paused = !paused;
});
//display->onKey([&paused](int key) {
// if (key == 32) paused = !paused;
//});
int active = inputs.size();
while (ftl::running && display->active()) {
while (ftl::running) {
if (active == 0) {
LOG(INFO) << "Waiting for sources...";
sleep_for(milliseconds(1000));
......@@ -203,7 +203,6 @@ static void run(ftl::Configurable *root) {
auto &cam = inputs[i];
auto in = inputs[i].source;
if (cam.params.m_imageWidth == 0) {
LOG(INFO) << "SETTING UP CAM PARAMS: " << in->parameters().fx;
cam.params.fx = in->parameters().fx;
cam.params.fy = in->parameters().fy;
cam.params.mx = -in->parameters().cx;
......@@ -246,7 +245,7 @@ static void run(ftl::Configurable *root) {
frameCount++;
stream->poll();
display->update();
//display->update();
//sleep_for(milliseconds(10));
}
}
......
......@@ -89,7 +89,7 @@ void NetSource::setPose(const Eigen::Matrix4f &pose) {
} catch (...) {
}
Source::setPose(pose);
//Source::setPose(pose);
}
void NetSource::_updateURI() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment