Forráskód Böngészése

Before refactoring IReflectable a bit

Marko Pintera 13 éve
szülő
commit
b20c4e9794

+ 44 - 41
CamelotFBXImporter/Source/CmFBXImporter.cpp

@@ -298,30 +298,33 @@ namespace CamelotEngine
 		meshData->vertexCount = lPolygonVertexCount;
 		
 		meshData->index = new int[lPolygonCount * 3];
-		meshData->vertex = new Vector3[lPolygonVertexCount];
+
+		std::shared_ptr<MeshData::VertexData> vertexData = std::shared_ptr<MeshData::VertexData>(new MeshData::VertexData(lPolygonVertexCount));
+		meshData->vertexBuffers.insert(std::make_pair(0, vertexData));
+		vertexData->vertex = new Vector3[lPolygonVertexCount];
 
 		if (hasNormal)
-			meshData->normal = new Vector3[lPolygonVertexCount];
+			vertexData->normal = new Vector3[lPolygonVertexCount];
 
 		if (hasTangent)
-			meshData->tangent = new Vector3[lPolygonVertexCount];
+			vertexData->tangent = new Vector3[lPolygonVertexCount];
 
 		if (hasBitangent)
-			meshData->bitangent = new Vector3[lPolygonVertexCount];
+			vertexData->bitangent = new Vector3[lPolygonVertexCount];
 
 		FbxStringList lUVNames;
 		mesh->GetUVSetNames(lUVNames);
 		const char * lUVName0 = NULL;
 		if (hasUV0 && lUVNames.GetCount() > 0)
 		{
-			meshData->uv0 = new Vector2[lPolygonVertexCount];
+			vertexData->uv0 = new Vector2[lPolygonVertexCount];
 			lUVName0 = lUVNames[0];
 		}
 
 		const char * lUVName1 = NULL;
 		if (hasUV1 && lUVNames.GetCount() > 1)
 		{
-			meshData->uv1 = new Vector2[lPolygonVertexCount];
+			vertexData->uv1 = new Vector2[lPolygonVertexCount];
 			lUVName1 = lUVNames[1];
 		}
 
@@ -357,9 +360,9 @@ namespace CamelotEngine
 			{
 				// Save the vertex position.
 				lCurrentVertex = lControlPoints[lIndex];
-				meshData->vertex[lIndex][0] = static_cast<float>(lCurrentVertex[0]);
-				meshData->vertex[lIndex][1] = static_cast<float>(lCurrentVertex[1]);
-				meshData->vertex[lIndex][2] = static_cast<float>(lCurrentVertex[2]);
+				vertexData->vertex[lIndex][0] = static_cast<float>(lCurrentVertex[0]);
+				vertexData->vertex[lIndex][1] = static_cast<float>(lCurrentVertex[1]);
+				vertexData->vertex[lIndex][2] = static_cast<float>(lCurrentVertex[2]);
 
 				// Save the normal.
 				if (hasNormal)
@@ -369,9 +372,9 @@ namespace CamelotEngine
 						lNormalIndex = lNormalElement->GetIndexArray().GetAt(lIndex);
 
 					lCurrentNormal = lNormalElement->GetDirectArray().GetAt(lNormalIndex);
-					meshData->normal[lIndex][0] = static_cast<float>(lCurrentNormal[0]);
-					meshData->normal[lIndex][1] = static_cast<float>(lCurrentNormal[1]);
-					meshData->normal[lIndex][2] = static_cast<float>(lCurrentNormal[2]);
+					vertexData->normal[lIndex][0] = static_cast<float>(lCurrentNormal[0]);
+					vertexData->normal[lIndex][1] = static_cast<float>(lCurrentNormal[1]);
+					vertexData->normal[lIndex][2] = static_cast<float>(lCurrentNormal[2]);
 				}
 
 				// Save the tangent.
@@ -382,9 +385,9 @@ namespace CamelotEngine
 						lTangentIndex = lTangentElement->GetIndexArray().GetAt(lIndex);
 
 					FbxVector4 lCurrentTangent = lTangentElement->GetDirectArray().GetAt(lTangentIndex);
