#pragma once #include "ofMain.h" #include "ofxGui.h" #include "ofxAChaoslib.h" struct float_param { public: string name; float val; float min; float max; }; class loader { public: 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), //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; select(); } bool mouseMoved(ofMouseEventArgs & args){ if (args.x>getPosition().x&& args.x-getPosition().xgetPosition().y&& args.y-getPosition().y "< "< "< param; ofLog()<<"creating parameter: "< plugins; ofParameter active; ofParameter amount; vector > params; AChaosClifford clifford; AChaosHenon henon; };