goat3dgfx

diff src/xform_node.h @ 21:7c593721547f

integrated support for the multiple animation system of libanim
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 27 Dec 2013 11:59:32 +0200
parents 7d6b667821cf
children 92bfb0206969
line diff
     1.1 --- a/src/xform_node.h	Sun Dec 08 03:00:49 2013 +0200
     1.2 +++ b/src/xform_node.h	Fri Dec 27 11:59:32 2013 +0200
     1.3 @@ -1,6 +1,3 @@
     1.4 -/*
     1.5 -TODO: add multiple animations per node in libanim (i.e. multiple sets of tracks)
     1.6 -*/
     1.7  #ifndef XFORM_NODE_H_
     1.8  #define XFORM_NODE_H_
     1.9  
    1.10 @@ -18,7 +15,7 @@
    1.11  enum Interp { INTERP_STEP, INTERP_LINEAR, INTERP_CUBIC };
    1.12  enum Extrap { EXTRAP_EXTEND, EXTRAP_CLAMP, EXTRAP_REPEAT };
    1.13  
    1.14 -// XXX all time arguments are milliseconds
    1.15 +// NOTE: all time arguments are milliseconds
    1.16  
    1.17  class XFormNode {
    1.18  private:
    1.19 @@ -55,6 +52,24 @@
    1.20  	const XFormNode *get_child(int idx) const;
    1.21  
    1.22  
    1.23 +	void use_animation(int idx);
    1.24 +	void use_animation(const char *name);
    1.25 +	void use_animation(int aidx, int bidx, float t);
    1.26 +	void use_animation(const char *aname, const char *bname, float t);
    1.27 +
    1.28 +	int get_active_animation_index(int which = 0) const;
    1.29 +	float get_active_animation_mix() const;
    1.30 +
    1.31 +	int get_animation_count() const;
    1.32 +
    1.33 +	// add a new empty animation slot (recursive)
    1.34 +	void add_animation(const char *name = 0);
    1.35 +
    1.36 +	// set/get the current animation name (set is recursive)
    1.37 +	void set_animation_name(const char *name);
    1.38 +	const char *get_animation_name() const;
    1.39 +
    1.40 +
    1.41  	void set_position(const Vector3 &pos, long tmsec = 0);
    1.42  	Vector3 get_node_position(long tmsec = 0) const;
    1.43