diff options
Diffstat (limited to 'morpher/src/morphmesh.h')
| -rw-r--r-- | morpher/src/morphmesh.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/morpher/src/morphmesh.h b/morpher/src/morphmesh.h index 18463a8..5293f9d 100644 --- a/morpher/src/morphmesh.h +++ b/morpher/src/morphmesh.h @@ -36,8 +36,9 @@ These could be parameterised on top of the rest? */ struct morphWeight { - string name; - float weight; + morphWeight(string _name="",float _weight=1.0) {name=_name;weight=_weight;} + string name; + float weight; }; struct key @@ -52,8 +53,7 @@ class track //a single morph channel. keys a single morph target within a single sequence public: track(); - string target; - multimap<float,float> keys; + map<float,float> keys; float evaluate(float time); }; @@ -67,15 +67,18 @@ class sequence //sequencer keeps track of playback time and start/stop of sequences //tracks is a map of time,value pairs - built in interpolation via multimap public: - sequence(); + sequence(string _name="",float _length=1.0,float _fadeinTime=0.0,float _fadeoutTime=0.0); + string name; map<string,track> tracks; - vector<morphWeight> evaluate(); - private: + vector<morphWeight> evaluate(float time); + void start(); + void stop(); float length; float startTime; + float stopTime; float fadeinTime; float fadeoutTime; - bool loop,active; + bool active; }; @@ -90,10 +93,11 @@ class morphmesh : public ofMesh void draw(); void draw(int target); void draw(string target); - void draw(const vector<string>& targets, const vector<float>& weights); + void draw(const vector<morphWeight>& weights); void drawAnimated(); //evaluates all active sequences via iterator and builds a collection of targets and weights for above int getNumTargets(); - map< string,sequence > sequences; //public for direct access + int getNumSequences(); + map<string,sequence> sequences; //public for direct access protected: private: map< string,vector<ofVec3f> > morphs; |
