diff options
Diffstat (limited to 'pluginchooser')
| -rw-r--r-- | pluginchooser/addons.make | 1 | ||||
| -rw-r--r-- | pluginchooser/src/main.cpp | 2 | ||||
| -rw-r--r-- | pluginchooser/src/ofApp.cpp | 17 | ||||
| -rw-r--r-- | pluginchooser/src/ofApp.h | 5 | ||||
| -rw-r--r-- | pluginchooser/src/pluginpanel.h | 80 |
5 files changed, 81 insertions, 24 deletions
diff --git a/pluginchooser/addons.make b/pluginchooser/addons.make index 1ea1f10..a95afd5 100644 --- a/pluginchooser/addons.make +++ b/pluginchooser/addons.make @@ -1,3 +1,4 @@ ofxGui ofxAChaoslib +ofxHelios diff --git a/pluginchooser/src/main.cpp b/pluginchooser/src/main.cpp index d9d6188..851c933 100644 --- a/pluginchooser/src/main.cpp +++ b/pluginchooser/src/main.cpp @@ -4,7 +4,7 @@ int main(int argc, char *argv[]){ ofGLFWWindowSettings settings; settings.decorated = true; - settings.setSize(400,400); + settings.setSize(800,600); settings.setPosition(ofVec2f(100,100)); settings.resizable = false; diff --git a/pluginchooser/src/ofApp.cpp b/pluginchooser/src/ofApp.cpp index 1980be4..4c98ea7 100644 --- a/pluginchooser/src/ofApp.cpp +++ b/pluginchooser/src/ofApp.cpp @@ -9,10 +9,12 @@ void ofApp::setup(){ plugingui.setup("chaos","",10,10); + testsettings.setup("test","",10,160); + } void ofApp::update(){ - + plugingui.update(); } void ofApp::draw(){ @@ -23,6 +25,19 @@ void ofApp::draw(){ plugingui.draw(); + testsettings.draw(); + + //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 +*/ } void ofApp::exit() { diff --git a/pluginchooser/src/ofApp.h b/pluginchooser/src/ofApp.h index 8d716c1..9a0a632 100644 --- a/pluginchooser/src/ofApp.h +++ b/pluginchooser/src/ofApp.h @@ -2,6 +2,7 @@ #include "ofMain.h" #include "pluginpanel.h" +#include "colourPolyline.h" class ofApp: public ofBaseApp{ @@ -24,4 +25,8 @@ class ofApp: public ofBaseApp{ pluginPanel plugingui; + ofxPanel testsettings; + + deque<vector<colourPolyline > > drawing; + }; diff --git a/pluginchooser/src/pluginpanel.h b/pluginchooser/src/pluginpanel.h index 5757836..82c7e46 100644 --- a/pluginchooser/src/pluginpanel.h +++ b/pluginchooser/src/pluginpanel.h @@ -14,40 +14,78 @@ struct float_param { class loader { public: - loader(string _n,AChaosBase *_plugin,vector<float_param> _params={}){ + loader(string _n,AChaosBase *_plugin,int _dimension,int _input_index,vector<float_param> _params={}){ name=_n; plugin=_plugin; + dimension=_dimension; + input_index=_input_index; params=_params; + iv.resize(_params.size()+_dimension); } string name; AChaosBase *plugin; vector<float_param> params; - REAL iv[6]; + vector<REAL> iv; + int dimension; + int input_index; + void update(vector<ofParameter<float> > _params){ + int in=input_index==0?dimension:0; + for (int i=0;i<min(_params.size(),params.size());i++,in++){ + iv[in]=_params[i]; + params[i].val=_params[i]; + } + } ofVec2f calc(ofVec2f point){ - iv[0]=point.x; - iv[1]=point.y; + iv[input_index]=point.x; + iv[input_index+1]=point.y; plugin->set(iv); plugin->calc(); - return ofVec2f(plugin->nx,plugin->ny); + vector<REAL> ov=plugin->getVec(); + return ofVec2f(ov[0],ov[1]); } }; +/* +some plugins have more or less dimensions of input/output +params are ordered differently +some allow t/dt control + +-> tag the first input dimension index +-> tag the first param index +-> tag the number of params + +*/ + class pluginPanel : public ofxPanel { public: pluginPanel(){ ofRegisterKeyEvents(this, defaultEventsPriority); plugins={ - loader("baker",&baker), - loader("clifford",&clifford,{ - {"a",0.0f,-1.0f,1.0f}, - {"b",0.0f,-1.0f,1.0f}, - {"c",0.0f,-1.0f,1.0f}, - {"d",0.0f,-1.0f,1.0f} + //loader("baker",&baker), //2,1 + loader("clifford",&clifford, + 2,4, //number of dimensions and index + { //4,2 a b c d nx ny + {"a",-1.4f,-2.0f,2.0f}, + {"b",1.6f,-2.0f,2.0f}, + {"c",1.0f,-2.0f,2.0f}, + {"d",0.7f,-2.0f,2.0f} + } + ), + //loader("collatz",&collatz), //3,1 + //loader("duffing",&duffing,{ //7,2 a b w nx ny dt t time, could be real time or magnified + // } //seems perfect + //), + //loader("ginger",&ginger), //3,2 seed nx ny maybe + loader("henon",&henon, //4,2 a b nx ny perfect + 2,2, + { + {"a",1.4f,-0.0f,2.0f}, + {"b",0.3f,-1.0f,1.0f} } ) }; index=0; - update(); + select(); } bool mouseMoved(ofMouseEventArgs & args){ if (args.x>getPosition().x&& @@ -79,7 +117,7 @@ class pluginPanel : public ofxPanel { if (index<0){ index=plugins.size()-1; } - update(); + select(); break; } case 57358:{ //right @@ -87,7 +125,7 @@ class pluginPanel : public ofxPanel { if (index==plugins.size()){ index=0; } - update(); + select(); break; } default: @@ -99,7 +137,7 @@ class pluginPanel : public ofxPanel { bool keyReleased(ofKeyEventArgs & args){ //required in order to call ofRegisterKeyEvents } - void update(){ + void select(){ ofLog()<<"selected "<<plugins[index].name; clear(); add(label.setup(plugins[index].name)); @@ -118,13 +156,12 @@ class pluginPanel : public ofxPanel { params.push_back(param); } } - void update_params(){ - for (int i=0;i<params.size();i++){ - plugins[index].iv[i+2]=params[i]; - } + void update(){ + //push params to plugin + plugins[index].update(params); } ofVec2f calc(ofVec2f point){ - return plugins[index].plugin->calc(point); + return plugins[index].calc(point); } private: int index; @@ -134,7 +171,6 @@ private: ofParameter<bool> active; ofParameter<float> amount; vector<ofParameter<float> > params; - AChaosBaker baker; AChaosClifford clifford; - + AChaosHenon henon; };
\ No newline at end of file |
