This class provides (an interface to) the creation, management and destruction of collision models. More...
#include "CollisionModelMan.hpp"
Public Member Functions | |
virtual | ~CollModelManI () |
The virtual destructor. More... | |
virtual const CollisionModelT * | GetCM (const std::string &FileName)=0 |
Loads a collision model from the file specified by FileName. More... | |
virtual const CollisionModelT * | GetCM (unsigned long Width, unsigned long Height, const ArrayT< Vector3dT > &Mesh, MaterialT *Material, const double MIN_NODE_SIZE)=0 |
Creates a collision model from the given explicit mesh. More... | |
virtual const CollisionModelT * | GetCM (const BoundingBox3T< double > &BB, MaterialT *Material)=0 |
Creates a collision model from the given (axis-aligned) bounding-box. More... | |
virtual const CollisionModelT * | GetCM (const CollisionModelT *CollisionModel)=0 |
Creates another collision model from a given collision model. More... | |
virtual const std::string & | GetFileName (const CollisionModelT *CollisionModel) const =0 |
Returns the file name the given collision model has been loaded from (using the GetCM(const std::string& FileName) method). More... | |
virtual void | FreeCM (const CollisionModelT *CollisionModel)=0 |
Frees the given collision model (taking reference counting into account if necessary). More... | |
virtual unsigned long | GetUniqueCMCount () const =0 |
Returns the number of unique, physical collision model instances managed by this class. More... | |
This class provides (an interface to) the creation, management and destruction of collision models.
It employs reference counting for collision models that are loaded from file. The interface is specified as an ABC in order to be able to share it across exe/dll boundaries.
The important feature is that it allows the flexible, care-free handling of collision models: no matter where a model "comes from" (loaded file, file stream, bounding box, ...), it is created and deleted in a uniform manner, which in turn is an important feature for the game (entity) code. The const-ness of the returned pointers is obviously a consequence of the instance-sharing implied by the reference counting: You can inspect, but not mutate/modify shared objects.
|
inlinevirtual |
The virtual destructor.
|
pure virtual |
Frees the given collision model (taking reference counting into account if necessary).
CollisionModel | The collision model to be freed. |
Implemented in cf::ClipSys::CollModelManImplT.
|
pure virtual |
Loads a collision model from the file specified by FileName.
If the collision model has been loaded before, reference counting is employed.
FileName | The name of the file to load the collision model from. |
Implemented in cf::ClipSys::CollModelManImplT.
|
pure virtual |
Creates a collision model from the given explicit mesh.
Width | The width of the mesh. |
Height | The height of the mesh. |
Mesh | The vertices of the mesh. |
Material | The material reported in collision results when a trace hit. |
MIN_NODE_SIZE | The minimum size (side length) that a node should not fall below. |
Implemented in cf::ClipSys::CollModelManImplT.
|
pure virtual |
Creates a collision model from the given (axis-aligned) bounding-box.
BB | The bounding box to create a collision model for. |
Material | The material to use for the collision model. |
Implemented in cf::ClipSys::CollModelManImplT.
|
pure virtual |
Creates another collision model from a given collision model.
a) If the given collision model has been created with other methods of this CollModelManI earlier, the implementation will simply increase the related reference counter and return the same pointer. b) If the given collision model has been created "externally" with some other means (e.g. direct instantiation of a concrete collision model class), the CollModelManI will create a record about it with a reference count of 1, assume that the original instance is not freed/deleted by the caller as long as it has a non-zero reference count, and will not attempt to delete the instance when the count finally drops to 0.
CollisionModel | The collision model to create another collision model from. |
Implemented in cf::ClipSys::CollModelManImplT.
|
pure virtual |
Returns the file name the given collision model has been loaded from (using the GetCM(const std::string& FileName) method).
CollisionModel | The collision model for which return the associated file name. |
Implemented in cf::ClipSys::CollModelManImplT.
|
pure virtual |
Returns the number of unique, physical collision model instances managed by this class.
Implemented in cf::ClipSys::CollModelManImplT.