goat3d

diff src/xform_node.h @ 48:9ef9de80649c

implemented animation track XML saving
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 29 Dec 2013 06:01:59 +0200
parents 498ca7ac7047
children dad392c710df
line diff
     1.1 --- a/src/xform_node.h	Sat Dec 28 06:47:39 2013 +0200
     1.2 +++ b/src/xform_node.h	Sun Dec 29 06:01:59 2013 +0200
     1.3 @@ -33,6 +33,8 @@
     1.4  	XFormNode &operator =(const XFormNode &node) { return *this; }
     1.5  
     1.6  public:
     1.7 +	enum { POSITION_TRACK, ROTATION_TRACK, SCALING_TRACK };
     1.8 +
     1.9  	XFormNode();
    1.10  	virtual ~XFormNode();
    1.11  
    1.12 @@ -76,6 +78,27 @@
    1.13  	virtual void set_animation_name(const char *name);
    1.14  	virtual const char *get_animation_name() const;
    1.15  
    1.16 +	// raw keyframe retrieval without interpolation
    1.17 +	// NOTE: trackid parameters correspond to the values of the unnamed enumeration at the top
    1.18 +
    1.19 +	virtual int get_key_count(int trackid) const;
    1.20 +	virtual int get_position_key_count() const;
    1.21 +	virtual int get_rotation_key_count() const;
    1.22 +	virtual int get_scaling_key_count() const;
    1.23 +
    1.24 +	virtual long get_key_time(int trackid, int idx) const;
    1.25 +	virtual long get_position_key_time(int idx) const;
    1.26 +	virtual long get_rotation_key_time(int idx) const;
    1.27 +	virtual long get_scaling_key_time(int idx) const;
    1.28 +
    1.29 +	/* writes the key value through the val pointer, and returns the number
    1.30 +	 * of elements in that value (3 for pos/scale, 4 for rotation).
    1.31 +	 */
    1.32 +	virtual int get_key_value(int trackid, int idx, float *val) const;
    1.33 +	virtual Vector3 get_position_key_value(int idx) const;
    1.34 +	virtual Quaternion get_rotation_key_value(int idx) const;
    1.35 +	virtual Vector3 get_scaling_key_value(int idx) const;
    1.36 +
    1.37  
    1.38  	virtual void set_position(const Vector3 &pos, long tmsec = 0);
    1.39  	virtual Vector3 get_node_position(long tmsec = 0) const;