Commit 992069f0 authored by artificiel's avatar artificiel
Browse files

CloudServerApp: rename du panel GUI et autre tweaks

parent b5ca65af
......@@ -7,6 +7,7 @@
#include "ofxCameraSaveLoad.h"
#include "ofxGui.h"
#include "ofxPanel.h"
#include "ofxPublishableParameterGroup.h"
#include "ofxCloudLib/Common.hpp"
#include "ofxCloudLib/EuclidianExtractor.hpp"
......@@ -19,48 +20,55 @@ namespace ofxCloudLib
class ofCloudServerApp : public ofBaseApp
{
public:
ofCloudServerApp() : ofBaseApp(){};
~ofCloudServerApp(){};
// ofCloudServerApp() : ofBaseApp(){};
// ~ofCloudServerApp(){};
void setup()
{
cloudserver_will_setup();
ofSetFrameRate(60);
ofSetWindowTitle("Cloud Server");
merger_.setup();
gui_.setup();
gui_.add(draw_gui_.set("<g> draw gui", true));
gui_.add(merger_.parameters_);
gui_.add(voxel_resolution_.set("voxel resolution", .05, 0, .5));
gui_.add(draw_clusters_.set("<s> draw segmentation", false));
gui_.add(euclidian_extractor_.parameters);
gui_.setName("CloudServer");
cloudserver_parameters_.setName("Cloudserver");
cloudserver_parameters_.add(draw_gui_.set("<g> draw gui", true));
cloudserver_parameters_.add(merger_.parameters_);
cloudserver_parameters_.add(voxel_resolution_.set("voxel resolution", .05, 0, .5));
cloudserver_parameters_.add(draw_clusters_.set("<s> draw segmentation", false));
cloudserver_parameters_.add(euclidian_extractor_.parameters);
setup_after_merger();
gui_.add(cloudserver_parameters_);
load_gui_params_from_file(0);
}
void update()
{
// merge elements are channel threaded
if (merger_.update()) {
// std::cout << "new stuff in merger" << std::endl;
// std::cout << "new stuff in merger" << std::endl;
voxel_filter_.perform(mesh_converter_.perform(merger_.get_mesh()), voxel_resolution_);
euclidian_extractor_.send(voxel_filter_.get());
}
}
// euclidian_extractor is channel threaded
if (euclidian_extractor_.receive()) {
cluster_tracker_.track(euclidian_extractor_.get_clouds());
}
}
update_after_merger();
}
void draw()
{
ofClear(0, 0, 0, 0);
cloudserver_will_draw();
ofPushStyle();
{
final_fbo_.begin();
......@@ -98,7 +106,7 @@ class ofCloudServerApp : public ofBaseApp
}
ofPopStyle();
final_fbo_.draw(0, 0, 1920, 1080);
draw_after_fbo();
ofSetColor(255, 255, 255, 255);
......@@ -112,19 +120,17 @@ class ofCloudServerApp : public ofBaseApp
void keyPressed(int key)
{
if (key == 'r') cam_.reset();
if (key == 'g') draw_gui_ = !draw_gui_;
if (key == 'r') merger_.reload_model();
if (key == 'q') merger_.draw_marqueurs_ = !merger_.draw_marqueurs_;
if (key == 'u') merger_.draw_lights_ = !merger_.draw_lights_;
if (key == 'q') merger_.draw_marqueurs_ = !merger_.draw_marqueurs_;
if (key == 'u') merger_.draw_lights_ = !merger_.draw_lights_;
if (key == 'w') merger_.wireframe_models_ = !merger_.wireframe_models_;
if (key == 'n') merger_.draw_scene_ = !merger_.draw_scene_;
if (key == 't') merger_.draw_raw_mesh_ = !merger_.draw_raw_mesh_;
if (key == 'c') merger_.draw_cam_colors_ = !merger_.draw_cam_colors_;
if (key == 's') draw_clusters_ = !draw_clusters_;
if (key == 'n') merger_.draw_scene_ = !merger_.draw_scene_;
if (key == 't') merger_.draw_raw_mesh_ = !merger_.draw_raw_mesh_;
if (key == 'c') merger_.draw_cam_colors_ = !merger_.draw_cam_colors_;
if (key == 's') draw_clusters_ = !draw_clusters_;
key_pressed(key); // passe aux subclasses?
key_pressed(key); // passe aux subclasses? pas clair si bonne approche
}
void keyReleased(int key) { key_released(key); }
......@@ -138,26 +144,29 @@ class ofCloudServerApp : public ofBaseApp
void gotMessage(ofMessage msg) {}
void dragEvent(ofDragInfo dragInfo) {}
void exit() {
save_gui_params_to_file(0);
void exit()
{
exit_before_app();
save_gui_params_to_file(0);
}
void save_gui_params_to_file(int i)
{
gui_.saveToFile("presets/cloudserver_" + ofToString(i) + ".json");
ofxSaveCamera(cam_, "cameras/current.txt");
// ofxSaveCamera(cam_, "cameras/current.txt");
}
void load_gui_params_from_file(int i)
{
gui_.loadFromFile("presets/cloudserver_" + ofToString(i) + ".json");
ofxLoadCamera(cam_, "cameras/current.txt");
// ofxLoadCamera(cam_, "cameras/current.txt");
save_gui_params_to_file(0);
}
ofxCloudLib::Merger merger_;
ofEasyCam cam_;
ofxPanel gui_;
PublishableParameterGroup cloudserver_parameters_;
ofFbo final_fbo_;
ofParameter<bool> draw_gui_;
......@@ -169,11 +178,14 @@ class ofCloudServerApp : public ofBaseApp
ofxCloudLib::ClusterTracker cluster_tracker_;
ofxCloudLib::MeshToCloudConverter mesh_converter_;
virtual void cloudserver_will_draw(){};
virtual void cloudserver_will_setup(){};
virtual void setup_after_merger(){};
virtual void update_after_merger(){};
virtual void draw_in_camera_before_cloud(){};
virtual void draw_in_camera_after_cloud(){};
virtual void draw_after_fbo(){};
virtual void exit_before_app(){};
virtual void key_pressed(int key){};
virtual void key_released(int key){};
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment