![]() |
Public API Reference |
![]() |
Helper class to make it easier to implement iObjectModel in mesh objects. More...
#include <cstool/objmodel.h>
Public Member Functions | |
virtual void | AddListener (iObjectModelListener *listener) |
Add a listener to this object model. | |
csObjectModel (iBase *parent=0) | |
Construct a new csObjectModel. | |
void | FireListeners () |
Fire all listeners. | |
csStringID | GetBaseID (iObjectRegistry *object_reg) |
Conveniance method to fetch the base string ID given the object registry. | |
virtual long | GetShapeNumber () const |
Returns a number that will change whenever the shape of this object changes. | |
csRef< iStringSet > | GetStandardStringSet (iObjectRegistry *object_reg) |
Conveniance method to fetch the standard string registry from the object registry. | |
virtual iTerraFormer * | GetTerraFormerColldet () |
Get a terra former representing the geometry of the object. | |
virtual iTerrainSystem * | GetTerrainColldet () |
Get a terrain representing the geometry of the object. | |
virtual iTriangleMesh * | GetTriangleData (csStringID) |
Get a triangle mesh representing the geometry of the object. | |
virtual csPtr < iTriangleMeshIterator > | GetTriangleDataIterator () |
Get an iterator to iterate over all triangle meshes in this object model. | |
virtual bool | IsTriangleDataSet (csStringID) |
Return true if the triangle data was set for this id. | |
virtual void | RemoveListener (iObjectModelListener *listener) |
Remove a listener from this object model. | |
virtual void | ResetTriangleData (csStringID) |
Reset triangle data. | |
void | SetShapeNumber (long n) |
Set the shape number manually (should not be needed in most cases). | |
virtual void | SetTriangleData (csStringID, iTriangleMesh *) |
Set a triangle mesh representing the geometry of the object. | |
void | ShapeChanged () |
Increase the shape number and also fire all listeners. |
Helper class to make it easier to implement iObjectModel in mesh objects.
This class does not implement the bounding box and radius functions.
Definition at line 50 of file objmodel.h.
csObjectModel::csObjectModel | ( | iBase * | parent = 0 | ) | [inline] |
Construct a new csObjectModel.
Don't forget to call SetPolygonMesh<xxx>()!
Definition at line 66 of file objmodel.h.
virtual void csObjectModel::AddListener | ( | iObjectModelListener * | listener | ) | [inline, virtual] |
Add a listener to this object model.
This listener will be called whenever the object model changes or right before it is destroyed.
Implements iObjectModel.
Definition at line 127 of file objmodel.h.
void csObjectModel::FireListeners | ( | ) | [inline] |
Fire all listeners.
Definition at line 113 of file objmodel.h.
csStringID csObjectModel::GetBaseID | ( | iObjectRegistry * | object_reg | ) | [inline] |
Conveniance method to fetch the base string ID given the object registry.
Definition at line 87 of file objmodel.h.
virtual long csObjectModel::GetShapeNumber | ( | ) | const [inline, virtual] |
Returns a number that will change whenever the shape of this object changes.
If that happens then the data in all the returned polygon meshes and bounding volumes will be invalid.
Implements iObjectModel.
Definition at line 120 of file objmodel.h.
csRef<iStringSet> csObjectModel::GetStandardStringSet | ( | iObjectRegistry * | object_reg | ) | [inline] |
Conveniance method to fetch the standard string registry from the object registry.
Definition at line 77 of file objmodel.h.
virtual iTerraFormer* csObjectModel::GetTerraFormerColldet | ( | ) | [inline, virtual] |
Get a terra former representing the geometry of the object.
This class is useful for collision detection. Can return 0 if this object model doesn't support that.
Implements iObjectModel.
Reimplemented in csMeshObject.
Definition at line 136 of file objmodel.h.
virtual iTerrainSystem* csObjectModel::GetTerrainColldet | ( | ) | [inline, virtual] |
Get a terrain representing the geometry of the object.
This class is useful for collision detection. Can return 0 if this object model doesn't support that.
Implements iObjectModel.
Reimplemented in csMeshObject.
Definition at line 140 of file objmodel.h.
virtual iTriangleMesh* csObjectModel::GetTriangleData | ( | csStringID | id | ) | [virtual] |
Get a triangle mesh representing the geometry of the object.
The ID indicates the type of mesh that is desired. Use the string registry (iStringSet from object registry with tag 'crystalspace.shared.stringset') to convert the ID string to a csStringID identification. Some common possibilities are:
Implements iObjectModel.
virtual csPtr<iTriangleMeshIterator> csObjectModel::GetTriangleDataIterator | ( | ) | [virtual] |
Get an iterator to iterate over all triangle meshes in this object model.
This includes triangle meshes that are 0.
Implements iObjectModel.
virtual bool csObjectModel::IsTriangleDataSet | ( | csStringID | id | ) | [virtual] |
Return true if the triangle data was set for this id.
This can be used to distinguish between an empty mesh as set with SetTriangleData() or SetTriangleData() not being called at all. Calling ResetTriangleData() will clear this.
Implements iObjectModel.
virtual void csObjectModel::RemoveListener | ( | iObjectModelListener * | listener | ) | [inline, virtual] |
Remove a listener from this object model.
Implements iObjectModel.
Definition at line 132 of file objmodel.h.
virtual void csObjectModel::ResetTriangleData | ( | csStringID | id | ) | [virtual] |
Reset triangle data.
After calling this it is as if the triangle data was never set.
Implements iObjectModel.
void csObjectModel::SetShapeNumber | ( | long | n | ) | [inline] |
Set the shape number manually (should not be needed in most cases).
Definition at line 105 of file objmodel.h.
virtual void csObjectModel::SetTriangleData | ( | csStringID | id, |
iTriangleMesh * | trimesh | ||
) | [virtual] |
Set a triangle mesh representing the geometry of the object.
The ID indicates the type of mesh that you want to change. Note that the base mesh (ID equal to 'base') cannot be modified.
id | is a numer id you can fetch from the string registry (iStringSet from object registry with tag\ 'crystalspace.shared.stringset'). |
trimesh | is the new mesh. The reference count will be increased. If you pass in 0 here then this means that the mesh for this specific ID is disabled. If you want to reset this then call ResetTriangleData(id). When no mesh is set or ResetTriangleData() is called many subsystems will use the base mesh instead. However if you set 0 here then this means that this mesh is disabled. |
Implements iObjectModel.
void csObjectModel::ShapeChanged | ( | ) | [inline] |
Increase the shape number and also fire all listeners.
Definition at line 96 of file objmodel.h.