diff options
| author | Tim Redfern <redfernt@gmail.com> | 2023-04-18 00:04:22 +0100 |
|---|---|---|
| committer | Tim Redfern <redfernt@gmail.com> | 2023-04-18 00:04:22 +0100 |
| commit | ef6ea2258969c8a1ceacf10e08085cc55ccae448 (patch) | |
| tree | 50c84381b848e6750363db58ad01408006a2467b /nextus/src | |
| parent | 6cf8d516486c0b1eb8824f6f391d7191126f768f (diff) | |
WIP
Diffstat (limited to 'nextus/src')
| -rw-r--r-- | nextus/src/main.cpp | 2 | ||||
| -rw-r--r-- | nextus/src/ofApp.h | 79 |
2 files changed, 76 insertions, 5 deletions
diff --git a/nextus/src/main.cpp b/nextus/src/main.cpp index df57f72..3eb78b7 100644 --- a/nextus/src/main.cpp +++ b/nextus/src/main.cpp @@ -10,7 +10,7 @@ int main(int argc, char *argv[]){ settings.decorated = true; - settings.setSize(1200,900); + settings.setSize(1200,700); settings.setPosition(ofVec2f(0,0)); settings.resizable = false; diff --git a/nextus/src/ofApp.h b/nextus/src/ofApp.h index dd7b57d..352c6ca 100644 --- a/nextus/src/ofApp.h +++ b/nextus/src/ofApp.h @@ -40,7 +40,7 @@ class vectorPanel { ofPopMatrix(); ofPopMatrix(); } - virtual void drawcontent(); + virtual void drawcontent() {};; private: ofVec2f size; @@ -57,16 +57,87 @@ class svgPanel: public vectorPanel{ ) : vectorPanel(_title,_size,_pos){} void load(string filename){ ofLog()<<"loading SVG "<<filename; + + ofxSVG svg; svg.load(filename); + + //normalise the SVG paths to a square format + + float scale=max(svg.getWidth(),svg.getHeight()); + + ofMatrix4x4 xform; - //gui code contains segmenters + vector <ofPath> imagepaths= svg.getPaths(); + + std::stringstream strm; + + if (imagepaths.size()){ + segmenters.clear(); + //shape_selection_durations.clear(); + for (auto& path:imagepaths){ + path.setPolyWindingMode(OF_POLY_WINDING_ODD); + + vector <ofPolyline> outlines= path.getOutline(); + for (auto& outline:outlines){ + //strm << outline.size() << "->"; + //outline.simplify(contour_simplify); + //strm << outline.size() << " "; + segmenters.push_back(colourLineSegmenter(outline,path.getStrokeColor())); + //shape_selection_durations.push_back(0.0f); + } + + //strm << " , "; + } + + //std::stringstream strom; + + //shape_selection.clear(); + //while (shape_selection.size()<(segmenters.size()*shapes_amount)){ + // int selection=(int)ofRandom(0,segmenters.size()); + // shape_selection.insert(selection); + //} + //for (auto s:shape_selection){ + // float spawn=(ofRandom(0,(float)shapes_duration)); + // shape_selection_durations[s]=spawn; + // strom << s << ":"<<spawn<<" "; + //} + //last_frame_time=ofGetElapsedTimef(); + //cout << "SVG: selected paths [ "<<strom.str() << " ]" <<std::endl; + //cout << "SVG: found " << imagepaths.size() << " paths with " << segmenters.size() << " shapes [ " << strm.str() << " ]" <<std::endl; + //select_random_shapes(shapes_duration); + } } void drawcontent(){ - svg.draw(); + for (auto shape=segmenters.begin();shape!=segmenters.end();shape++){ + shape->getPoly().draw(); + } } private: - ofxSVG svg; + //ofxFloatSlider contour_simplify; + + //svg gui + //ofxToggle shapes_randomise; + //ofxFloatSlider shapes_amount; + //ofxFloatSlider shapes_duration; + //ofxToggle use_mask; + //ofxToggle invert_mask; + + //segmenter + //ofxToggle use_segmenter; + //ofxToggle colour_segmenter; + //ofxFloatSlider segmenter_speed; + //ofxFloatSlider segmenter_length; + //ofxIntSlider segmenter_number; + + + vector <colourLineSegmenter> segmenters; + //vector <float> shape_selection_durations; + //set <int> shape_selection; + //int framecounter; + //float phase,prev_time; //to calculate phase + //float rotate_amt; + //float scale_phase,scale_amt; }; class ofApp: public ofBaseApp, public ofxMidiListener { |
