FCDocument/FCDControllerInstance.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005-2007 Feeling Software Inc.
00003     Portions of the code are:
00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
00005     
00006     MIT License: http://www.opensource.org/licenses/mit-license.php
00007 */
00008 
00014 #ifndef _FCD_CONTROLLER_INSTANCE_H_
00015 #define _FCD_CONTROLLER_INSTANCE_H_
00016 
00017 #ifndef _FCD_GEOMETRY_ENTITY_H_
00018 #include "FCDocument/FCDGeometryInstance.h"
00019 #endif // _FCD_GEOMETRY_ENTITY_H_
00020 
00021 #ifndef _FU_URI_H_
00022 #include "FUtils/FUUri.h"
00023 #endif // _FU_URI_H_
00024 
00025 class FCDSkinController;
00026 class FCDSceneNode;
00027 typedef fm::pvector<FCDSceneNode> FCDSceneNodeList; 
00028 typedef FUTrackedList<FCDSceneNode> FCDSceneNodeTrackList; 
00047 class FCOLLADA_EXPORT FCDControllerInstance : public FCDGeometryInstance
00048 {
00049 private:
00050     DeclareObjectType(FCDGeometryInstance);
00051 
00052     friend class FCDEntityInstanceFactory;
00053 
00054     FUUriList skeletonRoots;
00055     DeclareParameterTrackList(FCDSceneNode, joints, FC("Skeleton Joints"));
00056 
00057 protected:
00064     FCDControllerInstance(FCDocument* document, FCDSceneNode* parent, FCDEntity::Type entityType = FCDEntity::CONTROLLER);
00065 
00066 public:
00068     virtual ~FCDControllerInstance();
00069 
00074     virtual Type GetType() const { return CONTROLLER; }
00075 
00081     virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const;
00082 
00085     const FUUriList& GetSkeletonRoots() const { return skeletonRoots; }
00086     FUUriList& GetSkeletonRoots() { return skeletonRoots; }
00087 
00092     void FindSkeletonNodes(FCDSceneNodeList& skeletonNodes) const;
00093 
00095     void CalculateRootIds();
00096 
00101     size_t GetJointCount() const { return joints.size(); }
00102 
00104     void ResetJoints() { joints.clear(); skeletonRoots.clear(); }
00105 
00109     inline FCDSceneNode* GetJoint(size_t index) { FUAssert(index < GetJointCount(), return NULL); return joints.at(index); }
00110     inline const FCDSceneNode* GetJoint(size_t index) const { FUAssert(index < GetJointCount(), return NULL); return joints.at(index); } 
00114     bool AddJoint(FCDSceneNode* j);
00115 
00119     bool FindJoint(const FCDSceneNode* joint) const; 
00124     size_t FindJointIndex(const FCDSceneNode* joint) const;
00125 
00128     inline void RemoveJoint(size_t index) { joints.erase(index); }
00129 
00132     inline void RemoveJoint(FCDSceneNode* joint) { joints.erase(joint); }
00133 
00134 private:
00135     void AppendJoint(FCDSceneNode* j);
00136 
00137     const FCDSkinController* FindSkin(const FCDEntity* entity) const;
00138     inline FCDSkinController* FindSkin(FCDEntity* entity) { return const_cast<FCDSkinController*>(const_cast<const FCDControllerInstance*>(this)->FindSkin(entity)); }
00139 };
00140 
00141 #endif // _FCD_CONTROLLER_INSTANCE_H_
00142 

Generated on Thu Feb 14 16:58:33 2008 for FCollada by  doxygen 1.4.6-NO