CrystalSpace

Public API Reference

csObjectModel Class Reference
[Geometry utilities]

Helper class to make it easier to implement iObjectModel in mesh objects. More...

#include <cstool/objmodel.h>

Inheritance diagram for csObjectModel:

Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void AddListener (iObjectModelListener *listener)
 Add a listener to this object model.
virtual csPtr
< iPolygonMesh
CreateLowerDetailPolygonMesh (float)
 Create a polygon mesh representing a lower detail version of the object but without the restrictions of GetPolygonMeshViscull().
 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 iPolygonMeshGetPolygonMeshBase ()
 Get a polygon mesh representing the basic geometry of the object.
virtual iPolygonMeshGetPolygonMeshColldet ()
 Get a polygon mesh representing the geometry of the object.
virtual iPolygonMeshGetPolygonMeshShadows ()
 Get a polygon mesh specifically for shadow casting (to be used by the shadow manager).
virtual iPolygonMeshGetPolygonMeshViscull ()
 Get a polygon mesh specifically for visibility culling (to be used as an occluder).
virtual long GetShapeNumber () const
 Returns a number that will change whenever the shape of this object changes.
csRef< iStringSetGetStandardStringSet (iObjectRegistry *object_reg)
 Conveniance method to fetch the standard string registry from the object registry.
virtual iTerraFormerGetTerraFormerColldet ()
 Get a terra former representing the geometry of the object.
virtual iTerrainSystemGetTerrainColldet ()
 Get a terrain representing the geometry of the object.
