From 17275ae5aee3935920df1cab45652aa20a0b4513 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 20 Oct 2022 23:16:40 +0100 Subject: getting somewhere --- pluginchooser/src/pluginpanel.h | 81 ++++++++++++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 18 deletions(-) (limited to 'pluginchooser/src/pluginpanel.h') diff --git a/pluginchooser/src/pluginpanel.h b/pluginchooser/src/pluginpanel.h index 6e8e07d..82c7e46 100644 --- a/pluginchooser/src/pluginpanel.h +++ b/pluginchooser/src/pluginpanel.h @@ -14,32 +14,78 @@ struct float_param { class loader { public: - loader(string _n,AChaosBase *_plugin,vector _params={}){ + loader(string _n,AChaosBase *_plugin,int _dimension,int _input_index,vector _params={}){ name=_n; plugin=_plugin; + dimension=_dimension; + input_index=_input_index; params=_params; + iv.resize(_params.size()+_dimension); } string name; AChaosBase *plugin; vector params; + vector iv; + int dimension; + int input_index; + void update(vector > _params){ + int in=input_index==0?dimension:0; + for (int i=0;iset(iv); + plugin->calc(); + vector 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&& @@ -71,7 +117,7 @@ class pluginPanel : public ofxPanel { if (index<0){ index=plugins.size()-1; } - update(); + select(); break; } case 57358:{ //right @@ -79,7 +125,7 @@ class pluginPanel : public ofxPanel { if (index==plugins.size()){ index=0; } - update(); + select(); break; } default: @@ -91,7 +137,7 @@ class pluginPanel : public ofxPanel { bool keyReleased(ofKeyEventArgs & args){ //required in order to call ofRegisterKeyEvents } - void update(){ + void select(){ ofLog()<<"selected "<set(iv); - plugins[index].plugin->calc(); + return plugins[index].calc(point); } private: int index; @@ -126,6 +171,6 @@ private: ofParameter active; ofParameter amount; vector > params; - AChaosBaker baker; AChaosClifford clifford; + AChaosHenon henon; }; \ No newline at end of file -- cgit v1.2.3