00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00020 #ifndef _FCD_ENTITY_INSTANCE_H_
00021 #define _FCD_ENTITY_INSTANCE_H_
00022
00023 #ifndef _FCD_ENTITY_H_
00024 #include "FCDocument/FCDEntity.h"
00025 #endif // _FCD_ENTITY_H_
00026
00027 class FCDocument;
00028 class FCDENode;
00029 class FCDSceneNode;
00030 class FCDEntityInstanceFactory;
00031 class FCDEntityReference;
00032 class FCDEntityInstance;
00033 class FUUri;
00034
00035 template <class T> class FUUniqueStringMapT;
00036 typedef FUUniqueStringMapT<char> FUSUniqueStringMap;
00049 class FCOLLADA_EXPORT FCDEntityInstance : public FCDObject, FUTracker
00050 {
00051 public:
00054 enum Type
00055 {
00056 SIMPLE,
00058 GEOMETRY,
00059 CONTROLLER,
00060 MATERIAL,
00061 PHYSICS_MODEL,
00062 PHYSICS_RIGID_BODY,
00063 PHYSICS_RIGID_CONSTRAINT,
00064 PHYSICS_FORCE_FIELD,
00065 TYPE_COUNT
00066 };
00067
00068 private:
00069 DeclareObjectType(FCDObject);
00070 friend class FCDEntityInstanceFactory;
00071
00072 FCDSceneNode* parent;
00073 FCDEntity::Type entityType;
00074 DeclareParameterPtr(FCDEntityReference, entityReference, FC("Entity Reference"));
00075
00076
00077 fstring name;
00078 DeclareParameter(fm::string, FUParameterQualifiers::SIMPLE, wantedSubId, FC("Instance Sub-id"));
00079
00080
00081 DeclareParameterRef(FCDExtra, extra, FC("Extra Tree"));
00082
00083 protected:
00091 FCDEntityInstance(FCDocument* document, FCDSceneNode* parent, FCDEntity::Type type);
00092
00093 public:
00095 virtual ~FCDEntityInstance();
00096
00101 virtual Type GetType() const { return SIMPLE; }
00102
00106 inline FCDEntity::Type GetEntityType() const { return entityType; }
00107
00111 FCDEntity* GetEntity();
00112
00117 inline const FCDEntity* GetEntity() const { return ((FCDEntityInstance*)(this))->GetEntity(); }
00118
00122 const FUUri GetEntityUri() const;
00123
00126 void SetEntityUri(const FUUri& uri);
00127
00131 void SetEntity(FCDEntity* entity);
00132
00134 inline FCDEntityReference* GetEntityReference() { return entityReference; }
00135 inline const FCDEntityReference* GetEntityReference() const { return entityReference; }
00141 inline const fstring& GetName() const { return name; }
00142
00147 void SetName(const fstring& name);
00148
00153 inline const fm::string& GetWantedSubId() const { return wantedSubId; }
00154
00158 inline void SetWantedSubId(const fm::string& _wantedSubId) { wantedSubId = _wantedSubId; }
00159
00165 FCDExtra* GetExtra();
00166 inline const FCDExtra* GetExtra() const { return const_cast<FCDEntityInstance*>(this)->GetExtra(); }
00170 bool IsExternalReference() const;
00171
00175 inline FCDSceneNode* GetParent() { return parent; }
00176 inline const FCDSceneNode* GetParent() const { return parent; }
00182 bool HasForParent(FCDSceneNode* node) const;
00183
00187 virtual void CleanSubId(FUSUniqueStringMap* parentStringMap = NULL);
00188
00192 virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const;
00193
00194 protected:
00199
00200
00203 virtual void OnObjectReleased(FUTrackable* object);
00204 };
00205
00211 class FCOLLADA_EXPORT FCDEntityInstanceFactory
00212 {
00213 private:
00214 FCDEntityInstanceFactory() {}
00215
00216 public:
00223 static FCDEntityInstance* CreateInstance(FCDocument* document, FCDSceneNode* parent, FCDEntity::Type type);
00224
00231 static FCDEntityInstance* CreateInstance(FCDocument* document, FCDSceneNode* parent, FCDEntity *entity);
00232 };
00233
00234
00235 #endif // _FCD_ENTITY_INSTANCE_H_