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_MORPH_CONTROLLER_H_ 00018 #define _FCD_MORPH_CONTROLLER_H_ 00019 00020 #include "FUtils/FUDaeEnum.h" 00021 #include "FCDocument/FCDObject.h" 00022 00023 class FCDocument; 00024 class FCDController; 00025 class FCDGeometry; 00026 class FCDMorphController; 00027 00033 class FCOLLADA_EXPORT FCDMorphTarget : public FCDObject 00034 { 00035 private: 00036 DeclareObjectType; 00037 FCDMorphController* parent; 00038 FCDGeometry* geometry; 00039 float weight; 00040 00041 public: 00046 FCDMorphTarget(FCDocument* document, FCDMorphController* parent); 00047 00049 virtual ~FCDMorphTarget(); 00050 00053 FCDMorphController* GetParent() { return parent; } 00054 const FCDMorphController* GetParent() const { return parent; } 00060 FCDGeometry* GetGeometry() { return geometry; } 00061 const FCDGeometry* GetGeometry() const { return geometry; } 00069 void SetGeometry(FCDGeometry* geometry); 00070 00073 float& GetWeight() { return weight; } 00074 const float& GetWeight() const { return weight; } 00079 void SetWeight(float _weight) { weight = _weight; } 00080 00083 bool IsAnimated() const; 00084 00088 FCDAnimated* GetAnimatedWeight(); 00089 const FCDAnimated* GetAnimatedWeight() const; 00090 }; 00091 00093 typedef vector<FCDMorphTarget*> FCDMorphTargetList; 00094 00111 class FCOLLADA_EXPORT FCDMorphController : public FCDObject 00112 { 00113 private: 00114 DeclareObjectType; 00115 FCDController* parent; 00116 FCDocument* document; 00117 00118 FUDaeMorphMethod::Method method; 00119 FCDEntity* baseTarget; 00120 FCDMorphTargetList morphTargets; 00121 00122 public: 00127 FCDMorphController(FCDocument* document, FCDController* parent); 00128 00131 virtual ~FCDMorphController(); 00132 00136 FCDEntity* GetBaseTarget() { return baseTarget; } 00137 const FCDEntity* GetBaseTarget() const { return baseTarget; } 00144 void SetBaseTarget(FCDEntity* entity); 00145 00149 FCDMorphTargetList& GetTargets() { return morphTargets; } 00150 const FCDMorphTargetList& GetTargets() const { return morphTargets; } 00154 size_t GetTargetCount() const { return morphTargets.size(); } 00155 00159 FCDMorphTarget* GetTarget(size_t index) { FUAssert(index < GetTargetCount(), return NULL); return morphTargets.at(index); } 00160 const FCDMorphTarget* GetTarget(size_t index) const { FUAssert(index < GetTargetCount(), return NULL); return morphTargets.at(index); } 00166 FCDMorphTarget* AddTarget(FCDGeometry* geometry = NULL, float weight = 0.0f); 00167 00170 void ReleaseTarget(FCDMorphTarget* target); 00171 00174 FUDaeMorphMethod::Method GetMethod() const { return method; } 00175 00178 void SetMethod(FUDaeMorphMethod::Method _method) { method = _method; } 00179 00184 bool IsSimilar(FCDEntity* entity); 00185 00190 FUStatus LoadFromXML(xmlNode* morphNode); 00191 00195 xmlNode* WriteToXML(xmlNode* parentNode) const; 00196 00200 FUStatus Link(); 00201 }; 00202 00203 #endif // _FCD_MORPH_CONTROLLER_H_ 00204