summaryrefslogtreecommitdiff
path: root/pluginchooser
diff options
context:
space:
mode:
Diffstat (limited to 'pluginchooser')
-rw-r--r--pluginchooser/src/ofApp.cpp52
-rw-r--r--pluginchooser/src/pluginpanel.h22
2 files changed, 57 insertions, 17 deletions
diff --git a/pluginchooser/src/ofApp.cpp b/pluginchooser/src/ofApp.cpp
index 4c98ea7..511b7c6 100644
--- a/pluginchooser/src/ofApp.cpp
+++ b/pluginchooser/src/ofApp.cpp
@@ -13,8 +13,40 @@ void ofApp::setup(){
}
+#define STEPS_X 8
+#define STEPS_Y 6
+#define NUM_FRAMES 10
+
void ofApp::update(){
plugingui.update();
+
+ //seed the pipeline of drawing for the chaos algorithm
+/*
+ n-> delete
+ n-1 -> chaos -> n
+ n-2 -> chaos -> n-1
+
+ . . .
+
+ 1 -> chaos -> 2
+ new frame -> chaos -> 1
+*/
+
+ vector<colourPolyline> frame;
+ for (int i=ofGetWidth()/STEPS_X;i<ofGetWidth();i+=ofGetWidth()/STEPS_X){
+ for (int j=ofGetHeight()/STEPS_Y;j<ofGetHeight();j+=ofGetHeight()/STEPS_Y){
+ colourPolyline poly;
+ poly.addVertex(i,j,ofColor(255,255,255));
+ poly.addVertex(i+1,j,ofColor(255,255,255));
+ frame.push_back(poly);
+ }
+ }
+
+ drawing.push_front(frame);
+ if (drawing.size()>NUM_FRAMES){
+ drawing.pop_back();
+ }
+
}
void ofApp::draw(){
@@ -27,17 +59,19 @@ void ofApp::draw(){
testsettings.draw();
- //seed the pipeline of drawing for the chaos algorithm
-/*
- n-> delete
- n-1 -> chaos -> n
- n-2 -> chaos -> n-1
+ glLineWidth(2);
- . . .
+ for (auto i=drawing.begin();i!=drawing.end();i++){
+ for (auto j=i->begin();j!=i->end();j++){
+ for (int k=0;k<j->size();k++){
+ (*j)[k]=plugingui.calc((*j)[k]);
+ }
+ j->draw();
+ }
+ }
+
+ ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps");
- 1 -> chaos -> 2
- new frame -> chaos -> 1
-*/
}
void ofApp::exit() {
diff --git a/pluginchooser/src/pluginpanel.h b/pluginchooser/src/pluginpanel.h
index 82c7e46..02bf5d7 100644
--- a/pluginchooser/src/pluginpanel.h
+++ b/pluginchooser/src/pluginpanel.h
@@ -21,6 +21,7 @@ public:
input_index=_input_index;
params=_params;
iv.resize(_params.size()+_dimension);
+ plugin->setup ();
}
string name;
AChaosBase *plugin;
@@ -35,13 +36,13 @@ public:
params[i].val=_params[i];
}
}
- ofVec2f calc(ofVec2f point){
- iv[input_index]=point.x;
- iv[input_index+1]=point.y;
+ ofVec3f calc(ofVec3f point){
+ iv[input_index]=point.x-(ofGetWidth()/2);
+ iv[input_index+1]=point.y-(ofGetHeight()/2);
plugin->set(iv);
plugin->calc();
vector<REAL> ov=plugin->getVec();
- return ofVec2f(ov[0],ov[1]);
+ return ofVec3f(ov[0]+(ofGetWidth()/2),ov[1]+(ofGetHeight()/2),0);
}
};
@@ -157,11 +158,16 @@ class pluginPanel : public ofxPanel {
}
}
void update(){
- //push params to plugin
- plugins[index].update(params);
+
+ //push params to plugin
+ plugins[index].update(params);
+
}
- ofVec2f calc(ofVec2f point){
- return plugins[index].calc(point);
+ ofVec3f calc(ofVec3f point){
+ //if (active){
+ return plugins[index].calc(point);
+ //}
+ //return point;
}
private:
int index;