Marko Pintera пре 13 година
родитељ
комит
8ff3d22a01

+ 11 - 0
CamelotRenderer/Include/CmResourceST.h

@@ -21,6 +21,17 @@ namespace CamelotEngine
 			addPlainField("UUID", 1, &ResourceST::getUUID, &ResourceST::setUUID);
 		}
 
+		virtual const String& getRTTIName()
+		{
+			static String name = "Resource";
+			return name;
+		}
+
+		virtual UINT32 getRTTIId()
+		{
+			return 100;
+		}
+
 		virtual Resource* newRTTIObject()
 		{
 			CM_EXCEPT(InternalErrorException, "Cannot instantiate an abstract class.");

+ 11 - 0
CamelotRenderer/Include/CmTextureST.h

@@ -76,6 +76,17 @@ namespace CamelotEngine
 				&TextureST::setTextureData, &TextureST::setTextureDataArraySize);
 		}
 
+		virtual const String& getRTTIName()
+		{
+			static String name = "Texture";
+			return name;
+		}
+
+		virtual UINT32 getRTTIId()
+		{
+			return 101;
+		}
+
 		virtual Texture* newRTTIObject()
 		{
 			CM_EXCEPT(InternalErrorException, "Cannot instantiate abstract class!");

+ 2 - 0
CamelotRenderer/TODO.txt

@@ -45,6 +45,8 @@ TODO:
  - OpenGL too
 
 TOMORROW:
+ - Check for duplicate type IDs in InitRTTIOnStart
+ - Actually serialize type ID into a file, and use them when deserializing
  - ISerializable class and begin/endSerialization are probably not needed and can be removed
  - Depth test is disabled by default (OpenGL renderer at least)
  - Non-dynamic-size types cannot have size over 255 bytes but that isn't marked or checked anywhere!

+ 4 - 0
CamelotUtility/Include/CmRTTIType.h

@@ -46,6 +46,8 @@ namespace CamelotEngine
 
 		virtual void registerDerivedClass(RTTITypeBase* derivedClass) = 0;
 		virtual IReflectable* newRTTIObject() = 0;
+		virtual const String& getRTTIName() = 0;
+		virtual UINT32 getRTTIId() = 0;
 
 		template <class ObjectType, class DataType>
 		void setPlainValue(ObjectType* object, const std::string& name, DataType& value)
@@ -256,6 +258,7 @@ namespace CamelotEngine
 	public:
 		InitRTTIOnStart()
 		{
+			// TODO - Check if type ID is unique
 			BaseType::getRTTIStatic()->registerDerivedClass(Type::getRTTIStatic());
 		}
 	};
@@ -269,6 +272,7 @@ namespace CamelotEngine
 	public:
 		InitRTTIOnStart()
 		{
+			// TODO - Check if type ID is unique
 			IReflectable::registerDerivedClass(Type::getRTTIStatic());
 		}
 	};

+ 11 - 0
CamelotUtility/Include/CmTextureDataST.h

@@ -44,6 +44,17 @@ namespace CamelotEngine
 			addDataBlockField("Data", 8, &TextureDataST::getData, &TextureDataST::setData);
 		}
 
+		virtual const String& getRTTIName()
+		{
+			static String name = "TextureData";
+			return name;
+		}
+
+		virtual UINT32 getRTTIId()
+		{
+			return 102;
+		}
+
 		virtual TextureData* newRTTIObject()
 		{
 			return new TextureData();