-					meshData->tangent[lIndex][0] = static_cast<float>(lCurrentTangent[0]);
-					meshData->tangent[lIndex][1] = static_cast<float>(lCurrentTangent[1]);
-					meshData->tangent[lIndex][2] = static_cast<float>(lCurrentTangent[2]);
+					vertexData->tangent[lIndex][0] = static_cast<float>(lCurrentTangent[0]);
+					vertexData->tangent[lIndex][1] = static_cast<float>(lCurrentTangent[1]);
+					vertexData->tangent[lIndex][2] = static_cast<float>(lCurrentTangent[2]);
 				}
 
 				// Save the tangent.
@@ -395,9 +398,9 @@ namespace CamelotEngine
 						lBitangentIndex = lBitangentElement->GetIndexArray().GetAt(lIndex);
 
 					FbxVector4 lCurrentBitangent = lBitangentElement->GetDirectArray().GetAt(lBitangentIndex);
-					meshData->bitangent[lIndex][0] = static_cast<float>(lCurrentBitangent[0]);
-					meshData->bitangent[lIndex][1] = static_cast<float>(lCurrentBitangent[1]);
-					meshData->bitangent[lIndex][2] = static_cast<float>(lCurrentBitangent[2]);
+					vertexData->bitangent[lIndex][0] = static_cast<float>(lCurrentBitangent[0]);
+					vertexData->bitangent[lIndex][1] = static_cast<float>(lCurrentBitangent[1]);
+					vertexData->bitangent[lIndex][2] = static_cast<float>(lCurrentBitangent[2]);
 				}
 
 				// Save the UV.
@@ -408,8 +411,8 @@ namespace CamelotEngine
 						lUVIndex = lUVElement0->GetIndexArray().GetAt(lIndex);
 
 					lCurrentUV = lUVElement0->GetDirectArray().GetAt(lUVIndex);
-					meshData->uv0[lIndex][0] = static_cast<float>(lCurrentUV[0]);
-					meshData->uv0[lIndex][1] = static_cast<float>(lCurrentUV[1]);
+					vertexData->uv0[lIndex][0] = static_cast<float>(lCurrentUV[0]);
+					vertexData->uv0[lIndex][1] = static_cast<float>(lCurrentUV[1]);
 				}
 
 				if (hasUV1)
@@ -419,8 +422,8 @@ namespace CamelotEngine
 						lUVIndex = lUVElement1->GetIndexArray().GetAt(lIndex);
 
 					lCurrentUV = lUVElement1->GetDirectArray().GetAt(lUVIndex);
-					meshData->uv1[lIndex][0] = static_cast<float>(lCurrentUV[0]);
-					meshData->uv1[lIndex][1] = static_cast<float>(lCurrentUV[1]);
+					vertexData->uv1[lIndex][0] = static_cast<float>(lCurrentUV[0]);
+					vertexData->uv1[lIndex][1] = static_cast<float>(lCurrentUV[1]);
 				}
 			}
 		}
@@ -451,16 +454,16 @@ namespace CamelotEngine
 					meshData->index[lIndexOffset + lVerticeIndex] = static_cast<unsigned int>(lVertexCount);
 
 					lCurrentVertex = lControlPoints[lControlPointIndex];
-					meshData->vertex[lVertexCount][0] = static_cast<float>(lCurrentVertex[0]);
-					meshData->vertex[lVertexCount][1] = static_cast<float>(lCurrentVertex[1]);
-					meshData->vertex[lVertexCount][2] = static_cast<float>(lCurrentVertex[2]);
+					vertexData->vertex[lVertexCount][0] = static_cast<float>(lCurrentVertex[0]);
+					vertexData->vertex[lVertexCount][1] = static_cast<float>(lCurrentVertex[1]);
+					vertexData->vertex[lVertexCount][2] = static_cast<float>(lCurrentVertex[2]);
 
 					if (hasNormal)
 					{
 						mesh->GetPolygonVertexNormal(lPolygonIndex, lVerticeIndex, lCurrentNormal);
-						meshData->normal[lVertexCount][0] = static_cast<float>(lCurrentNormal[0]);
-						meshData->normal[lVertexCount][1] = static_cast<float>(lCurrentNormal[1]);
-						meshData->normal[lVertexCount][2] = static_cast<float>(lCurrentNormal[2]);
+						vertexData->normal[lVertexCount][0] = static_cast<float>(lCurrentNormal[0]);
+						vertexData->normal[lVertexCount][1] = static_cast<float>(lCurrentNormal[1]);
+						vertexData->normal[lVertexCount][2] = static_cast<float>(lCurrentNormal[2]);
 					}
 
 					if (hasTangent)