virtual iTriangleMeshGetTriangleData (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 SetPolygonMeshBase (iPolygonMesh *base)
 Set the pointer to the base polygon mesh.
virtual void SetPolygonMeshColldet (iPolygonMesh *polymesh)
 Set a polygon mesh representing the geometry of the object.
virtual void SetPolygonMeshShadows (iPolygonMesh *polymesh)
 Set a polygon mesh representing the geometry of the object.
virtual void SetPolygonMeshViscull (iPolygonMesh *polymesh)
 Set a polygon mesh representing the geometry of the object.
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.
virtual ~csObjectModel ()

Friends

class csTMIterator


Detailed Description

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 54 of file objmodel.h.


Constructor & Destructor Documentation

csObjectModel::csObjectModel ( iBase parent = 0  )  [inline]

Construct a new csObjectModel.

Don't forget to call SetPolygonMesh<xxx>()!

Definition at line 74 of file objmodel.h.


Member Function Documentation

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 163 of file objmodel.h.

virtual csPtr<iPolygonMesh> csObjectModel::CreateLowerDetailPolygonMesh ( float  detail  )  [inline, virtual]

Create a polygon mesh representing a lower detail version of the object but without the restrictions of GetPolygonMeshViscull().

The floating point input number is 0 for minimum detail and 1 for highest detail. This function may return the same polygon mesh as GetPolygonMeshColldet() (but with ref count incremented by one). Can return 0 if this object model doesn't support that.

Deprecated:
This method was never implemented and is misplaced.

Implements iObjectModel.

Definition at line 159 of file objmodel.h.

void csObjectModel::FireListeners (  )  [inline]

Fire all listeners.

Definition at line 129 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 95 of file objmodel.h.

virtual iPolygonMesh* csObjectModel::GetPolygonMeshBase (  )  [inline, virtual]

Get a polygon mesh representing the basic geometry of the object.

Can return 0 if this object model doesn't support that.

Deprecated:
Use GetTriangleData(id) with id the interned string 'base'.

Implements iObjectModel.

Definition at line 143 of file objmodel.h.

virtual iPolygonMesh* csObjectModel::GetPolygonMeshColldet (  )  [inline, virtual]

Get a polygon mesh representing the geometry of the object.

This mesh is useful for collision detection. Can return 0 if this object model doesn't support that.

Deprecated:
Use GetTriangleData(id) with id the interned string 'colldet'.

Implements iObjectModel.

Definition at line 144 of file objmodel.h.

virtual iPolygonMesh* csObjectModel::GetPolygonMeshShadows (  )  [inline, virtual]

Get a polygon mesh specifically for shadow casting (to be used by the shadow manager).

This polygon mesh is guaranteed to be smaller or equal to the real object. In other words: if you would render the original mesh in red and this one in blue you should not see any blue anywhere. Can return 0 if this object model doesn't support that. In that case the object will not be used for shadow casting.

Deprecated:
Use GetTriangleData(id) with id the interned string 'shadows'.

Implements iObjectModel.

Definition at line 154 of file objmodel.h.

virtual iPolygonMesh* csObjectModel::GetPolygonMeshViscull (  )  [inline, virtual]

Get a polygon mesh specifically for visibility culling (to be used as an occluder).

This polygon mesh is guaranteed to be smaller or equal to the real object. In other words: if you would render the original mesh in red and this one in blue you should not see any blue anywhere. This kind of lower detail version can be used for occlusion writing in a visibility culling system. Can return 0 if this object model doesn't support that. In that case the object will not be used for visibility culling.

Deprecated:
Use GetTriangleData(id) with id the interned string 'viscull'.

Implements iObjectModel.

Definition at line 149 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 136 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 85 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 csParticleSystem, and csMeshObject.

Definition at line 172 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 csParticleSystem, and csMeshObject.

Definition at line 176 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:

  • 'base'
  • 'colldet'
  • 'viscull'
  • 'shadows'
    Returns:
    the triangle mesh for that id. If this is 0 then there are two possibilities: either the mesh was never set and in this case the subsystem can pick the base mesh as a fallback. Another possibility is that the triangle data was explicitelly cleared with SetTriangleData(id,0). In that case the mesh is assumed to be empty and usually that means that the specific subsystem will ignore it. To distinguish between these two cases use IsTriangleDataSet(id).

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 168 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::SetPolygonMeshBase ( iPolygonMesh base  )  [inline]

Set the pointer to the base polygon mesh.

Definition at line 104 of file objmodel.h.

virtual void csObjectModel::SetPolygonMeshColldet ( iPolygonMesh polymesh  )  [inline, virtual]

Set a polygon mesh representing the geometry of the object.

This mesh is useful for collision detection. This can be used to replace the default polygon mesh returned by GetPolygonMeshColldet() with one that has less detail or even to support polygon mesh for mesh objects that otherwise don't support it. The object model will keep a reference to the given polymesh.

Deprecated:
Use SetTriangleData(id) with id the interned string 'colldet'.

Implements iObjectModel.

Definition at line 145 of file objmodel.h.

virtual void csObjectModel::SetPolygonMeshShadows ( iPolygonMesh polymesh  )  [inline, virtual]

Set a polygon mesh representing the geometry of the object.

This mesh is useful for shadow casting. This can be used to replace the default polygon mesh returned by GetPolygonMeshShadows() with one that has less detail or even to support polygon mesh for mesh objects that otherwise don't support it. The object model will keep a reference to the given polymesh.

Deprecated:
Use SetTriangleData(id) with id the interned string 'shadows'.

Implements iObjectModel.

Definition at line 155 of file objmodel.h.

virtual void csObjectModel::SetPolygonMeshViscull ( iPolygonMesh polymesh  )  [inline, virtual]

Set a polygon mesh representing the geometry of the object.

This mesh is useful for visibility culling. This can be used to replace the default polygon mesh returned by GetPolygonMeshViscull() with one that has less detail or even to support polygon mesh for mesh objects that otherwise don't support it. The object model will keep a reference to the given polymesh.

Deprecated:
Use SetTriangleData(id) with id the interned string 'viscull'.

Implements iObjectModel.

Definition at line 150 of file objmodel.h.

void csObjectModel::SetShapeNumber ( long  n  )  [inline]

Set the shape number manually (should not be needed in most cases).

Definition at line 121 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.

Parameters:
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 112 of file objmodel.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space 1.2.1 by doxygen 1.5.3