Commit fd379621 authored by alexandre burton's avatar alexandre burton
Browse files

CropFilter: divers ajouts/corrections en fonction de comportement soundscape

parent 1fd979a9
......@@ -66,7 +66,7 @@ class CropFilter
index_ = i;
result_.reset(new pcl::PointCloud<pcl::PointXYZ>);
color_.setHsb((i/16.0)*255, 255, 128, 100);
color_.setHsb((i / 16.0) * 255, 255, 128, 100);
}
void setup()
......@@ -92,9 +92,9 @@ class CropFilter
ofDrawBox(parameters_.pos_, size.x, size.y, size.z);
ofFill();
auto c = color_;
c.a = ofMap(get_fill(), 0, .25, 10, 50, true);
auto c = color_;
c.a = ofMap(get_fill(), 0, .25, 10, 50, true);
if (parameters_.count_ > 0) {
glm::vec3 fillsize = parameters_.dim_.get() * glm::vec3(1, get_fill(), 1);
glm::vec3 fillpos = parameters_.pos_.get() - glm::vec3(0, (size.y * (1.0 - get_fill())) / 2, 0);
......@@ -107,6 +107,12 @@ class CropFilter
ofSetColor(255, 0, 0, ofMap(parameters_.rms_, 0, .25, 10, 150, true));
ofDrawBox(fillpos, fillsize.x, fillsize.y, fillsize.z);
}
if (parameters_.state_) {
ofSetColor(color_);
ofDrawBox(parameters_.pos_, size.x, .01, size.z);
}
} else {
ofSetColor(200, 200, 200, 128);
ofNoFill();
......@@ -144,13 +150,12 @@ class CropFilter
parameters_.height_ * (1.0 - parameters_.slide_down_);
}
if (!parameters_.state_) {
if (get_fill() > parameters_.thresh_ + .05) {
if (get_fill() > parameters_.thresh_ + .03) {
parameters_.newstate_ = true;
}
} else {
if (get_fill() < parameters_.thresh_ - .05) {
if (get_fill() < parameters_.thresh_ - .03) {
parameters_.newstate_ = false;
parameters_.height_ = 0;
}
......@@ -179,6 +184,7 @@ class CropFilter
glm::vec3 min_, max_;
ofColor color_;
size_t index_;
float distance_ = 10000;
// char * rgbw_[4];
};
......@@ -215,8 +221,8 @@ class FilterManager
sender_ = sender;
rgbw_.allocate(num_filters * 4, 1, OF_IMAGE_COLOR_ALPHA);
my_artnet_ip_= "192.168.94.62";
setup_artnet();
my_artnet_ip_ = "10.6.41.105";
setup_artnet();
parameters_.setName("FilterManager");
parameters_.add(enabled_.set("enabled", true));
......@@ -227,15 +233,17 @@ class FilterManager
}
}
void setup_artnet() {
void setup_artnet()
{
std::cout << "setting up artnet on " << my_artnet_ip_ << std::endl;
if (artnet_ != nullptr) {
std::cout << "...(stopping previous instance)..." << my_artnet_ip_ << std::endl;
artnet_->waitForThread();
artnet_.release();
}
artnet_=make_unique<ofxArtnet>();
artnet_->setup(my_artnet_ip_.c_str(),0,0);
// if (artnet_ != nullptr) {
// std::cout << "...(stopping previous instance)..." << my_artnet_ip_ << std::endl;
// artnet_->waitForThread();
// artnet_.release();
// }
artnet_ = make_unique<ofxArtnet>();
artnet_->setup(my_artnet_ip_.c_str(), 0, 0);
}
void update(pcl::PointCloud<pcl::PointXYZ>::Ptr input_cloud)
......@@ -253,6 +261,11 @@ class FilterManager
m2.addIntArg(filter->parameters_.newstate_);
sender_->sendMessage(m2);
filter->parameters_.state_ = filter->parameters_.newstate_;
// // exception hard-codee: si une zone ext est released avant la int, releasera la int
// if (filter->index_ > =8 && filter->parameters_.state_ == false) {
// filters_[filter->index_-1].newstate_ = false;
// }
}
// m.addIntArg(filter->parameters_.count_);
......@@ -275,9 +288,9 @@ class FilterManager
rgbw_.getPixels().getData()[filter->index_ * 4 + 3] = int(ofMap(amp, 0, 1, 0, 255, true));
}
}
if (artnet_->sendDmx("192.168.94.244", 0, 0, rgbw_.getPixels().getData(), 16) == -3) {
setup_artnet();
}
// if (artnet_->sendDmx("192.168.94.244", 0, 0, rgbw_.getPixels().getData(), 16) == -3) {
// setup_artnet();
// }
sender_->sendMessage(m);
sender_->sendMessage(m_height);
......@@ -292,7 +305,8 @@ class FilterManager
filter->parameters_.pos_ = glm::vec3(m.getArgAsFloat(1), m.getArgAsFloat(2), m.getArgAsFloat(3));
filter->parameters_.dim_ = glm::vec3(m.getArgAsFloat(4), m.getArgAsFloat(5), m.getArgAsFloat(6));
filter->parameters_.slide_down_ = m.getArgAsFloat(7);
filter->parameters_.capacity_ = m.getArgAsInt(8);
filter->parameters_.thresh_ = m.getArgAsFloat(8);
filter->parameters_.capacity_ = m.getArgAsInt(9);
}
} else if (m.getAddress() == "/filter_manager/filter/enable") {
int filter_num = m.getArgAsInt(0);
......
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