summaryrefslogtreecommitdiff
path: root/morpher/src/morphmesh.h
diff options
context:
space:
mode:
Diffstat (limited to 'morpher/src/morphmesh.h')
-rw-r--r--morpher/src/morphmesh.h62
1 files changed, 49 insertions, 13 deletions
diff --git a/morpher/src/morphmesh.h b/morpher/src/morphmesh.h
index ca1231c..18463a8 100644
--- a/morpher/src/morphmesh.h
+++ b/morpher/src/morphmesh.h
@@ -34,15 +34,48 @@ behaviours are triggered by things like spotting people or avoiding the wall.
These could be parameterised on top of the rest?
*/
+struct morphWeight
+{
+ string name;
+ float weight;
+};
+struct key
+{
+ key(float _val,float _time) {value=_val;time=_time;}
+ float value;
+ float time;
+};
+
+class track
+{
+ //a single morph channel. keys a single morph target within a single sequence
+ public:
+ track();
+ string target;
+ multimap<float,float> keys;
+ float evaluate(float time);
+
+};
class sequence
{
- //stores a morph sequence: an animation cycle or transition
+ //tracks a morph sequence: an animation cycle or transition
+ //targets are named keys
+ //animation consists of time,value pairs for any number of named tracks
+ //the sequence knows the time (absolute seconds) it was started
+ //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();
- virtual ~sequence();
-
+ map<string,track> tracks;
+ vector<morphWeight> evaluate();
+ private:
+ float length;
+ float startTime;
+ float fadeinTime;
+ float fadeoutTime;
+ bool loop,active;
};
@@ -50,18 +83,21 @@ class morphmesh : public ofMesh
{
public:
morphmesh();
- morphmesh(string filename);
- virtual ~morphmesh();
- bool loadMesh(string filename);
- bool isLoaded();
- void draw();
- void draw(int target);
- void draw(const vector<string>& targets, const vector<float>& weights);
- int getNumTargets();
+ morphmesh(string filename);
+ bool loadMesh(string filename);
+ bool loadSeqs(string filename);
+ bool isLoaded();
+ void draw();
+ void draw(int target);
+ void draw(string target);
+ void draw(const vector<string>& targets, const vector<float>& 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
protected:
private:
- map< string,vector<ofVec3f> > morphs;
- bool loaded;
+ map< string,vector<ofVec3f> > morphs;
+ bool loaded;
};
#endif // MORPHMESH_H