File: FCDAnimationKey.h

package info (click to toggle)
0ad 0.0.23.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 78,292 kB
  • sloc: cpp: 245,166; ansic: 200,249; python: 13,754; sh: 6,104; perl: 4,620; makefile: 977; xml: 810; java: 533; ruby: 229; erlang: 46; pascal: 30; sql: 21; tcl: 4
file content (152 lines) | stat: -rw-r--r-- 4,336 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
	Copyright (C) 2005-2007 Feeling Software Inc.
	Portions of the code are:
	Copyright (C) 2005-2007 Sony Computer Entertainment America
	
	MIT License: http://www.opensource.org/licenses/mit-license.php
*/

/**
	@file FCDAnimationKey.h
	This file contains the FCDAnimationKey, FCDAnimationKeyBezier and FCDAnimationKeyTCB classes.
*/	

#ifndef _FCD_ANIMATION_KEY_H_
#define _FCD_ANIMATION_KEY_H_

/**
	A simple animation key.
	This class is the base for the more complex one-dimensional keys
	and it is used directly for linear and step keys.

	Do not create directly.
	Instead call FCDAnimationCurve::AddKey(FUDaeInterpolation::LINEAR)
	or FCDAnimationCurve::AddKey(FUDaeInterpolation::STEP).
*/
class FCDAnimationKey
{
public:
	/** The key input. Typically, this will be a time value, in seconds.
		For driven curves, the dimension of this value will depend on the driver. */
	float input;

	/** The key output. */
	float output;

	/** The key interpolation type.
		@see FUDaeInterpolation::Interpolation */
	uint32 interpolation;
};

/**
	An animation key with tangents values.
	This class is used for bezier keys and soon: for hermite keys as well.
	
	Do not create directly.
	Instead call FCDAnimationCurve::AddKey(FUDaeInterpolation::BEZIER).
*/
class FCDAnimationKeyBezier : public FCDAnimationKey
{
public:
	FMVector2 inTangent; /**< The incoming tangent value. */
	FMVector2 outTangent; /**< The outcoming tangent value. */
};

/**
	An animation key with tension, continuity and bias values.
	This class is used for 3dsMax TCB keys.
	
	Do not create directly.
	Instead call FCDAnimationCurve::AddKey(FUDaeInterpolation::TCB).
*/
class FCDAnimationKeyTCB : public FCDAnimationKey
{
public:
	float tension; /**< The tension. */
	float continuity; /**< The continuity. */
	float bias; /**< The bias. */

	float easeIn; /**< The ease-in factor. */
	float easeOut; /**< The ease-out factor. */
};

/**
	A simple multi-dimensional animation key.
	This class is the base for the more complex multi-dimensional keys
	and it is used directly for linear and step multi-dimensional keys.
*/
class FCDAnimationMKey
{
private:
	uint32 dimension;

public:
	/** Constructor. Do not use directly.
		Instead call FCDAnimationMultiCurve::AddKey(FUDaeInterpolation::LINEAR)
		or FCDAnimationMultiCurve::AddKey(FUDaeInterpolation::STEP).
		@param dimension The number of dimension to the key output. */
	FCDAnimationMKey(uint32 dimension);

	/** Destructor. */
	virtual ~FCDAnimationMKey();

	/** Retrieves the number of dimensions for this key.
		@return The number of dimensions. */
	uint32 GetDimension() const { return dimension; };

	/** The key input. Typically, this will be a time value, in seconds.
		For driven curves, the dimension of this value will depend on the driver. */
	float input;

	/** The key interpolation type.
		@see FUDaeInterpolation::Interpolation */
	uint32 interpolation;

	/** The multi-dimensional key output. */
	float* output;
};

/**
	A multi-dimensional animation key with tangents values.
	This class is used for bezier keys and soon: for hermite keys as well.
*/
class FCDAnimationMKeyBezier : public FCDAnimationMKey
{
public:
	/** Constructor: do not use directly.
		Instead call FCDAnimationCurve::AddKey(FUDaeInterpolation::BEZIER).
		@param dimension The number of dimension to the key output. */
	FCDAnimationMKeyBezier(uint32 dimension);

	/** Destructor. */
	virtual ~FCDAnimationMKeyBezier();

	FMVector2* inTangent; /**< The incoming tangent value. */
	FMVector2* outTangent; /**< The outcoming tangent value. */
};

/**
	An animation key with tension, continuity and bias values.
	This class is used for 3dsMax TCB keys.
*/
class FCDAnimationMKeyTCB : public FCDAnimationMKey
{
public:
	/** Constructor: do not use directly.
		Instead call FCDAnimationMultiCurve::AddKey(FUDaeInterpolation::TCB).
		@param dimension The number of dimension to the key output. */
	FCDAnimationMKeyTCB(uint32 dimension);

	/** Destructor. */
	virtual ~FCDAnimationMKeyTCB();

	float* tension; /**< The multi-dimensional tensions. */
	float* continuity; /**< The multi-dimensional continuities. */
	float* bias; /**< The multi-dimensional biases. */

	float* easeIn; /**< The multi-dimensional ease-in factors. */
	float* easeOut; /**< The multi-dimensional ease-out factors. */
};

#endif // _FCD_ANIMATION_KEY_H_