@@ -470,9 +473,9 @@ namespace CamelotEngine
 							lTangentIndex = lTangentElement->GetIndexArray().GetAt(lTangentIndex);
 
 						FbxVector4 lCurrentTangent = lTangentElement->GetDirectArray().GetAt(lTangentIndex);
-						meshData->tangent[lVertexCount][0] = static_cast<float>(lCurrentTangent[0]);
-						meshData->tangent[lVertexCount][1] = static_cast<float>(lCurrentTangent[1]);
-						meshData->tangent[lVertexCount][2] = static_cast<float>(lCurrentTangent[2]);
+						vertexData->tangent[lVertexCount][0] = static_cast<float>(lCurrentTangent[0]);
+						vertexData->tangent[lVertexCount][1] = static_cast<float>(lCurrentTangent[1]);
+						vertexData->tangent[lVertexCount][2] = static_cast<float>(lCurrentTangent[2]);
 					}
 
 					if (hasBitangent)
@@ -482,31 +485,31 @@ namespace CamelotEngine
 							lBitangentIndex = lBitangentElement->GetIndexArray().GetAt(lBitangentIndex);
 
 						FbxVector4 lCurrentBitangent = lBitangentElement->GetDirectArray().GetAt(lBitangentIndex);
-						meshData->bitangent[lVertexCount][0] = static_cast<float>(lCurrentBitangent[0]);
-						meshData->bitangent[lVertexCount][1] = static_cast<float>(lCurrentBitangent[1]);
-						meshData->bitangent[lVertexCount][2] = static_cast<float>(lCurrentBitangent[2]);
+						vertexData->bitangent[lVertexCount][0] = static_cast<float>(lCurrentBitangent[0]);
+						vertexData->bitangent[lVertexCount][1] = static_cast<float>(lCurrentBitangent[1]);
+						vertexData->bitangent[lVertexCount][2] = static_cast<float>(lCurrentBitangent[2]);
 					}
 
 					if (hasNormal)
 					{
 						mesh->GetPolygonVertexNormal(lPolygonIndex, lVerticeIndex, lCurrentNormal);
-						meshData->normal[lVertexCount][0] = static_cast<float>(lCurrentNormal[0]);
-						meshData->normal[lVertexCount][1] = static_cast<float>(lCurrentNormal[1]);
-						meshData->normal[lVertexCount][2] = static_cast<float>(lCurrentNormal[2]);
+						vertexData->normal[lVertexCount][0] = static_cast<float>(lCurrentNormal[0]);
+						vertexData->normal[lVertexCount][1] = static_cast<float>(lCurrentNormal[1]);
+						vertexData->normal[lVertexCount][2] = static_cast<float>(lCurrentNormal[2]);
 					}
 
 					if (hasUV0)
 					{
 						mesh->GetPolygonVertexUV(lPolygonIndex, lVerticeIndex, lUVName0, lCurrentUV);
-						meshData->uv0[lVertexCount][0] = static_cast<float>(lCurrentUV[0]);
-						meshData->uv0[lVertexCount][1] = static_cast<float>(lCurrentUV[1]);
+						vertexData->uv0[lVertexCount][0] = static_cast<float>(lCurrentUV[0]);
+						vertexData->uv0[lVertexCount][1] = static_cast<float>(lCurrentUV[1]);
 					}
 
 					if (hasUV1)
 					{
 						mesh->GetPolygonVertexUV(lPolygonIndex, lVerticeIndex, lUVName1, lCurrentUV);
-						meshData->uv1[lVertexCount][0] = static_cast<float>(lCurrentUV[0]);
-						meshData->uv1[lVertexCount][1] = static_cast<float>(lCurrentUV[1]);
+						vertexData->uv1[lVertexCount][0] = static_cast<float>(lCurrentUV[0]);
+						vertexData->uv1[lVertexCount][1] = static_cast<float>(lCurrentUV[1]);
 					}
 				}
 				++lVertexCount;

