FCDocument/FCDAnimated.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005-2006 Feeling Software Inc.
00003     MIT License: http://www.opensource.org/licenses/mit-license.php
00004 */
00005 /*
00006     Based on the FS Import classes:
00007     Copyright (C) 2005-2006 Feeling Software Inc
00008     Copyright (C) 2005-2006 Autodesk Media Entertainment
00009     MIT License: http://www.opensource.org/licenses/mit-license.php
00010 */
00011 
00017 #ifndef _FCD_ANIMATED_H_
00018 #define _FCD_ANIMATED_H_
00019 
00020 #include "FCDocument/FCDObject.h"
00021 
00022 class FCDocument;
00023 class FCDAnimated;
00024 class FCDAnimationCurve;
00025 class FCDAnimationChannel;
00026 class FCDAnimationMultiCurve;
00027 
00028 typedef vector<float*> FloatPtrList; 
00029 typedef vector<FCDAnimationCurve*> FCDAnimationCurveList; 
00030 typedef vector<FCDAnimationChannel*> FCDAnimationChannelList; 
00031 typedef vector<FCDAnimated*> FCDAnimatedList; 
00048 class FCOLLADA_EXPORT FCDAnimated : public FCDObject
00049 {
00050 private:
00051     DeclareObjectType;
00052 
00053 protected:
00055     FloatPtrList values;
00056 
00059     StringList qualifiers; 
00060 
00064     FCDAnimationCurveList curves; 
00065 
00070     int32 arrayElement;
00071 
00073     string pointer; 
00074 
00075 public:
00080     FCDAnimated(FCDocument* document, size_t valueCount);
00081 
00083     virtual ~FCDAnimated();
00084 
00087     inline size_t GetValueCount() const { return values.size(); }
00088 
00093     inline FCDAnimationCurve* GetCurve(size_t index) { FUAssert(index < GetValueCount(), return NULL); return curves.at(index); }
00094     inline const FCDAnimationCurve* GetCurve(size_t index) const { FUAssert(index < GetValueCount(), return NULL); return curves.at(index); } 
00099     inline FCDAnimationCurveList& GetCurves() { return curves; }
00100     inline const FCDAnimationCurveList& GetCurves() const { return curves; } 
00108     bool SetCurve(size_t index, FCDAnimationCurve* curve);
00109 
00114     bool RemoveCurve(size_t index);
00115 
00120     inline float* GetValue(size_t index) { FUAssert(index < GetValueCount(), return NULL); return values.at(index); }
00121     inline const float* GetValue(size_t index) const { FUAssert(index < GetValueCount(), return NULL); return values.at(index); } 
00127     inline const string& GetQualifier(size_t index) const;
00128 
00133     float* FindValue(const string& qualifier);
00134     const float* FindValue(const string& qualifier) const; 
00141     inline FCDAnimationCurve* FindCurve(const char* qualifier) { return GetCurve(FindQualifier(qualifier)); }
00142     inline FCDAnimationCurve* FindCurve(const string& qualifier) { return FindCurve(qualifier.c_str()); } 
00143     inline const FCDAnimationCurve* FindCurve(const char* qualifier) const { return GetCurve(FindQualifier(qualifier)); } 
00144     inline const FCDAnimationCurve* FindCurve(const string& qualifier) const { return FindCurve(qualifier.c_str()); } 
00151     inline FCDAnimationCurve* FindCurve(const float* value) { return GetCurve(FindValue(value)); }
00152     inline const FCDAnimationCurve* FindCurve(const float* value) const { return GetCurve(FindValue(value)); } 
00158     size_t FindQualifier(const char* qualifier) const;
00159     inline size_t FindQualifier(const string& qualifier) const { return FindQualifier(qualifier.c_str()); } 
00165     size_t FindValue(const float* value) const;
00166 
00172     inline int32 GetArrayElement() const { return arrayElement; }
00173 
00179     inline void SetArrayElement(int32 index) { arrayElement = index; }
00180 
00184     bool HasCurve() const;
00185 
00190     FCDAnimationMultiCurve* CreateMultiCurve() const;
00191 
00199     static FCDAnimationMultiCurve* CreateMultiCurve(const FCDAnimatedList& toMerge);
00200 
00205     void Evaluate(float time);
00206 
00212     static FCDAnimated* Clone(FCDocument* document, const float* animatedValue, FloatPtrList& newAnimatedValues);
00213 
00217     FCDAnimated* Clone(FCDocument* document);
00218 
00222     const string& GetTargetPointer() const { return pointer; }
00223 
00230     bool Link(xmlNode* node);
00231 
00237     bool ProcessChannels(FCDAnimationChannelList& channels);
00238 };
00239 
00244 class FCOLLADA_EXPORT FCDAnimatedFloat : public FCDAnimated
00245 {
00246 private:
00247     DeclareObjectType;
00248 
00249     // Don't build directly, use the Create function instead
00250     FCDAnimatedFloat(FCDocument* document, float* value, int32 arrayElement);
00251 
00252 public:
00259     static FCDAnimatedFloat* Create(FCDocument* document, float* value, int32 arrayElement=-1);
00260 
00269     static FCDAnimatedFloat* Create(FCDocument* document, xmlNode* node, float* value, int32 arrayElement=-1);
00270 
00276     static FCDAnimated* Clone(FCDocument* document, const float* oldValue, float* newValue);
00277 };
00278 
00281 class FCOLLADA_EXPORT FCDAnimatedPoint3 : public FCDAnimated
00282 {
00283 private:
00284     DeclareObjectType;
00285 
00286     // Don't build directly, use the Create function instead
00287     FCDAnimatedPoint3(FCDocument* document, FMVector3* value, int32 arrayElement);
00288 
00289 public:
00296     static FCDAnimatedPoint3* Create(FCDocument* document, FMVector3* value, int32 arrayElement=-1);
00297 
00306     static FCDAnimatedPoint3* Create(FCDocument* document, xmlNode* node, FMVector3* value, int32 arrayElement=-1);
00307 
00313     static FCDAnimated* Clone(FCDocument* document, const FMVector3* oldValue, FMVector3* newValue);
00314 };
00315 
00318 class FCOLLADA_EXPORT FCDAnimatedColor : public FCDAnimated
00319 {
00320 private:
00321     DeclareObjectType;
00322 
00323     // Don't build directly, use the Create function instead
00324     FCDAnimatedColor(FCDocument* document, FMVector3* value, int32 arrayElement);
00325 
00326 public:
00333     static FCDAnimatedColor* Create(FCDocument* document, FMVector3* value, int32 arrayElement=-1);
00334 
00343     static FCDAnimatedColor* Create(FCDocument* document, xmlNode* node, FMVector3* value, int32 arrayElement=-1);
00344 
00350     static FCDAnimated* Clone(FCDocument* document, const FMVector3* oldValue, FMVector3* newValue);
00351 };
00352 
00355 class FCOLLADA_EXPORT FCDAnimatedAngle : public FCDAnimated
00356 {
00357 private:
00358     DeclareObjectType;
00359 
00360     // Don't build directly, use the Create function instead
00361     FCDAnimatedAngle(FCDocument* document, float* value, int32 arrayElement);
00362 
00363 public:
00370     static FCDAnimatedAngle* Create(FCDocument* document, float* value, int32 arrayElement=-1);
00371 
00380     static FCDAnimatedAngle* Create(FCDocument* document, xmlNode* node, float* value, int32 arrayElement=-1);
00381 
00387     static FCDAnimated* Clone(FCDocument* document, const float* oldValue, float* newValue);
00388 };
00389 
00394 class FCOLLADA_EXPORT FCDAnimatedAngleAxis : public FCDAnimated
00395 {
00396 private:
00397     DeclareObjectType;
00398 
00399     // Don't build directly, use the Create function instead
00400     FCDAnimatedAngleAxis(FCDocument* document, FMVector3* axis, float* angle, int32 arrayElement);
00401 
00402 public:
00410     static FCDAnimatedAngleAxis* Create(FCDocument* document, FMVector3* value, float* angle, int32 arrayElement=-1);
00411 
00421     static FCDAnimatedAngleAxis* Create(FCDocument* document, xmlNode* node, FMVector3* axis, float* angle, int32 arrayElement=-1);
00422 
00429     static FCDAnimated* Clone(FCDocument* document, const float* oldAngle, FMVector3* newAxis, float* newAngle);
00430 };
00431 
00435 class FCOLLADA_EXPORT FCDAnimatedMatrix : public FCDAnimated
00436 {
00437 private:
00438     DeclareObjectType;
00439 
00440     // Don't build directly, use the Create function instead
00441     FCDAnimatedMatrix(FCDocument* document, FMMatrix44* value, int32 arrayElement);
00442 
00443 public:
00450     static FCDAnimatedMatrix* Create(FCDocument* document, FMMatrix44* value, int32 arrayElement=-1);
00451 
00460     static FCDAnimatedMatrix* Create(FCDocument* document, xmlNode* node, FMMatrix44* value, int32 arrayElement=-1);
00461 
00467     static FCDAnimated* Clone(FCDocument* document, const FMMatrix44* oldMx, FMMatrix44* newMx);
00468 };
00469 
00474 class FCOLLADA_EXPORT FCDAnimatedCustom : public FCDAnimated
00475 {
00476 private:
00477     DeclareObjectType;
00478     float dummy;
00479 
00480     // Don't build directly, use the Create function instead
00481     FCDAnimatedCustom(FCDocument* document);
00482 
00483     bool Link(xmlNode* node);
00484 
00485 public:
00489     static FCDAnimatedCustom* Create(FCDocument* document);
00490 
00496     static FCDAnimatedCustom* Create(FCDocument* document, xmlNode* node);
00497 
00500     const float& GetDummy() const { return dummy; }
00501 };
00502 
00503 #endif // _FCD_ANIMATED_H_
00504 

Generated on Fri May 12 16:44:38 2006 for FCollada by  doxygen 1.4.6-NO