diff --git a/Code/Game/GameLogic/LevelLoader/ObjectDefines.h b/Code/Game/GameLogic/LevelLoader/ObjectDefines.h index 01d17c3e..131b2938 100644 --- a/Code/Game/GameLogic/LevelLoader/ObjectDefines.h +++ b/Code/Game/GameLogic/LevelLoader/ObjectDefines.h @@ -52,6 +52,7 @@ namespace GameLogic CollisionGeometryType_Box, CollisionGeometryType_Sphere, CollisionGeometryType_Cylinder, + CollisionGeometryType_TriangleMesh, CollisionGeometryType_Count, CollisionGeometryType_Unknown = -1 @@ -161,6 +162,12 @@ namespace GameLogic float radius; }; + struct BoundingVolumeTriangleMesh : public BoundingVolumeBase + { + //Null terminated + wchar_t* filename; + }; + struct BoundingVolume { CollisionGeometryType geoType; @@ -169,7 +176,16 @@ namespace GameLogic LevelLoaderInternal::BoundingVolumeBox box; LevelLoaderInternal::BoundingVolumeSphere sphere; LevelLoaderInternal::BoundingVolumeCylinder cylinder; + LevelLoaderInternal::BoundingVolumeTriangleMesh triangleMesh; }; + + virtual ~BoundingVolume() + { + if(geoType == CollisionGeometryType_TriangleMesh) + { + delete[] triangleMesh.filename; + } + } }; } diff --git a/Code/Game/GameLogic/LevelLoader/ParseFunctions.cpp b/Code/Game/GameLogic/LevelLoader/ParseFunctions.cpp index dfee72a7..daa62752 100644 --- a/Code/Game/GameLogic/LevelLoader/ParseFunctions.cpp +++ b/Code/Game/GameLogic/LevelLoader/ParseFunctions.cpp @@ -175,6 +175,17 @@ namespace GameLogic start += sizeof(volume.cylinder); break; + case CollisionGeometryType_TriangleMesh: + //Get string size + memcpy(&tempSize, &buf[start], sizeof(tempSize)); + start += sizeof(tempSize); + + //Get actual string + volume.triangleMesh.filename = new wchar_t[tempSize+1]; + memcpy(volume.triangleMesh.filename, &buf[start], tempSize); + volume.triangleMesh.filename[tempSize] = '\0'; + break; + default: break; }