Commit 635f93a1 authored by artificiel's avatar artificiel
Browse files

ClientsManager: debut de prise en charge du stickymesh

parent 6d90ee96
......@@ -29,8 +29,8 @@ ClientsManager::ClientsManager()
gui_.setName("client editors visibiliy");
gui_.setPosition(10, ofGetHeight() - gui_.getHeight());
add_player("player 1");
add_player("player 2");
// add_player("player 1");
// add_player("player 2");
}
void ClientsManager::add_player(std::string player_name)
......@@ -96,6 +96,7 @@ bool ClientsManager::receive_mesh(ofMesh &mesh)
bool is_new = false;
for (const auto &client : client_connectors_) {
client.second->receive_mesh();
if (client.second->is_xyz_new()) {
is_new = true;
......@@ -111,20 +112,19 @@ bool ClientsManager::receive_mesh(ofMesh &mesh)
mesh.setMode(OF_PRIMITIVE_POINTS);
for (const auto &client : client_connectors_) {
if (client.second->enabled_) {
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_);
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_);
}
}
}
}
}
}
/*
for (unsigned int i = 0; i < tmp_mesh.getNumVertices(); i++) {
auto color = tmp_mesh.getColors()[i];
color.a = color.a * (1.0 - sticky_mesh_attenuation_amnt_);
......@@ -137,12 +137,10 @@ bool ClientsManager::receive_mesh(ofMesh &mesh)
if (sticky_mesh_dither_amnt_ > 0) {
auto v = tmp_mesh.getVertices()[i];
v.x =
v.x + ofRandom(-sticky_mesh_dither_amnt_, sticky_mesh_dither_amnt_);
v.y =
v.y + ofRandom(-sticky_mesh_dither_amnt_, sticky_mesh_dither_amnt_);
v.z =
v.z + ofRandom(-sticky_mesh_dither_amnt_, sticky_mesh_dither_amnt_);
v.x += ofRandom(-sticky_mesh_dither_amnt_, sticky_mesh_dither_amnt_);
v.z += ofRandom(-sticky_mesh_dither_amnt_, sticky_mesh_dither_amnt_);
v.y += ofRandom(-sticky_mesh_dither_amnt_, 0);
if (v.y < 0.0) v.y = 0.0;
sticky_mesh_.addVertex(v);
} else {
sticky_mesh_.addVertex(tmp_mesh.getVertices()[i]);
......@@ -150,9 +148,8 @@ bool ClientsManager::receive_mesh(ofMesh &mesh)
sticky_mesh_.addColor(color);
}
}
}
*/
// }
return is_new;
}
......
......@@ -38,7 +38,7 @@ class ClientsManager
ofParameter<float> sticky_mesh_dither_amnt_;
ofParameter<ofFloatColor> sticky_mesh_color_;
ofMesh sticky_mesh_;
ofVboMesh sticky_mesh_;
ofMesh registered_mesh_;
ofxPanel gui_;
map<std::string, shared_ptr<AbstractClient>> client_connectors_;
......
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