LevelLoader - Added new CollisionGeometry_TriangleMesh.
This commit is contained in:
parent
e72f2224be
commit
86ef521abd
|
@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue