summaryrefslogtreecommitdiff
path: root/nextus/src/ofApp.h
diff options
context:
space:
mode:
Diffstat (limited to 'nextus/src/ofApp.h')
-rw-r--r--nextus/src/ofApp.h79
1 files changed, 75 insertions, 4 deletions
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 {