1 /*
2 	Copyright (C) 2005-2007 Feeling Software Inc.
3 	Portions of the code are:
4 	Copyright (C) 2005-2007 Sony Computer Entertainment America
5 
6 	MIT License: http://www.opensource.org/licenses/mit-license.php
7 */
8 
9 /**
10 	@file FCDAnimationKey.h
11 	This file contains the FCDAnimationKey, FCDAnimationKeyBezier and FCDAnimationKeyTCB classes.
12 */
13 
14 #ifndef _FCD_ANIMATION_KEY_H_
15 #define _FCD_ANIMATION_KEY_H_
16 
17 /**
18 	A simple animation key.
19 	This class is the base for the more complex one-dimensional keys
20 	and it is used directly for linear and step keys.
21 
22 	Do not create directly.
23 	Instead call FCDAnimationCurve::AddKey(FUDaeInterpolation::LINEAR)
24 	or FCDAnimationCurve::AddKey(FUDaeInterpolation::STEP).
25 */
26 class FCDAnimationKey
27 {
28 public:
29 	/** The key input. Typically, this will be a time value, in seconds.
30 		For driven curves, the dimension of this value will depend on the driver. */
31 	float input;
32 
33 	/** The key output. */
34 	float output;
35 
36 	/** The key interpolation type.
37 		@see FUDaeInterpolation::Interpolation */
38 	uint32 interpolation;
39 };
40 
41 /**
42 	An animation key with tangents values.
43 	This class is used for bezier keys and soon: for hermite keys as well.
44 
45 	Do not create directly.
46 	Instead call FCDAnimationCurve::AddKey(FUDaeInterpolation::BEZIER).
47 */
48 class FCDAnimationKeyBezier : public FCDAnimationKey
49 {
50 public:
51 	FMVector2 inTangent; /**< The incoming tangent value. */
52 	FMVector2 outTangent; /**< The outcoming tangent value. */
53 };
54 
55 /**
56 	An animation key with tension, continuity and bias values.
57 	This class is used for 3dsMax TCB keys.
58 
59 	Do not create directly.
60 	Instead call FCDAnimationCurve::AddKey(FUDaeInterpolation::TCB).
61 */
62 class FCDAnimationKeyTCB : public FCDAnimationKey
63 {
64 public:
65 	float tension; /**< The tension. */
66 	float continuity; /**< The continuity. */
67 	float bias; /**< The bias. */
68 
69 	float easeIn; /**< The ease-in factor. */
70 	float easeOut; /**< The ease-out factor. */
71 };
72 
73 /**
74 	A simple multi-dimensional animation key.
75 	This class is the base for the more complex multi-dimensional keys
76 	and it is used directly for linear and step multi-dimensional keys.
77 */
78 class FCDAnimationMKey
79 {
80 private:
81 	uint32 dimension;
82 
83 public:
84 	/** Constructor. Do not use directly.
85 		Instead call FCDAnimationMultiCurve::AddKey(FUDaeInterpolation::LINEAR)
86 		or FCDAnimationMultiCurve::AddKey(FUDaeInterpolation::STEP).
87 		@param dimension The number of dimension to the key output. */
88 	FCDAnimationMKey(uint32 dimension);
89 
90 	/** Destructor. */
91 	virtual ~FCDAnimationMKey();
92 
93 	/** Retrieves the number of dimensions for this key.
94 		@return The number of dimensions. */
GetDimension()95 	uint32 GetDimension() const { return dimension; };
96 
97 	/** The key input. Typically, this will be a time value, in seconds.
98 		For driven curves, the dimension of this value will depend on the driver. */
99 	float input;
100 
101 	/** The key interpolation type.
102 		@see FUDaeInterpolation::Interpolation */
103 	uint32 interpolation;
104 
105 	/** The multi-dimensional key output. */
106 	float* output;
107 };
108 
109 /**
110 	A multi-dimensional animation key with tangents values.
111 	This class is used for bezier keys and soon: for hermite keys as well.
112 */
113 class FCDAnimationMKeyBezier : public FCDAnimationMKey
114 {
115 public:
116 	/** Constructor: do not use directly.
117 		Instead call FCDAnimationCurve::AddKey(FUDaeInterpolation::BEZIER).
118 		@param dimension The number of dimension to the key output. */
119 	FCDAnimationMKeyBezier(uint32 dimension);
120 
121 	/** Destructor. */
122 	virtual ~FCDAnimationMKeyBezier();
123 
124 	FMVector2* inTangent; /**< The incoming tangent value. */
125 	FMVector2* outTangent; /**< The outcoming tangent value. */
126 };
127 
128 /**
129 	An animation key with tension, continuity and bias values.
130 	This class is used for 3dsMax TCB keys.
131 */
132 class FCDAnimationMKeyTCB : public FCDAnimationMKey
133 {
134 public:
135 	/** Constructor: do not use directly.
136 		Instead call FCDAnimationMultiCurve::AddKey(FUDaeInterpolation::TCB).
137 		@param dimension The number of dimension to the key output. */
138 	FCDAnimationMKeyTCB(uint32 dimension);
139 
140 	/** Destructor. */
141 	virtual ~FCDAnimationMKeyTCB();
142 
143 	float* tension; /**< The multi-dimensional tensions. */
144 	float* continuity; /**< The multi-dimensional continuities. */
145 	float* bias; /**< The multi-dimensional biases. */
146 
147 	float* easeIn; /**< The multi-dimensional ease-in factors. */
148 	float* easeOut; /**< The multi-dimensional ease-out factors. */
149 };
150 
151 #endif // _FCD_ANIMATION_KEY_H_
152 
153