[964] | 1 | /*
|
---|
| 2 | Copyright (C) 2005-2006 Feeling Software Inc.
|
---|
| 3 | MIT License: http://www.opensource.org/licenses/mit-license.php
|
---|
| 4 | */
|
---|
| 5 | /*
|
---|
| 6 | Based on the FS Import classes:
|
---|
| 7 | Copyright (C) 2005-2006 Feeling Software Inc
|
---|
| 8 | Copyright (C) 2005-2006 Autodesk Media Entertainment
|
---|
| 9 | MIT License: http://www.opensource.org/licenses/mit-license.php
|
---|
| 10 | */
|
---|
| 11 |
|
---|
| 12 | /**
|
---|
| 13 | @file FCDAnimated.h
|
---|
| 14 | This file contains the FCDAnimated class.
|
---|
| 15 | */
|
---|
| 16 |
|
---|
| 17 | #ifndef _FCD_ANIMATED_H_
|
---|
| 18 | #define _FCD_ANIMATED_H_
|
---|
| 19 |
|
---|
| 20 | #include "FCDocument/FCDObject.h"
|
---|
| 21 |
|
---|
| 22 | class FCDocument;
|
---|
| 23 | class FCDAnimated;
|
---|
| 24 | class FCDAnimationCurve;
|
---|
| 25 | class FCDAnimationChannel;
|
---|
| 26 | class FCDAnimationMultiCurve;
|
---|
| 27 |
|
---|
| 28 | typedef vector<float*> FloatPtrList; /**< A dynamically-sized array of floating-point value pointers. */
|
---|
| 29 | typedef vector<FCDAnimationCurve*> FCDAnimationCurveList; /**< A dynamically-sized array of animation curves. */
|
---|
| 30 | typedef vector<FCDAnimationChannel*> FCDAnimationChannelList; /**< A dynamically-sized array of animation channels. */
|
---|
| 31 | typedef vector<FCDAnimated*> FCDAnimatedList; /**< A dynamically-sized array of animated values. */
|
---|
| 32 |
|
---|
| 33 | /**
|
---|
| 34 | An animated element.
|
---|
| 35 | An animated element encapsulates a set of floating-point values that are
|
---|
| 36 | marked as animated.
|
---|
| 37 |
|
---|
| 38 | For this purpose, an animated element holds a list of floating-point values,
|
---|
| 39 | their animation curves and their COLLADA qualifiers for the generation of
|
---|
| 40 | COLLADA targets. For animated list elements, an animated element holds an array index.
|
---|
| 41 |
|
---|
| 42 | There are many classes built on top of this class. They represent
|
---|
| 43 | the different element types that may be animated, such as 3D points,
|
---|
| 44 | colors and matrices.
|
---|
| 45 |
|
---|
| 46 | @ingroup FCDocument
|
---|
| 47 | */
|
---|
| 48 | class FCOLLADA_EXPORT FCDAnimated : public FCDObject
|
---|
| 49 | {
|
---|
| 50 | private:
|
---|
| 51 | DeclareObjectType;
|
---|
| 52 |
|
---|
| 53 | protected:
|
---|
| 54 | /** The list of value pointers. */
|
---|
| 55 | FloatPtrList values;
|
---|
| 56 |
|
---|
| 57 | /** The list of target qualifiers.
|
---|
| 58 | There is always one qualifier for one value pointer. */
|
---|
| 59 | StringList qualifiers;
|
---|
| 60 |
|
---|
| 61 | /** The list of animation curves.
|
---|
| 62 | There is always one curve for one value pointer, although
|
---|
| 63 | that curve may be the NULL pointer to indicate a non-animated value. */
|
---|
| 64 | FCDAnimationCurveList curves;
|
---|
| 65 |
|
---|
| 66 | /** The array index for animated element that belong
|
---|
| 67 | to a list of animated elements. This value may be -1
|
---|
| 68 | to indicate that the element does not belong to a list.
|
---|
| 69 | Otherwise, the index should always be unsigned. */
|
---|
| 70 | int32 arrayElement;
|
---|
| 71 |
|
---|
| 72 | /** [INTERNAL] The target pointer prefix. */
|
---|
| 73 | string pointer;
|
---|
| 74 |
|
---|
| 75 | public:
|
---|
| 76 | /** Constructor.
|
---|
| 77 | In most cases, it is preferable to create objects of the up-classes.
|
---|
| 78 | @param document The COLLADA document that owns this animated element.
|
---|
| 79 | @param valueCount The number of values inside the animated element. */
|
---|
| 80 | FCDAnimated(FCDocument* document, size_t valueCount);
|
---|
| 81 |
|
---|
| 82 | /** Destructor. */
|
---|
| 83 | virtual ~FCDAnimated();
|
---|
| 84 |
|
---|
| 85 | /** Retrieves the number of values contained within this animated element.
|
---|
| 86 | @return The number of values. */
|
---|
| 87 | inline size_t GetValueCount() const { return values.size(); }
|
---|
| 88 |
|
---|
| 89 | /** Retrieves the animation curve affecting the value of an animated element.
|
---|
| 90 | @param index The value index.
|
---|
| 91 | @return The curve affecting the value at the given index. This pointer will
|
---|
| 92 | be NULL if the index is out-of-bounds or if the value is not animated. */
|
---|
| 93 | inline FCDAnimationCurve* GetCurve(size_t index) { FUAssert(index < GetValueCount(), return NULL); return curves.at(index); }
|
---|
| 94 | inline const FCDAnimationCurve* GetCurve(size_t index) const { FUAssert(index < GetValueCount(), return NULL); return curves.at(index); } /**< See above. */
|
---|
| 95 |
|
---|
| 96 | /** Retrieves the list of the curves affecting the values of an animated element.
|
---|
| 97 | This list may contain the NULL pointer, where a value is not animated.
|
---|
| 98 | @return The list of animation curves. */
|
---|
| 99 | inline FCDAnimationCurveList& GetCurves() { return curves; }
|
---|
| 100 | inline const FCDAnimationCurveList& GetCurves() const { return curves; } /**< See above. */
|
---|
| 101 |
|
---|
| 102 | /** Assigns a curve to a value of the animated element.
|
---|
| 103 | The previously assigned curve will be deleted.
|
---|
| 104 | @param index The value index.
|
---|
| 105 | @param curve The new curve that will affect the value at the given index.
|
---|
| 106 | @return Whether the curve was successfully assigned. Will return false if
|
---|
| 107 | the index is out-of-bounds. */
|
---|
| 108 | bool SetCurve(size_t index, FCDAnimationCurve* curve);
|
---|
| 109 |
|
---|
| 110 | /** Removes the curve affecting a value of the animated element.
|
---|
| 111 | @param index The value index.
|
---|
| 112 | @return Whether a curve was successfully removed. Will return false
|
---|
| 113 | if there was no curve to release or the index is out-of-bounds. */
|
---|
| 114 | bool RemoveCurve(size_t index);
|
---|
| 115 |
|
---|
| 116 | /** Retrieves the value of an animated element.
|
---|
| 117 | @param index The value index.
|
---|
| 118 | @return The value at the given index. This pointer will
|
---|
| 119 | be NULL if the index is out-of-boudns. */
|
---|
| 120 | inline float* GetValue(size_t index) { FUAssert(index < GetValueCount(), return NULL); return values.at(index); }
|
---|
| 121 | inline const float* GetValue(size_t index) const { FUAssert(index < GetValueCount(), return NULL); return values.at(index); } /**< See above. */
|
---|
| 122 |
|
---|
| 123 | /** Retrieves the qualifier of the value of an animated element.
|
---|
| 124 | @param index The value index.
|
---|
| 125 | @return The qualifier for the value. The value returned will be an
|
---|
| 126 | empty string when the index is out-of-bounds. */
|
---|
| 127 | inline const string& GetQualifier(size_t index) const;
|
---|
| 128 |
|
---|
| 129 | /** Retrieves an animated value given a valid qualifier.
|
---|
| 130 | @param qualifier A valid qualifier.
|
---|
| 131 | @return The animated value for this qualifier. This pointer will be
|
---|
| 132 | NULL if the given qualifier is not used within this animated element. */
|
---|
| 133 | float* FindValue(const string& qualifier);
|
---|
| 134 | const float* FindValue(const string& qualifier) const; /**< See above. */
|
---|
| 135 |
|
---|
| 136 | /** Retrieves an animation curve given a valid qualifier.
|
---|
| 137 | @param qualifier A valid qualifier.
|
---|
| 138 | @return The animation curve for this qualifier. This pointer will be
|
---|
| 139 | NULL if the given qualifier is not used within this animated element
|
---|
| 140 | or if the value for the given qualifier is not animated. */
|
---|
| 141 | inline FCDAnimationCurve* FindCurve(const char* qualifier) { return GetCurve(FindQualifier(qualifier)); }
|
---|
| 142 | inline FCDAnimationCurve* FindCurve(const string& qualifier) { return FindCurve(qualifier.c_str()); } /**< See above. */
|
---|
| 143 | inline const FCDAnimationCurve* FindCurve(const char* qualifier) const { return GetCurve(FindQualifier(qualifier)); } /**< See above. */
|
---|
| 144 | inline const FCDAnimationCurve* FindCurve(const string& qualifier) const { return FindCurve(qualifier.c_str()); } /**< See above. */
|
---|
| 145 |
|
---|
| 146 | /** Retrieves an animation curve given a value pointer.
|
---|
| 147 | @param value A value pointer contained within the animated element.
|
---|
| 148 | @return The animation curve for this qualifier. This pointer will be
|
---|
| 149 | NULL if the value pointer is not contained by this animated element
|
---|
| 150 | or if the value is not animated. */
|
---|
| 151 | inline FCDAnimationCurve* FindCurve(const float* value) { return GetCurve(FindValue(value)); }
|
---|
| 152 | inline const FCDAnimationCurve* FindCurve(const float* value) const { return GetCurve(FindValue(value)); } /**< See above. */
|
---|
| 153 |
|
---|
| 154 | /** Retrieves the value index for a given qualifier.
|
---|
| 155 | @param qualifier A valid qualifier.
|
---|
| 156 | @return The value index. This value will be -1 to indicate that the
|
---|
| 157 | qualifier does not belong to this animated element. */
|
---|
| 158 | size_t FindQualifier(const char* qualifier) const;
|
---|
| 159 | inline size_t FindQualifier(const string& qualifier) const { return FindQualifier(qualifier.c_str()); } /**< See above. */
|
---|
| 160 |
|
---|
| 161 | /** Retrieves the value index for a given value pointer.
|
---|
| 162 | @param value A value pointer contained within the animated element.
|
---|
| 163 | @return The value index. This value will be -1 to indicate that the
|
---|
| 164 | value pointer is not contained by this animated element. */
|
---|
| 165 | size_t FindValue(const float* value) const;
|
---|
| 166 |
|
---|
| 167 | /** Retrieves the array index for an animated element.
|
---|
| 168 | This value is used only for animated elements that belong
|
---|
| 169 | to a list of animated elements within the COLLADA document.
|
---|
| 170 | @return The array index. This value will be -1 to indicate that
|
---|
| 171 | the animated element does not belong to a list. */
|
---|
| 172 | inline int32 GetArrayElement() const { return arrayElement; }
|
---|
| 173 |
|
---|
| 174 | /** Sets the array index for an animated element.
|
---|
| 175 | This value is used only for animated elements that belong
|
---|
| 176 | to a list of animated elements within the COLLADA document.
|
---|
| 177 | @param index The array index. This value should be -1 to indicate that
|
---|
| 178 | the animated element does not belong to a list. */
|
---|
| 179 | inline void SetArrayElement(int32 index) { arrayElement = index; }
|
---|
| 180 |
|
---|
| 181 | /** Retrieves whether this animated element has any animation curves
|
---|
| 182 | affecting its values.
|
---|
| 183 | @return Whether any curves affect this animated element. */
|
---|
| 184 | bool HasCurve() const;
|
---|
| 185 |
|
---|
| 186 | /** Creates one multi-dimensional animation curve from this animated element.
|
---|
| 187 | This function is useful is your application does not handle animations
|
---|
| 188 | per-values, but instead needs one animation per-element.
|
---|
| 189 | @return The multi-dimensional animation curve. */
|
---|
| 190 | FCDAnimationMultiCurve* CreateMultiCurve() const;
|
---|
| 191 |
|
---|
| 192 | /** Creates one multi-dimensional animation curve from a list of animated element.
|
---|
| 193 | This function is useful is your application does not handle animations
|
---|
| 194 | per-values. For example, we use this function is ColladaMax for animated scale values,
|
---|
| 195 | where one scale value is two rotations for the scale rotation pivot and one
|
---|
| 196 | 3D point for the scale factors.
|
---|
| 197 | @param toMerge The list of animated elements to merge
|
---|
| 198 | @return The multi-dimensional animation curve. */
|
---|
| 199 | static FCDAnimationMultiCurve* CreateMultiCurve(const FCDAnimatedList& toMerge);
|
---|
| 200 |
|
---|
| 201 | /** Evaluates the animated element at a given time.
|
---|
| 202 | This function directly and <b>permanently</b> modifies the values
|
---|
| 203 | of the animated element according to the curves affecting them.
|
---|
| 204 | @param time The evaluation time. */
|
---|
| 205 | void Evaluate(float time);
|
---|
| 206 |
|
---|
| 207 | /** [INTERNAL] Clones an animated element.
|
---|
| 208 | @param document The COLLADA document that owns the cloned animated element.
|
---|
| 209 | @param animatedValue One animated value contained within the original animated element.
|
---|
| 210 | @param newAnimatedValues The list of value pointers to be contained by the cloned animated element.
|
---|
| 211 | @return The cloned animated element. */
|
---|
| 212 | static FCDAnimated* Clone(FCDocument* document, const float* animatedValue, FloatPtrList& newAnimatedValues);
|
---|
| 213 |
|
---|
| 214 | /** [INTERNAL] Clones an animated element.
|
---|
| 215 | @param document The COLLADA document that owns the cloned animated element.
|
---|
| 216 | @return The cloned animated element. */
|
---|
| 217 | FCDAnimated* Clone(FCDocument* document);
|
---|
| 218 |
|
---|
| 219 | /** [INTERNAL] Retrieves the target pointer that prefixes the
|
---|
| 220 | fully-qualified target for the element.
|
---|
| 221 | @return The target pointer prefix. */
|
---|
| 222 | const string& GetTargetPointer() const { return pointer; }
|
---|
| 223 |
|
---|
| 224 | /** [INTERNAL] Links this animated element with a given XML tree node.
|
---|
| 225 | This function is solely used within the import of a COLLADA document.
|
---|
| 226 | The floating-point values held within the XML tree node will be linked
|
---|
| 227 | with the list of floating-point value pointers held by the animated entity.
|
---|
| 228 | @param node The XML tree node.
|
---|
| 229 | @return Whether there was any linkage done. */
|
---|
| 230 | bool Link(xmlNode* node);
|
---|
| 231 |
|
---|
| 232 | /** [INTERNAL] Links the animated element with the imported animation curves.
|
---|
| 233 | This compares the animation channel targets with the animated element target
|
---|
| 234 | and qualifiers to assign curves unto the value pointers.
|
---|
| 235 | @param channels A list of animation channels with the correct target pointer.
|
---|
| 236 | @return Whether any animation curves were assigned to the animation element. */
|
---|
| 237 | bool ProcessChannels(FCDAnimationChannelList& channels);
|
---|
| 238 | };
|
---|
| 239 |
|
---|
| 240 | /** A COLLADA animated single floating-point value element.
|
---|
| 241 | Use this animated element class for all generic-purpose single floating-point values.
|
---|
| 242 | For angles, use the FCDAnimatedAngle class.
|
---|
| 243 | @ingroup FCDocument */
|
---|
| 244 | class FCOLLADA_EXPORT FCDAnimatedFloat : public FCDAnimated
|
---|
| 245 | {
|
---|
| 246 | private:
|
---|
| 247 | DeclareObjectType;
|
---|
| 248 |
|
---|
| 249 | // Don't build directly, use the Create function instead
|
---|
| 250 | FCDAnimatedFloat(FCDocument* document, float* value, int32 arrayElement);
|
---|
| 251 |
|
---|
| 252 | public:
|
---|
| 253 | /** Creates a new animated element.
|
---|
| 254 | @param document The COLLADA document that owns the animated element.
|
---|
| 255 | @param value The value pointer for the single floating-point value.
|
---|
| 256 | @param arrayElement The optional array index for animated element
|
---|
| 257 | that belong to an animated element list.
|
---|
| 258 | @return The new animated element. */
|
---|
| 259 | static FCDAnimatedFloat* Create(FCDocument* document, float* value, int32 arrayElement=-1);
|
---|
| 260 |
|
---|
| 261 | /** [INTERNAL] Creates a new animated element.
|
---|
| 262 | This function is used during the import of a COLLADA document.
|
---|
| 263 | @param document The COLLADA document that owns the animated element.
|
---|
| 264 | @param node The XML tree node that contains the animated values.
|
---|
| 265 | @param value The value pointer for the single floating-point value.
|
---|
| 266 | @param arrayElement The optional array index for animated element
|
---|
| 267 | that belong to an animated element list.
|
---|
| 268 | @return The new animated element. */
|
---|
| 269 | static FCDAnimatedFloat* Create(FCDocument* document, xmlNode* node, float* value, int32 arrayElement=-1);
|
---|
| 270 |
|
---|
| 271 | /** [INTERNAL] Clones an animated element.
|
---|
| 272 | @param document The COLLADA document that owns the cloned animated element.
|
---|
| 273 | @param oldValue The single floating-point value pointer contained within the original animated element.
|
---|
| 274 | @param newValue The single floating-point value pointer for the cloned animated element.
|
---|
| 275 | @return The cloned animated value. */
|
---|
| 276 | static FCDAnimated* Clone(FCDocument* document, const float* oldValue, float* newValue);
|
---|
| 277 | };
|
---|
| 278 |
|
---|
| 279 | /** A COLLADA animated 3D vector element.
|
---|
| 280 | @ingroup FCDocument */
|
---|
| 281 | class FCOLLADA_EXPORT FCDAnimatedPoint3 : public FCDAnimated
|
---|
| 282 | {
|
---|
| 283 | private:
|
---|
| 284 | DeclareObjectType;
|
---|
| 285 |
|
---|
| 286 | // Don't build directly, use the Create function instead
|
---|
| 287 | FCDAnimatedPoint3(FCDocument* document, FMVector3* value, int32 arrayElement);
|
---|
| 288 |
|
---|
| 289 | public:
|
---|
| 290 | /** Creates a new animated element.
|
---|
| 291 | @param document The COLLADA document that owns the animated element.
|
---|
| 292 | @param value The value pointer for the 3D vector.
|
---|
| 293 | @param arrayElement The optional array index for animated element
|
---|
| 294 | that belong to an animated element list.
|
---|
| 295 | @return The new animated element. */
|
---|
| 296 | static FCDAnimatedPoint3* Create(FCDocument* document, FMVector3* value, int32 arrayElement=-1);
|
---|
| 297 |
|
---|
| 298 | /** [INTERNAL] Creates a new animated element.
|
---|
| 299 | This function is used during the import of a COLLADA document.
|
---|
| 300 | @param document The COLLADA document that owns the animated element.
|
---|
| 301 | @param node The XML tree node that contains the animated values.
|
---|
| 302 | @param value The value pointer for the 3D vector.
|
---|
| 303 | @param arrayElement The optional array index for animated element
|
---|
| 304 | that belong to an animated element list.
|
---|
| 305 | @return The new animated element. */
|
---|
| 306 | static FCDAnimatedPoint3* Create(FCDocument* document, xmlNode* node, FMVector3* value, int32 arrayElement=-1);
|
---|
| 307 |
|
---|
| 308 | /** [INTERNAL] Clones an animated element.
|
---|
| 309 | @param document The COLLADA document that owns the cloned animated element.
|
---|
| 310 | @param oldValue The 3D vector contained within the original animated element.
|
---|
| 311 | @param newValue The 3D vector for the cloned animated element.
|
---|
| 312 | @return The cloned animated value. */
|
---|
| 313 | static FCDAnimated* Clone(FCDocument* document, const FMVector3* oldValue, FMVector3* newValue);
|
---|
| 314 | };
|
---|
| 315 |
|
---|
| 316 | /** A COLLADA animated RGB color element.
|
---|
| 317 | @ingroup FCDocument */
|
---|
| 318 | class FCOLLADA_EXPORT FCDAnimatedColor : public FCDAnimated
|
---|
| 319 | {
|
---|
| 320 | private:
|
---|
| 321 | DeclareObjectType;
|
---|
| 322 |
|
---|
| 323 | // Don't build directly, use the Create function instead
|
---|
| 324 | FCDAnimatedColor(FCDocument* document, FMVector3* value, int32 arrayElement);
|
---|
| 325 |
|
---|
| 326 | public:
|
---|
| 327 | /** Creates a new animated element.
|
---|
| 328 | @param document The COLLADA document that owns the animated element.
|
---|
| 329 | @param value The value pointer for the RGB color.
|
---|
| 330 | @param arrayElement The optional array index for animated element
|
---|
| 331 | that belong to an animated element list.
|
---|
| 332 | @return The new animated element. */
|
---|
| 333 | static FCDAnimatedColor* Create(FCDocument* document, FMVector3* value, int32 arrayElement=-1);
|
---|
| 334 |
|
---|
| 335 | /** [INTERNAL] Creates a new animated element.
|
---|
| 336 | This function is used during the import of a COLLADA document.
|
---|
| 337 | @param document The COLLADA document that owns the animated element.
|
---|
| 338 | @param node The XML tree node that contains the animated values.
|
---|
| 339 | @param value The value pointer for the RGB color.
|
---|
| 340 | @param arrayElement The optional array index for animated element
|
---|
| 341 | that belong to an animated element list.
|
---|
| 342 | @return The new animated element. */
|
---|
| 343 | static FCDAnimatedColor* Create(FCDocument* document, xmlNode* node, FMVector3* value, int32 arrayElement=-1);
|
---|
| 344 |
|
---|
| 345 | /** [INTERNAL] Clones an animated element.
|
---|
| 346 | @param document The COLLADA document that owns the cloned animated element.
|
---|
| 347 | @param oldValue The RGB color contained within the original animated element.
|
---|
| 348 | @param newValue The RGB color for the cloned animated element.
|
---|
| 349 | @return The cloned animated value. */
|
---|
| 350 | static FCDAnimated* Clone(FCDocument* document, const FMVector3* oldValue, FMVector3* newValue);
|
---|
| 351 | };
|
---|
| 352 |
|
---|
| 353 | /** A COLLADA floating-point value that represents an angle.
|
---|
| 354 | @ingroup FCDocument */
|
---|
| 355 | class FCOLLADA_EXPORT FCDAnimatedAngle : public FCDAnimated
|
---|
| 356 | {
|
---|
| 357 | private:
|
---|
| 358 | DeclareObjectType;
|
---|
| 359 |
|
---|
| 360 | // Don't build directly, use the Create function instead
|
---|
| 361 | FCDAnimatedAngle(FCDocument* document, float* value, int32 arrayElement);
|
---|
| 362 |
|
---|
| 363 | public:
|
---|
| 364 | /** Creates a new animated element.
|
---|
| 365 | @param document The COLLADA document that owns the animated element.
|
---|
| 366 | @param value The value pointer for the angle.
|
---|
| 367 | @param arrayElement The optional array index for animated element
|
---|
| 368 | that belong to an animated element list.
|
---|
| 369 | @return The new animated element. */
|
---|
| 370 | static FCDAnimatedAngle* Create(FCDocument* document, float* value, int32 arrayElement=-1);
|
---|
| 371 |
|
---|
| 372 | /** [INTERNAL] Creates a new animated element.
|
---|
| 373 | This function is used during the import of a COLLADA document.
|
---|
| 374 | @param document The COLLADA document that owns the animated element.
|
---|
| 375 | @param node The XML tree node that contains the animated values.
|
---|
| 376 | @param value The value pointer for the angle.
|
---|
| 377 | @param arrayElement The optional array index for animated element
|
---|
| 378 | that belong to an animated element list.
|
---|
| 379 | @return The new animated element. */
|
---|
| 380 | static FCDAnimatedAngle* Create(FCDocument* document, xmlNode* node, float* value, int32 arrayElement=-1);
|
---|
| 381 |
|
---|
| 382 | /** [INTERNAL] Clones an animated element.
|
---|
| 383 | @param document The COLLADA document that owns the cloned animated element.
|
---|
| 384 | @param oldValue The angle value pointer contained within the original animated element.
|
---|
| 385 | @param newValue The angle value pointer for the cloned animated element.
|
---|
| 386 | @return The cloned animated value. */
|
---|
| 387 | static FCDAnimated* Clone(FCDocument* document, const float* oldValue, float* newValue);
|
---|
| 388 | };
|
---|
| 389 |
|
---|
| 390 | /** A COLLADA animated angle-axis.
|
---|
| 391 | Used for rotations, takes in a 3D vector for the axis and
|
---|
| 392 | a single floating-point value for the angle.
|
---|
| 393 | @ingroup FCDocument */
|
---|
| 394 | class FCOLLADA_EXPORT FCDAnimatedAngleAxis : public FCDAnimated
|
---|
| 395 | {
|
---|
| 396 | private:
|
---|
| 397 | DeclareObjectType;
|
---|
| 398 |
|
---|
| 399 | // Don't build directly, use the Create function instead
|
---|
| 400 | FCDAnimatedAngleAxis(FCDocument* document, FMVector3* axis, float* angle, int32 arrayElement);
|
---|
| 401 |
|
---|
| 402 | public:
|
---|
| 403 | /** Creates a new animated element.
|
---|
| 404 | @param document The COLLADA document that owns the animated element.
|
---|
| 405 | @param value The value pointer for the axis.
|
---|
| 406 | @param angle The value pointer for the angle.
|
---|
| 407 | @param arrayElement The optional array index for animated element
|
---|
| 408 | that belong to an animated element list.
|
---|
| 409 | @return The new animated element. */
|
---|
| 410 | static FCDAnimatedAngleAxis* Create(FCDocument* document, FMVector3* value, float* angle, int32 arrayElement=-1);
|
---|
| 411 |
|
---|
| 412 | /** [INTERNAL] Creates a new animated element.
|
---|
| 413 | This function is used during the import of a COLLADA document.
|
---|
| 414 | @param document The COLLADA document that owns the animated element.
|
---|
| 415 | @param node The XML tree node that contains the animated values.
|
---|
| 416 | @param axis The value pointer for the axis.
|
---|
| 417 | @param angle The value pointer for the angle.
|
---|
| 418 | @param arrayElement The optional array index for animated element
|
---|
| 419 | that belong to an animated element list.
|
---|
| 420 | @return The new animated element. */
|
---|
| 421 | static FCDAnimatedAngleAxis* Create(FCDocument* document, xmlNode* node, FMVector3* axis, float* angle, int32 arrayElement=-1);
|
---|
| 422 |
|
---|
| 423 | /** [INTERNAL] Clones an animated element.
|
---|
| 424 | @param document The COLLADA document that owns the cloned animated element.
|
---|
| 425 | @param oldAngle The angle value pointer contained within the original animated element.
|
---|
| 426 | @param newAxis The axis value pointer for the cloned animated element.
|
---|
| 427 | @param newAngle The angle value pointer for the cloned animated element.
|
---|
| 428 | @return The cloned animated value. */
|
---|
| 429 | static FCDAnimated* Clone(FCDocument* document, const float* oldAngle, FMVector3* newAxis, float* newAngle);
|
---|
| 430 | };
|
---|
| 431 |
|
---|
| 432 | /** A COLLADA animated matrix.
|
---|
| 433 | Used for animated transforms, takes in a 16 floating-point values.
|
---|
| 434 | @ingroup FCDocument */
|
---|
| 435 | class FCOLLADA_EXPORT FCDAnimatedMatrix : public FCDAnimated
|
---|
| 436 | {
|
---|
| 437 | private:
|
---|
| 438 | DeclareObjectType;
|
---|
| 439 |
|
---|
| 440 | // Don't build directly, use the Create function instead
|
---|
| 441 | FCDAnimatedMatrix(FCDocument* document, FMMatrix44* value, int32 arrayElement);
|
---|
| 442 |
|
---|
| 443 | public:
|
---|
| 444 | /** Creates a new animated element.
|
---|
| 445 | @param document The COLLADA document that owns the animated element.
|
---|
| 446 | @param value The value pointer for the matrix.
|
---|
| 447 | @param arrayElement The optional array index for animated element
|
---|
| 448 | that belong to an animated element list.
|
---|
| 449 | @return The new animated element. */
|
---|
| 450 | static FCDAnimatedMatrix* Create(FCDocument* document, FMMatrix44* value, int32 arrayElement=-1);
|
---|
| 451 |
|
---|
| 452 | /** [INTERNAL] Creates a new animated element.
|
---|
| 453 | This function is used during the import of a COLLADA document.
|
---|
| 454 | @param document The COLLADA document that owns the animated element.
|
---|
| 455 | @param node The XML tree node that contains the animated values.
|
---|
| 456 | @param value The value pointer for the matrix.
|
---|
| 457 | @param arrayElement The optional array index for animated element
|
---|
| 458 | that belong to an animated element list.
|
---|
| 459 | @return The new animated element. */
|
---|
| 460 | static FCDAnimatedMatrix* Create(FCDocument* document, xmlNode* node, FMMatrix44* value, int32 arrayElement=-1);
|
---|
| 461 |
|
---|
| 462 | /** [INTERNAL] Clones an animated element.
|
---|
| 463 | @param document The COLLADA document that owns the cloned animated element.
|
---|
| 464 | @param oldMx The matrix value pointer contained within the original animated element.
|
---|
| 465 | @param newMx The matrix value pointer for the cloned animated element.
|
---|
| 466 | @return The cloned animated value. */
|
---|
| 467 | static FCDAnimated* Clone(FCDocument* document, const FMMatrix44* oldMx, FMMatrix44* newMx);
|
---|
| 468 | };
|
---|
| 469 |
|
---|
| 470 | /** A COLLADA custom animated value.
|
---|
| 471 | Used for animated extra elements. A single value is used multiple times to hold
|
---|
| 472 | as many value pointers are necessary to hold the animation curves.
|
---|
| 473 | @ingroup FCDocument */
|
---|
| 474 | class FCOLLADA_EXPORT FCDAnimatedCustom : public FCDAnimated
|
---|
| 475 | {
|
---|
| 476 | private:
|
---|
| 477 | DeclareObjectType;
|
---|
| 478 | float dummy;
|
---|
| 479 |
|
---|
| 480 | // Don't build directly, use the Create function instead
|
---|
| 481 | FCDAnimatedCustom(FCDocument* document);
|
---|
| 482 |
|
---|
| 483 | bool Link(xmlNode* node);
|
---|
| 484 |
|
---|
| 485 | public:
|
---|
| 486 | /** Creates a new animated element.
|
---|
| 487 | @param document The COLLADA document that owns the animated element.
|
---|
| 488 | @return The new animated element. */
|
---|
| 489 | static FCDAnimatedCustom* Create(FCDocument* document);
|
---|
| 490 |
|
---|
| 491 | /** [INTERNAL] Creates a new animated element.
|
---|
| 492 | This function is used during the import of a COLLADA document.
|
---|
| 493 | @param document The COLLADA document that owns the animated element.
|
---|
| 494 | @param node The XML tree node that contains the animated values.
|
---|
| 495 | @return The new animated element. */
|
---|
| 496 | static FCDAnimatedCustom* Create(FCDocument* document, xmlNode* node);
|
---|
| 497 |
|
---|
| 498 | /** Retrieves the floating-point value used for all the value pointers.
|
---|
| 499 | @return The dummy floating-point value. */
|
---|
| 500 | const float& GetDummy() const { return dummy; }
|
---|
| 501 | };
|
---|
| 502 |
|
---|
| 503 | #endif // _FCD_ANIMATED_H_
|
---|
| 504 |
|
---|