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

CloudServerApp: rename du panel GUI et autre tweaks

parent b5ca65af
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "ofxCameraSaveLoad.h" #include "ofxCameraSaveLoad.h"
#include "ofxGui.h" #include "ofxGui.h"
#include "ofxPanel.h" #include "ofxPanel.h"
#include "ofxPublishableParameterGroup.h"
#include "ofxCloudLib/Common.hpp" #include "ofxCloudLib/Common.hpp"
#include "ofxCloudLib/EuclidianExtractor.hpp" #include "ofxCloudLib/EuclidianExtractor.hpp"
...@@ -19,32 +20,37 @@ namespace ofxCloudLib ...@@ -19,32 +20,37 @@ namespace ofxCloudLib
class ofCloudServerApp : public ofBaseApp class ofCloudServerApp : public ofBaseApp
{ {
public: public:
ofCloudServerApp() : ofBaseApp(){}; // ofCloudServerApp() : ofBaseApp(){};
// ~ofCloudServerApp(){};
~ofCloudServerApp(){};
void setup() void setup()
{ {
cloudserver_will_setup();
ofSetFrameRate(60); ofSetFrameRate(60);
ofSetWindowTitle("Cloud Server"); ofSetWindowTitle("Cloud Server");
merger_.setup(); merger_.setup();
gui_.setup(); gui_.setup();
gui_.add(draw_gui_.set("<g> draw gui", true)); gui_.setName("CloudServer");
gui_.add(merger_.parameters_);
gui_.add(voxel_resolution_.set("voxel resolution", .05, 0, .5)); cloudserver_parameters_.setName("Cloudserver");
gui_.add(draw_clusters_.set("<s> draw segmentation", false)); cloudserver_parameters_.add(draw_gui_.set("<g> draw gui", true));
gui_.add(euclidian_extractor_.parameters); 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(); setup_after_merger();
gui_.add(cloudserver_parameters_);
load_gui_params_from_file(0); load_gui_params_from_file(0);
} }
void update() void update()
{ {
// merge elements are channel threaded // merge elements are channel threaded
if (merger_.update()) { if (merger_.update()) {
// std::cout << "new stuff in merger" << std::endl; // std::cout << "new stuff in merger" << std::endl;
...@@ -61,6 +67,8 @@ class ofCloudServerApp : public ofBaseApp ...@@ -61,6 +67,8 @@ class ofCloudServerApp : public ofBaseApp
void draw() void draw()
{ {
ofClear(0, 0, 0, 0); ofClear(0, 0, 0, 0);
cloudserver_will_draw();
ofPushStyle(); ofPushStyle();
{ {
final_fbo_.begin(); final_fbo_.begin();
...@@ -112,9 +120,7 @@ class ofCloudServerApp : public ofBaseApp ...@@ -112,9 +120,7 @@ class ofCloudServerApp : public ofBaseApp
void keyPressed(int key) void keyPressed(int key)
{ {
if (key == 'r') cam_.reset(); if (key == 'r') cam_.reset();
if (key == 'g') draw_gui_ = !draw_gui_; if (key == 'g') draw_gui_ = !draw_gui_;
if (key == 'r') merger_.reload_model(); if (key == 'r') merger_.reload_model();
if (key == 'q') merger_.draw_marqueurs_ = !merger_.draw_marqueurs_; if (key == 'q') merger_.draw_marqueurs_ = !merger_.draw_marqueurs_;
if (key == 'u') merger_.draw_lights_ = !merger_.draw_lights_; if (key == 'u') merger_.draw_lights_ = !merger_.draw_lights_;
...@@ -124,7 +130,7 @@ class ofCloudServerApp : public ofBaseApp ...@@ -124,7 +130,7 @@ class ofCloudServerApp : public ofBaseApp
if (key == 'c') merger_.draw_cam_colors_ = !merger_.draw_cam_colors_; if (key == 'c') merger_.draw_cam_colors_ = !merger_.draw_cam_colors_;
if (key == 's') draw_clusters_ = !draw_clusters_; 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); } void keyReleased(int key) { key_released(key); }
...@@ -138,26 +144,29 @@ class ofCloudServerApp : public ofBaseApp ...@@ -138,26 +144,29 @@ class ofCloudServerApp : public ofBaseApp
void gotMessage(ofMessage msg) {} void gotMessage(ofMessage msg) {}
void dragEvent(ofDragInfo dragInfo) {} void dragEvent(ofDragInfo dragInfo) {}
void exit() { void exit()
{
exit_before_app();
save_gui_params_to_file(0); save_gui_params_to_file(0);
} }
void save_gui_params_to_file(int i) void save_gui_params_to_file(int i)
{ {
gui_.saveToFile("presets/cloudserver_" + ofToString(i) + ".json"); 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) void load_gui_params_from_file(int i)
{ {
gui_.loadFromFile("presets/cloudserver_" + ofToString(i) + ".json"); gui_.loadFromFile("presets/cloudserver_" + ofToString(i) + ".json");
ofxLoadCamera(cam_, "cameras/current.txt"); // ofxLoadCamera(cam_, "cameras/current.txt");
save_gui_params_to_file(0); save_gui_params_to_file(0);
} }
ofxCloudLib::Merger merger_; ofxCloudLib::Merger merger_;
ofEasyCam cam_; ofEasyCam cam_;
ofxPanel gui_; ofxPanel gui_;
PublishableParameterGroup cloudserver_parameters_;
ofFbo final_fbo_; ofFbo final_fbo_;
ofParameter<bool> draw_gui_; ofParameter<bool> draw_gui_;
...@@ -169,11 +178,14 @@ class ofCloudServerApp : public ofBaseApp ...@@ -169,11 +178,14 @@ class ofCloudServerApp : public ofBaseApp
ofxCloudLib::ClusterTracker cluster_tracker_; ofxCloudLib::ClusterTracker cluster_tracker_;
ofxCloudLib::MeshToCloudConverter mesh_converter_; ofxCloudLib::MeshToCloudConverter mesh_converter_;
virtual void cloudserver_will_draw(){};
virtual void cloudserver_will_setup(){};
virtual void setup_after_merger(){}; virtual void setup_after_merger(){};
virtual void update_after_merger(){}; virtual void update_after_merger(){};
virtual void draw_in_camera_before_cloud(){}; virtual void draw_in_camera_before_cloud(){};
virtual void draw_in_camera_after_cloud(){}; virtual void draw_in_camera_after_cloud(){};
virtual void draw_after_fbo(){}; virtual void draw_after_fbo(){};
virtual void exit_before_app(){};
virtual void key_pressed(int key){}; virtual void key_pressed(int key){};
virtual void key_released(int key){}; virtual void key_released(int key){};
}; };
......
Supports Markdown
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