+ 3 - 0
CamelotRenderer/CamelotRenderer.vcxproj

@@ -114,6 +114,8 @@
     <ClInclude Include="Include\CmHighLevelGpuProgramManager.h" />
     <ClInclude Include="Include\CmImporter.h" />
     <ClInclude Include="Include\CmMesh.h" />
+    <ClInclude Include="Include\CmMeshData.h" />
+    <ClInclude Include="Include\CmMeshDataST.h" />
     <ClInclude Include="Include\CmPrerequisites.h" />
     <ClInclude Include="Include\CmRenderOperation.h" />
     <ClInclude Include="Include\CmRenderSystem.h" />
@@ -160,6 +162,7 @@
     <ClCompile Include="Source\CmHighLevelGpuProgramManager.cpp" />
     <ClCompile Include="Source\CmImporter.cpp" />
     <ClCompile Include="Source\CmMesh.cpp" />
+    <ClCompile Include="Source\CmMeshData.cpp" />
     <ClCompile Include="Source\CmRenderSystem.cpp" />
     <ClCompile Include="Source\CmRenderSystemCapabilities.cpp" />
     <ClCompile Include="Source\CmRenderSystemManager.cpp" />

+ 9 - 0
CamelotRenderer/CamelotRenderer.vcxproj.filters

@@ -199,6 +199,12 @@
     <ClInclude Include="Source\CmMeshST.h">
       <Filter>Header Files\Serialization</Filter>
     </ClInclude>
+    <ClInclude Include="Include\CmMeshDataST.h">
+      <Filter>Header Files\Serialization</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\CmMeshData.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\CamelotRenderer.cpp">
@@ -309,5 +315,8 @@
     <ClCompile Include="Source\CmMesh.cpp">
       <Filter>Source Files\Resources</Filter>
     </ClCompile>
+    <ClCompile Include="Source\CmMeshData.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 29 - 0
CamelotRenderer/Include/CmMesh.h

@@ -2,13 +2,42 @@
 
 #include "CmPrerequisites.h"
 #include "CmResource.h"
