summaryrefslogtreecommitdiff
path: root/nextus/src/vectorPlugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'nextus/src/vectorPlugin.h')
-rw-r--r--nextus/src/vectorPlugin.h75
1 files changed, 66 insertions, 9 deletions
diff --git a/nextus/src/vectorPlugin.h b/nextus/src/vectorPlugin.h
index d71b8fa..e20be8f 100644
--- a/nextus/src/vectorPlugin.h
+++ b/nextus/src/vectorPlugin.h
@@ -31,13 +31,14 @@ class vectorPanel {
ofPushMatrix();
ofTranslate(size/2);
ofScale(DISPLAYSIZE.x/2.0f);
- vector<colourPolyline> lines=getLines();
+ vector<colourPolyline> lines=getOutput();
for (auto& line:lines){
line.draw();
}
ofPopMatrix();
ofPopMatrix();
}
+ vector<colourPolyline> getOutput() {return getLines();};
virtual vector<colourPolyline> getLines() {};
virtual void update() {};
@@ -62,13 +63,64 @@ class defaultPanel: public vectorPanel{
void update(){};
};
-class svgPanel: public vectorPanel{
+class transformPanel: public vectorPanel{
+ //a base class which supports transformation
public:
- svgPanel(
+ transformPanel(
string _title="",
ofVec2f _size=DISPLAYSIZE,
ofVec2f _pos=ofPoint(5,5)
) : vectorPanel(_title,_size,_pos){
+ origin=ofPoint(0,0);
+ rotation=0;
+ panel.add(use_rotate.set("rotate",false));
+ panel.add(rotation_delta.set("rotation",0.1,-2.0,2.0));
+ }
+ void update(){
+ timedelta=ofGetElapsedTimef()-last_frame_time;
+ last_frame_time=ofGetElapsedTimef();
+ if (use_rotate) rotation+=rotation_delta*timedelta;
+ };
+ vector<colourPolyline> getOutput(){
+ vector<colourPolyline> lines=getLines();
+ if (use_rotate){
+ ofMatrix4x4 rm = ofMatrix4x4::newIdentityMatrix();
+ rm.rotateRad(rotation,0,0,1);
+
+ //if (use_scale){
+ // rm.scale(scale_amt,scale_amt,scale_amt);
+ //}
+ //rm.translate(outputWindowSize.x/2,outputWindowSize.y/2,0);
+ vector<colourPolyline> transformedLines;
+ for (auto& line:lines){
+ transformedLines.push_back(lineTransformer::polyLineTransform(rm,line));
+ }
+ return transformedLines;
+ }
+ return lines;
+ };
+ protected:
+ ofPoint origin;
+ float rotation;
+ ofParameter<bool> use_rotate;
+ ofParameter<float> rotation_delta;
+ float last_frame_time, timedelta;
+};
+
+/*
+next- enable transform offsets
+crop for display
+transformers
+easy midi
+*/
+
+class svgPanel: public transformPanel{
+ public:
+ svgPanel(
+ string _title="",
+ ofVec2f _size=DISPLAYSIZE,
+ ofVec2f _pos=ofPoint(5,5)
+ ) : transformPanel(_title,_size,_pos){
panel.add(shapeslabel.setup("SHAPES",""));
panel.add(shapes_randomise.set("randomise",false));
//panel.add(shapes_generate.setup("generate"));
@@ -88,12 +140,9 @@ class svgPanel: public vectorPanel{
vector<colourPolyline> getAllLines();
vector<colourPolyline> getLines();
void update(){
- timedelta=ofGetElapsedTimef()-last_frame_time;
- last_frame_time=ofGetElapsedTimef();
+ transformPanel::update();
phase=fmod(phase+(timedelta*segmenter_speed),1);
while(phase<0) phase+=1.0f;
- //what's the issue with segmenter in reverse
- ofLog()<<"phase: "<<phase;
}
private:
@@ -126,5 +175,13 @@ class svgPanel: public vectorPanel{
//float rotate_amt;
//float scale_phase,scale_amt;
- float last_frame_time, timedelta;
-}; \ No newline at end of file
+};
+
+class textPanel: public vectorPanel{
+ public:
+ textPanel(
+ string _title="",
+ ofVec2f _size=DISPLAYSIZE,
+ ofVec2f _pos=ofPoint(5,5)
+ ) : vectorPanel(_title,_size,_pos){}
+} \ No newline at end of file