Commit 15bc72e9 authored by artificiel's avatar artificiel
Browse files

ClientsManager: crop la zone selon min/max

parent f7c423b3
......@@ -11,7 +11,7 @@ ClientsManager::ClientsManager()
ofAddListener(browser_.serviceNewE, this, &ClientsManager::service_new);
ofAddListener(browser_.serviceRemoveE, this, &ClientsManager::service_remove);
sticky_mesh_parameters_.setName("Sticky Mesh");
sticky_mesh_parameters_.setName("sticky_mesh");
sticky_mesh_parameters_.add(sticky_mesh_enable_.set("Enable", 1));
sticky_mesh_parameters_.add(sticky_mesh_input_prob_.set("Input prob", .01, 0, 1));
sticky_mesh_parameters_.add(sticky_mesh_attenuation_amnt_.set("Att amnt", .05, 0, .5));
......@@ -21,6 +21,10 @@ ClientsManager::ClientsManager()
sticky_mesh_parameters_.add(sticky_mesh_dither_amnt_.set("Dither amnt", 0, 0, .1));
sticky_mesh_parameters_.add(sticky_mesh_color_.set("Color", ofColor::yellow, ofColor::black, ofColor::white));
parameters_.add(sticky_mesh_parameters_);
parameters_.add(crop_left_.set("crop_left", 0,-10,10));
parameters_.add(crop_right_.set("crop_right", 0,-10,10));
parameters_.add(crop_top_.set("crop_top", 0,-10,10));
parameters_.add(crop_bottom_.set("crop_bottom", 0,-10,10));
sticky_mesh_.setMode(OF_PRIMITIVE_POINTS);
parameters_.setName("ClientsManager");
......@@ -115,11 +119,16 @@ bool ClientsManager::receive_mesh(ofMesh &mesh)
if (client.second->enabled_) {
ofLogNotice("ClientManager") << "merging " << client.second->client_name_ << " with " << client.second->get_mesh().getNumVertices();
for (const auto &v : client.second->get_mesh().getVertices()) {
mesh.addVertex(v);
if (ofRandom(1.0) < sticky_mesh_input_prob_) {
tmp_mesh.addVertex(v);
tmp_mesh.addColor(sticky_mesh_color_);
if (v.x > crop_left_ && v.x < crop_right_) {
mesh.addVertex(v);
if (ofRandom(1.0) < sticky_mesh_input_prob_) {
tmp_mesh.addVertex(v);
tmp_mesh.addColor(sticky_mesh_color_);
}
}
}
}
......
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