40 #ifndef _collisionshape_cpp
41 #define _collisionshape_cpp
43 #include "Physics/collisionshape.h"
44 #include "collisionshapemanager.h"
45 #include "stringtool.h"
48 #include "Physics/boxcollisionshape.h"
49 #include "Physics/capsulecollisionshape.h"
50 #include "Physics/conecollisionshape.h"
51 #include "Physics/convexhullcollisionshape.h"
52 #include "Physics/cylindercollisionshape.h"
53 #include "Physics/multispherecollisionshape.h"
54 #include "Physics/spherecollisionshape.h"
55 #include "Physics/dynamicmeshcollisionshape.h"
56 #include "Physics/heightfieldcollisionshape.h"
57 #include "Physics/planecollisionshape.h"
58 #include "Physics/softcollisionshape.h"
59 #include "Physics/staticmeshcollisionshape.h"
60 #include "Physics/compoundcollisionshape.h"
62 #include "btBulletDynamicsCommon.h"
163 {
return String(
"CollisionShape"); }
170 this->
Name = NewName;
185 switch(ShapeToCreate)
214 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an unsupported/unwrapped Collision Shape type into a CollisionShape instance."); }
227 switch(ShapeToCreate)
245 { MEZZ_EXCEPTION(
Exception::NOT_IMPLEMENTED_EXCEPTION,
"Attempting to convert an unsupported/unwrapped Collision Shape type into a CollisionShape instance, specifically a DynamicMeshCollisionShape."); }
252 { MEZZ_EXCEPTION(
Exception::NOT_IMPLEMENTED_EXCEPTION,
"Attempting to convert an unsupported/unwrapped Collision Shape type into a CollisionShape instance, specifically a SoftCollisionShape."); }
255 { MEZZ_EXCEPTION(
Exception::NOT_IMPLEMENTED_EXCEPTION,
"Attempting to convert an unsupported/unwrapped Collision Shape type into a CollisionShape instance, specifically a StaticMeshShape."); }
259 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an unsupported/unwrapped Collision Shape type into a CollisionShape instance."); }
265 switch(InternalShapeType)
281 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an unsupported/unwrapped Internal Collision Shape type into a Physics::CollisionShapeShapeType."); }
287 switch(ShapeToConvert)
309 if(TypeName.size()<5)
310 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert a CollisionShape::ShapeType String into a CollisionShape::ShapeType which is too short to be valid."); }
311 switch(TypeName.at(3))
314 if (
String(
"BoxCollisionShape")==TypeName)
317 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an invalid CollisionShape::ShapeType String into a CollisionShape::ShapeType 'C'."); }
319 if (
String(
"CapsuleCollisionShape")==TypeName)
322 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an invalid CollisionShape::ShapeType String into a CollisionShape::ShapeType 's'."); }
324 if (
String(
"SphereCollisionShape")==TypeName)
326 else if (
String(
"ConeCollisionShape")==TypeName)
329 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an invalid CollisionShape::ShapeType String into a CollisionShape::ShapeType 'e'."); }
331 if (
String(
"ConvexHullCollisionShape")==TypeName)
334 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an invalid CollisionShape::ShapeType String into a CollisionShape::ShapeType 'v'."); }
336 if (
String(
"CylinderCollisionShape")==TypeName)
339 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an invalid CollisionShape::ShapeType String into a CollisionShape::ShapeType 'i'."); }
341 if (
String(
"StaticMeshCollisionShape")==TypeName)
343 else if (
String(
"MultiSphereCollisionShape")==TypeName)
346 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an invalid CollisionShape::ShapeType String into a CollisionShape::ShapeType 't'."); }
348 if (
String(
"DynamicMeshCollisionShape")==TypeName)
351 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an invalid CollisionShape::ShapeType String into a CollisionShape::ShapeType 'a'."); }
353 if (
String(
"HeightfieldCollisionShapeString")==TypeName)
356 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an invalid CollisionShape::ShapeType String into a CollisionShape::ShapeType 'g'."); }
358 if (
String(
"PlaneCollisionShape")==TypeName)
361 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an invalid CollisionShape::ShapeType String into a CollisionShape::ShapeType 'n'."); }
363 if (
String(
"SoftCollisionShape")==TypeName)
366 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an invalid CollisionShape::ShapeType String into a CollisionShape::ShapeType 'o'."); }
368 if (
String(
"CompoundCollisionShape")==TypeName)
371 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an invalid CollisionShape::ShapeType String into a CollisionShape::ShapeType 'p'."); }
373 { MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Attempting to convert an invalid CollisionShape::ShapeType String into a CollisionShape::ShapeType."); }
383 if(!Doc->
Load(OneTag.c_str()))
386 MEZZ_EXCEPTION(
Exception::PARAMETERS_EXCEPTION,
"Could not Deserialize XML Stream which should contain a Collision Shape, XML looked Like: " + OneTag +
".");
407 {
return String(
"Shapes"); }