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

Source stream listings

parent 8f5f3ff3
No related branches found
No related tags found
1 merge request!23Feature/gui implements #53
......@@ -12,6 +12,8 @@
#include <nanogui/window.h>
#include <nanogui/layout.h>
#include <nanogui/imageview.h>
#include <nanogui/combobox.h>
#include <nanogui/label.h>
using ftl::config;
using std::string;
......@@ -103,6 +105,18 @@ class VirtualCameraView : public nanogui::ImageView {
}
}
bool keyboardEvent(int key, int scancode, int action, int modifiers) {
LOG(INFO) << "Key press" << key << " - " << action;
if (key == 81 || key == 83) {
// 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_);
eye_ = (q * (eye_ - centre_)) + centre_;
} else if (key == 84 || key == 82) {
float scalar = (key == 84) ? 0.99f : 1.01f;
eye_ = ((eye_ - centre_) * scalar) + centre_;
}
}
void draw(NVGcontext *ctx) {
//net_->broadcast("grab");
if (src_) {
......@@ -114,7 +128,6 @@ class VirtualCameraView : public nanogui::ImageView {
src_->grab();
src_->getRGBD(rgb, depth);
if (rgb.rows > 0) {
LOG(INFO) << "Update texture";
texture_.update(rgb);
bindImage(texture_.texture());
}
......@@ -148,7 +161,7 @@ class FTLApplication : public nanogui::Screen {
//auto &cam = sources_.emplace_back();
//cam.source = in;
auto imageWindow = new Window(this, "Source");
auto imageWindow = new Window(this, in->getURI());
imageWindow->setPosition(Eigen::Vector2i(710, 15));
imageWindow->setLayout(new GroupLayout());
imageWindow->setSize(Vector2i(400,400));
......@@ -164,6 +177,16 @@ class FTLApplication : public nanogui::Screen {
}
}
auto window = new Window(this, "Sources");
window->setLayout(new GroupLayout());
new Label(window, "Select source","sans-bold");
auto available = net->findAll<string>("list_streams");
auto select = new ComboBox(window, available);
select->setCallback([this,&available](int ix) {
LOG(INFO) << "Change source: " << ix;
});
setVisible(true);
performLayout();
}
......@@ -184,6 +207,11 @@ int main(int argc, char **argv) {
net.waitConnections();
/*auto available = net.findAll<string>("list_streams");
for (auto &a : available) {
std::cout << " -- " << a << std::endl;
}*/
try {
nanogui::init();
......
......@@ -426,7 +426,10 @@ static void run() {
ftl::rgbd::Streamer stream(config, &net);
stream.add(virt);
//stream.run();
// Also proxy all inputs
for (auto &in : inputs) {
stream.add(in.source);
}
unsigned char frameCount = 0;
bool paused = false;
......
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