diff options
| -rw-r--r-- | gui/bin/data/settings.xml | 4 | ||||
| -rw-r--r-- | gui/src/ofApp.cpp | 95 | ||||
| -rw-r--r-- | gui/src/ofApp.h | 2 |
3 files changed, 52 insertions, 49 deletions
diff --git a/gui/bin/data/settings.xml b/gui/bin/data/settings.xml index ced1c18..4e3523f 100644 --- a/gui/bin/data/settings.xml +++ b/gui/bin/data/settings.xml @@ -18,8 +18,8 @@ </p3> </WARP> <POSITION> - <X>-3.514287949</X> - <Y>-202.628555298</Y> + <X>-17.628570557</X> + <Y>-187.371429443</Y> </POSITION> <SCALE>2.863990068</SCALE> <laser> diff --git a/gui/src/ofApp.cpp b/gui/src/ofApp.cpp index 689048c..9efdead 100644 --- a/gui/src/ofApp.cpp +++ b/gui/src/ofApp.cpp @@ -759,48 +759,50 @@ void ofApp::drawOutput(ofEventArgs & args){ break; } case SVG_outlines:{ - if (shapes_randomise){ - //if (framecounter==0){ - // select_random_shapes(); - // framecounter=shapes_duration; - //} - select_random_shapes(shapes_duration); - for (auto s:shape_selection){ - if (use_segmenter){ - auto segments=segmenters[s].getSegments(segmenter_number,segmenter_length,phase); - for (auto segment=segments.begin();segment!=segments.end();segment++){ - //polyOutput.push_back(colourPolyline(*segment,ofColor(laser_R,laser_G,laser_B))); - polyOutput.push_back(*segment); + if (!use_onset||onset_frame<onset_duration||shapes_randomise){ + if (shapes_randomise){ + //if (framecounter==0){ + // select_random_shapes(); + // framecounter=shapes_duration; + //} + select_random_shapes(shapes_duration,!use_onset||onset_frame<onset_duration); + for (auto s:shape_selection){ + if (use_segmenter){ + auto segments=segmenters[s].getSegments(segmenter_number,segmenter_length,phase); + for (auto segment=segments.begin();segment!=segments.end();segment++){ + //polyOutput.push_back(colourPolyline(*segment,ofColor(laser_R,laser_G,laser_B))); + polyOutput.push_back(*segment); + } + } + else { + //polyOutput.push_back(colourPolyline(segmenters[s].getPoly(),ofColor(laser_R,laser_G,laser_B))); + polyOutput.push_back(segmenters[s].getPoly()); } } - else { - //polyOutput.push_back(colourPolyline(segmenters[s].getPoly(),ofColor(laser_R,laser_G,laser_B))); - polyOutput.push_back(segmenters[s].getPoly()); - } + framecounter--; } - framecounter--; - } - else { - for (auto shape=segmenters.begin();shape!=segmenters.end();shape++){ - if (use_segmenter){ - auto segments=shape->getSegments(segmenter_number,segmenter_length,phase); - for (auto segment=segments.begin();segment!=segments.end();segment++){ - //polyOutput.push_back(colourPolyline(*segment,ofColor(laser_R,laser_G,laser_B))); - polyOutput.push_back(*segment); + else { + for (auto shape=segmenters.begin();shape!=segmenters.end();shape++){ + if (use_segmenter){ + auto segments=shape->getSegments(segmenter_number,segmenter_length,phase); + for (auto segment=segments.begin();segment!=segments.end();segment++){ + //polyOutput.push_back(colourPolyline(*segment,ofColor(laser_R,laser_G,laser_B))); + polyOutput.push_back(*segment); + } + } + else { + //polyOutput.push_back(colourPolyline(shape->getPoly(),ofColor(laser_R,laser_G,laser_B))); + polyOutput.push_back(shape->getPoly()); } - } - else { - //polyOutput.push_back(colourPolyline(shape->getPoly(),ofColor(laser_R,laser_G,laser_B))); - polyOutput.push_back(shape->getPoly()); } } - } - if (contour_useColour){ - vector<colourPolyline> newPolys; - for (auto p: polyOutput){ - newPolys.push_back(colourPolyline((ofPolyline)p,ofColor(laser_R,laser_G,laser_B))) ; + if (contour_useColour){ + vector<colourPolyline> newPolys; + for (auto p: polyOutput){ + newPolys.push_back(colourPolyline((ofPolyline)p,ofColor(laser_R,laser_G,laser_B))) ; + } + polyOutput=newPolys; } - polyOutput=newPolys; } break; } @@ -1085,7 +1087,7 @@ void ofApp::windowResized(int w, int h){ float last_frame_time=0.0f; -void ofApp::select_random_shapes(float duration){ +void ofApp::select_random_shapes(float duration,bool generate){ float timedelta=ofGetElapsedTimef()-last_frame_time; last_frame_time=ofGetElapsedTimef(); //track how long each shape has been selected @@ -1108,18 +1110,19 @@ void ofApp::select_random_shapes(float duration){ } //cout << timedelta <<": decay selection: "<<shape_selection.size()<<" shapes (" << strom.str() <<") \n"; + if (generate){ - - while (shape_selection.size()<(segmenters.size()*shapes_amount)){ - int selection=rand()%segmenters.size(); - if (shape_selection.find(selection)==shape_selection.end()){ - shape_selection_durations[selection]=duration+ofRandom(1.0f); - shape_selection.insert(selection); + while (shape_selection.size()<(segmenters.size()*shapes_amount)){ + int selection=rand()%segmenters.size(); + if (shape_selection.find(selection)==shape_selection.end()){ + shape_selection_durations[selection]=duration+ofRandom(1.0f); + shape_selection.insert(selection); + } + } + std::stringstream strm; + for (auto& s:shape_selection){ + strm << s <<":"<<shape_selection_durations[s]<<" "; } - } - std::stringstream strm; - for (auto& s:shape_selection){ - strm << s <<":"<<shape_selection_durations[s]<<" "; } //cout << "random selection: "<<shape_selection.size()<<" shapes (" << strm.str() <<") \n"; } diff --git a/gui/src/ofApp.h b/gui/src/ofApp.h index 838b7f8..e8c2640 100644 --- a/gui/src/ofApp.h +++ b/gui/src/ofApp.h @@ -89,7 +89,7 @@ class ofApp: public ofBaseApp, public ofxMidiListener { void outputMouseReleased(ofMouseEventArgs & args); void outputWindowResized(ofResizeEventArgs &resizeargs); - void select_random_shapes(float duration); + void select_random_shapes(float duration,bool generate); void default_settings(); void save_settings(); |
