diff options
| author | Tim Redfern <tim@getdrop.com> | 2018-12-02 22:15:09 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@getdrop.com> | 2018-12-02 22:15:09 +0000 |
| commit | d59dff2cc79b63962009786cc19223fa5a197757 (patch) | |
| tree | 41b7ed2155d46967e7fd44f892c8edead636facc /gui/src/ofApp.cpp | |
| parent | 80863dd23b2c3e2ae1b26a366e1adc956911c747 (diff) | |
other voices
Diffstat (limited to 'gui/src/ofApp.cpp')
| -rw-r--r-- | gui/src/ofApp.cpp | 95 |
1 files changed, 49 insertions, 46 deletions
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"; } |
