diff options
Diffstat (limited to 'gaunt01/src/morphmesh.h')
| -rw-r--r-- | gaunt01/src/morphmesh.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/gaunt01/src/morphmesh.h b/gaunt01/src/morphmesh.h index 18463a8..bc22c3d 100644 --- a/gaunt01/src/morphmesh.h +++ b/gaunt01/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,23 @@ 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=-2.0,float _fadeoutTime=-2.0); + string name; map<string,track> tracks; - vector<morphWeight> evaluate(); - private: + vector<morphWeight> evaluate(float time); + void reset(); + void start(); + void stop(); + void startAt(float time); + void stopAt(float time); + void fadein(float time); + void fadeout(float time); float length; float startTime; + float stopTime; float fadeinTime; float fadeoutTime; - bool loop,active; + bool active; }; @@ -90,10 +98,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; |
