From 6ddd691156f1a3a24be9045056db39e78041b8d8 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 10 Apr 2012 22:22:02 +0100 Subject: integrating --- gaunt01/src/morphmesh.h | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'gaunt01/src/morphmesh.h') 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 keys; + map 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 tracks; - vector evaluate(); - private: + vector 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& targets, const vector& weights); + void draw(const vector& 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 sequences; //public for direct access protected: private: map< string,vector > morphs; -- cgit v1.2.3