+#include "CmMeshData.h"
+#include "CmVertexIndexData.h"
 
 namespace CamelotEngine
 {
+	struct SubMesh
+	{
+		SubMesh():
+			indexOffset(0), indexCount(0)
+		{ }
+
+		int indexOffset;
+		int indexCount;
+	};
+
 	class Mesh : public Resource
 	{
+	public:
+		Mesh();
+		virtual ~Mesh();
+
+		/**
+		 * @brief	Mesh data that is used for initializing the mesh. Needs to be set before calling load.
+		 */
+		void prepare(MeshDataPtr meshData);
+
 		virtual void load();
 
+	private:
+		MeshDataPtr mMeshData;
+
+		VertexData* mVertexData;
+		IndexData* mIndexData;
+
+		vector<SubMesh>::type mSubMeshes;
+
 		/************************************************************************/
 		/* 								SERIALIZATION                      		*/
 		/************************************************************************/

+ 64 - 0
CamelotRenderer/Include/CmMeshData.h

@@ -0,0 +1,64 @@
+#pragma once
+
+#include "CmPrerequisites.h"
+#include "CmIReflectable.h"
+
+namespace CamelotEngine
+{
+	class CM_EXPORT MeshData : public IReflectable
+	{
+	public:
+		struct SubMeshData
+		{
+			SubMeshData():
+				indexOffset(0), indexCount(0)
+			{ }
+
+			int indexOffset;
+			int indexCount;
+		};
+
+		struct VertexData : public IReflectable
+		{
+			VertexData(UINT32 vertexCount);
+			~VertexData();
+
+			Vector3* vertex;
+			Vector3* normal;
+			Vector3* tangent;
+			Vector3* bitangent;
+			Vector2* uv0;
+			Vector2* uv1;
+
+			UINT32 vertexCount;
+
+			/************************************************************************/
+			/* 								SERIALIZATION                      		*/
+			/************************************************************************/
+		public:
+			friend class VertexDataST;
+			static RTTITypeBase* getRTTIStatic();
+			virtual RTTITypeBase* getRTTI() const;
+		};
+
+		MeshData();
+		~MeshData();
+
+		int* index;
+
+		int indexCount;
+		int vertexCount;
+
+		VertexDeclaration* declaration;
+		map<int, std::shared_ptr<VertexData>>::type vertexBuffers;
+		vector<SubMeshData>::type subMeshes;
+
+		/************************************************************************/
+		/* 								SERIALIZATION                      		*/
+		/************************************************************************/
+	public:
+		friend class MeshDataST;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const;
+	};
+}

+ 105 - 0
CamelotRenderer/Include/CmMeshDataST.h

@@ -0,0 +1,105 @@
+#pragma once
+
+#include "CmPrerequisites.h"
+#include "CmRTTIType.h"
+#include "CmMeshData.h"
+#include "CmManagedDataBlock.h"
+
+namespace CamelotEngine
+{
+	class CM_EXPORT VertexDataST : public RTTIType<MeshData::VertexData, IReflectable, VertexDataST>
+	{
+	private:
+		CM_SETGET_DATABLOCK_MEMBER(vertex, vertexCount, Vector3, MeshData::VertexData)
+		CM_SETGET_DATABLOCK_MEMBER(normal, vertexCount, Vector3, MeshData::VertexData)
+		CM_SETGET_DATABLOCK_MEMBER(tangent, vertexCount, Vector3, MeshData::VertexData)
+		CM_SETGET_DATABLOCK_MEMBER(bitangent, vertexCount, Vector3, MeshData::VertexData)
+		CM_SETGET_DATABLOCK_MEMBER(uv0, vertexCount, Vector2, MeshData::VertexData)
+		CM_SETGET_DATABLOCK_MEMBER(uv1, vertexCount, Vector2, MeshData::VertexData)
+
+		CM_SETGET_MEMBER(vertexCount, UINT32, MeshData::VertexData);
+	public:
+		VertexDataST()
+		{
+			CM_ADD_DATABLOCKFIELD(vertex, 0, VertexDataST)
+			CM_ADD_DATABLOCKFIELD(normal, 1, VertexDataST)
+			CM_ADD_DATABLOCKFIELD(tangent, 2, VertexDataST)
+			CM_ADD_DATABLOCKFIELD(bitangent, 3, VertexDataST)
+			CM_ADD_DATABLOCKFIELD(uv0, 4, VertexDataST)
+			CM_ADD_DATABLOCKFIELD(uv1, 5, VertexDataST)
+
+			CM_ADD_PLAINFIELD(vertexCount, 7, VertexDataST)
+		}
+
+		virtual std::shared_ptr<IReflectable> newRTTIObject() 
+		{
+			return std::shared_ptr<MeshData::VertexData>(new MeshData::VertexData(0));
+		}
+
+		virtual const String& getRTTIName() 
+		{
+			static String name = "MeshData::VertexData";
+			throw name;
+		}
+
+		virtual UINT32 getRTTIId() 
+		{
+			return 104;
+		}
+	};
+
+	class CM_EXPORT MeshDataST : public RTTIType<MeshData, IReflectable, MeshDataST>
+	{
+	private:
+		CM_SETGET_MEMBER(indexCount, INT32, MeshData)
+		CM_SETGET_MEMBER(vertexCount, INT32, MeshData);
+
+		CM_SETGET_DATABLOCK_MEMBER(index, indexCount, int, MeshData)
+
+		MeshData::SubMeshData& getSubmesh(MeshData* obj, UINT32 idx)
+		{
+			return obj->subMeshes[idx];
+		}
+
+		void setSubmesh(MeshData* obj, UINT32 idx, MeshData::SubMeshData& data)
+		{
+			obj->subMeshes[idx] = data;
+		}
+
+		UINT32 getSubmeshArraySize(MeshData* obj)
+		{
+			return obj->subMeshes.size();
+		}
+
+		void setSubmeshArraySize(MeshData* obj, UINT32 size)
+		{
+			obj->subMeshes.resize(size);
+		}
+	public:
+		MeshDataST()
+		{
+			CM_ADD_DATABLOCKFIELD(index, 6, MeshDataST)
+
+			CM_ADD_PLAINFIELD(indexCount, 7, MeshDataST)
+			CM_ADD_PLAINFIELD(vertexCount, 8, MeshDataST)
+
+			addPlainArrayField("subMeshes", 9, &MeshDataST::getSubmesh, &MeshDataST::getSubmeshArraySize, &MeshDataST::setSubmesh, &MeshDataST::setSubmeshArraySize);
+		}
+
+		virtual std::shared_ptr<IReflectable> newRTTIObject() 
+		{
+			return std::shared_ptr<MeshData>(new MeshData());
+		}
+
+		virtual const String& getRTTIName() 
+		{
+			static String name = "MeshData";
+			throw name;
+		}
+
+		virtual UINT32 getRTTIId() 
+		{
+			return 103;
+		}
+	};
+}

+ 19 - 0
CamelotRenderer/Source/CmMesh.cpp

@@ -3,8 +3,27 @@
 
 namespace CamelotEngine
 {
+	Mesh::Mesh()
+	{
+
+	}
+
+	Mesh::~Mesh()
+	{
+	}
+
+	void Mesh::prepare(MeshDataPtr meshData)
+	{
+		mMeshData = meshData;
+	}
+
 	void Mesh::load()
 	{
+		if(mMeshData == nullptr)
+		{
+			CM_EXCEPT(InternalErrorException, "Cannot load mesh. Mesh data hasn't been set.");
+		}
+
 		throw std::exception("The method or operation is not implemented.");
 	}
 

+ 28 - 12
CamelotUtility/Source/CmMeshData.cpp → CamelotRenderer/Source/CmMeshData.cpp

@@ -5,19 +5,14 @@
 
 namespace CamelotEngine
 {
-	MeshData::MeshData()
-	   :vertex(nullptr),
-		normal(nullptr),
-		tangent(nullptr),
-		bitangent(nullptr),
-		uv0(nullptr),
-		uv1(nullptr),
-		index(nullptr),
-		indexCount(0),
-		vertexCount(0)
-	{ }
+	MeshData::VertexData::VertexData(UINT32 vertexCount)
+		:vertex(nullptr), normal(nullptr), tangent(nullptr), 
+		bitangent(nullptr), uv0(nullptr), uv1(nullptr)
+	{
+		this->vertexCount = vertexCount;
+	}
 
-	MeshData::~MeshData()
+	MeshData::VertexData::~VertexData()
 	{
 		if(vertex != nullptr)
 			delete [] vertex;
@@ -36,9 +31,30 @@ namespace CamelotEngine
 
 		if(uv1 != nullptr)
 			delete [] uv1;
+	}
+
+	RTTITypeBase* MeshData::VertexData::getRTTIStatic()
+	{
+		return VertexDataST::instance();
+	}
 
+	RTTITypeBase* MeshData::VertexData::getRTTI() const
+	{
+		return getRTTIStatic();
+	}
+
+	MeshData::MeshData()
+	   :index(nullptr),
+		indexCount(0),
+		vertexCount(0)
+	{ }
+
+	MeshData::~MeshData()
+	{
 		if(index != nullptr)
 			delete [] index;
+
+		vertexBuffers.clear();
 	}
 
 	/************************************************************************/

+ 0 - 3
CamelotUtility/CamelotUtility.vcxproj

@@ -82,7 +82,6 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClCompile Include="Source\CmMeshData.cpp" />
     <ClInclude Include="Include\CmBinarySerializer.h" />
     <ClInclude Include="Include\CmBitwise.h" />
     <ClInclude Include="Include\CmBox.h" />
@@ -96,7 +95,6 @@
     <ClInclude Include="Include\CmLog.h" />
     <ClInclude Include="Include\CmManagedDataBlock.h" />
     <ClInclude Include="Include\CmMathAsm.h" />
-    <ClInclude Include="Include\CmMeshDataST.h" />
     <ClInclude Include="Include\CmModule.h" />
     <ClInclude Include="Include\CmPath.h" />
     <ClInclude Include="Include\CmPixelUtil.h" />
@@ -138,7 +136,6 @@
     <ClCompile Include="Source\CmTextureData.cpp">
       <FileType>CppHeader</FileType>
     </ClCompile>
-    <ClInclude Include="Include\CmMeshData.h" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Include\CmAxisAlignedBox.cpp" />

+ 0 - 9
CamelotUtility/CamelotUtility.vcxproj.filters

@@ -177,12 +177,6 @@
     <ClInclude Include="Include\CmFileSystem.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Include\CmMeshData.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Include\CmMeshDataST.h">
-      <Filter>Header Files\SerializationTypes</Filter>
-    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Include\CmAxisAlignedBox.cpp">
@@ -260,8 +254,5 @@
     <ClCompile Include="Source\CmFileSystem.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="Source\CmMeshData.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
   </ItemGroup>
 </Project>

+ 0 - 45
CamelotUtility/Include/CmMeshData.h

@@ -1,45 +0,0 @@
-#pragma once
-
-#include "CmPrerequisitesUtil.h"
-#include "CmIReflectable.h"
-
-namespace CamelotEngine
-{
-	class CM_UTILITY_EXPORT MeshData : public IReflectable
-	{
-	public:
-		struct SubMeshData
-		{
-			SubMeshData():
-				indexOffset(0), indexCount(0)
-			{ }
-
-			int indexOffset;
-			int indexCount;
-		};
-
-		MeshData();
-		~MeshData();
-
-		Vector3* vertex;
-		Vector3* normal;
-		Vector3* tangent;
-		Vector3* bitangent;
-		Vector2* uv0;
-		Vector2* uv1;
-		int* index;
-
-		int indexCount;
-		int vertexCount;
-
-		vector<SubMeshData>::type subMeshes;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class MeshDataST;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const;
-	};
-}

+ 0 - 33
CamelotUtility/Include/CmMeshDataST.h

@@ -1,33 +0,0 @@
-#pragma once
-
-#include "CmPrerequisitesUtil.h"
-#include "CmRTTIType.h"
-#include "CmMeshData.h"
-
-namespace CamelotEngine
-{
-	class MeshDataST : public RTTIType<MeshData, IReflectable, MeshDataST>
-	{
-	public:
-		MeshDataST()
-		{
-
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() 
-		{
-			return std::shared_ptr<MeshData>(new MeshData());
-		}
-
-		virtual const String& getRTTIName() 
-		{
-			static String name = "MeshData";
-			throw name;
-		}
-
-		virtual UINT32 getRTTIId() 
-		{
-			return 103;
-		}
-	};
-}

+ 7 - 0
CamelotUtility/Include/CmRTTIType.h

@@ -24,9 +24,16 @@ namespace CamelotEngine
 	type##& get##name(parentType##* obj) { return obj->##name; }				\
 	void set##name(parentType##* obj, type##& val) { obj->##name = val; } 
 
+#define CM_SETGET_DATABLOCK_MEMBER(name, sizeField, type, parentType)								\
+	ManagedDataBlock get##name(parentType##* obj) { return ManagedDataBlock((UINT8*)obj->##name, obj->##sizeField, false); }				\
+	void set##name(parentType##* obj, ManagedDataBlock val) { obj->##name = (##type##*)val.getData(); } 
+
 #define CM_ADD_PLAINFIELD(name, id, parentType) \
 	addPlainField(#name, id##, &##parentType##::get##name, &##parentType##::set##name);
 
+#define CM_ADD_DATABLOCKFIELD(name, id, parentType) \
+	addDataBlockField(#name, id##, &##parentType##::get##name, &##parentType##::set##name);
+
 	/**
 	 * @brief	Provides an interface for accessing fields of a certain class.
 	 * 			Data can be easily accessed by getter and setter methods.