Crystal Space: iMeshObject Struct Reference (Crystal Space Public API Reference)

| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iMeshObject Struct Reference
[Mesh plugins]

This is a general mesh object that the engine can interact with. More...

`#include <imesh/object.h>`

Inheritance diagram for iMeshObject:

[legend]
List of all members.

## Public Member Functions
virtual csPtr< iMeshObject > | Clone ()=0
| Creates a copy of this object and returns the clone.
virtual bool | GetColor (csColor &color) const =0
| Get the base color of the mesh.
virtual iMeshObjectFactory * | GetFactory () const =0
| Get the reference to the factory that created this mesh object.
virtual csFlags & | GetFlags ()=0
| Get flags for this object.
virtual iMaterialWrapper * | GetMaterialWrapper () const =0
| Get the material of the mesh.
virtual iMeshWrapper * | GetMeshWrapper () const =0
| Get the logical parent for this mesh object.
virtual uint | GetMixMode () const =0
| Get mix mode.
virtual iObjectModel * | GetObjectModel ()=0
| Get the generic interface describing the geometry of this mesh.
virtual csRenderMesh ** | GetRenderMeshes (int &num, iRenderView *rview, iMovable *movable, uint32 frustum_mask)=0
| Returns the set of render meshes.
virtual iMeshObjectDrawCallback * | GetVisibleCallback () const =0
| Get the current visible callback.
virtual void | HardTransform (const csReversibleTransform &t)=0
| Do a hard transform of this object.
virtual bool | HitBeamObject (const csVector3 &start, const csVector3 &end, csVector3 &isect, float *pr, int *polygon_idx=0, iMaterialWrapper **material=0)=0
| Check if this mesh is hit by this object space vector.
virtual bool | HitBeamOutline (const csVector3 &start, const csVector3 &end, csVector3 &isect, float *pr)=0
| Check if this mesh is hit by this object space vector.
virtual void | InvalidateMaterialHandles ()=0
| Material changed.
virtual void | NextFrame (csTicks current_time, const csVector3 &pos, uint currentFrame)=0
| Control animation of this object.
virtual void | PositionChild (iMeshObject *child, csTicks current_time)=0
| The engine asks this mesh object to place one of his hierarchical children.
virtual bool | SetColor (const csColor &color)=0
| Set the base color of the mesh.
virtual bool | SetMaterialWrapper (iMaterialWrapper *material)=0
| Set the material of the mesh.
virtual void | SetMeshWrapper (iMeshWrapper *logparent)=0
| Set a reference to the mesh wrapper holding the mesh objects.
virtual void | SetMixMode (uint mode)=0
| Set mix mode. Note that not all meshes may support this.
virtual void | SetVisibleCallback (iMeshObjectDrawCallback *cb)=0
| Register a callback to the mesh object which will be called from within Draw() if the mesh object thinks that the object is really visible.
virtual bool | SupportsHardTransform () const =0
| Return true if HardTransform is supported for this mesh object type.

## Detailed Description

This is a general mesh object that the engine can interact with.

The mesh object only manages its shape, texture etc. but *not* its position, sector or similar information. For this reason, a mesh object can only be used in the engine if a hook object is created for it in the engine that does the required management. The hook object is called mesh wrapper.

Main creators of instances implementing this interface:

- All mesh objects implement this.
- iMeshObjectFactory::NewInstance()

Main ways to get pointers to this interface:

- iMeshWrapper::GetMeshObject()

Main users of this interface:

- The 3D engine plugin (crystalspace.engine.3d).

Definition at line 108 of file object.h.

## Member Function Documentation

virtual csPtr<iMeshObject> iMeshObject::Clone | ( |  | ) | `[pure virtual]`

Creates a copy of this object and returns the clone.

Implemented in csParticleSystem, and csMeshObject.

virtual bool iMeshObject::GetColor | ( | csColor & | color | ) | const`[pure virtual]`

Get the base color of the mesh.

Will return false if not supported.

Implemented in csParticleSystem, and csMeshObject.

virtual iMeshObjectFactory* iMeshObject::GetFactory | ( |  | ) | const`[pure virtual]`

Get the reference to the factory that created this mesh object.

Implemented in csParticleSystem, and csMeshObject.

virtual csFlags& iMeshObject::GetFlags | ( |  | ) | `[pure virtual]`

Get flags for this object.

The following flags are at least supported:

- CS_MESH_STATICPOS: mesh will never move.
- CS_MESH_STATICSHAPE: mesh will never animate.

Mesh objects may implement additional flags. These mesh object specific flags must be equal to at least 0x00010000.

Implemented in csParticleSystem, and csMeshObject.

virtual iMaterialWrapper* iMeshObject::GetMaterialWrapper | ( |  | ) | const`[pure virtual]`

Get the material of the mesh.

If not supported this will return 0.

Implemented in csParticleSystem, and csMeshObject.

virtual iMeshWrapper* iMeshObject::GetMeshWrapper | ( |  | ) | const`[pure virtual]`

Get the logical parent for this mesh object.

See SetMeshWrapper() for more information.

Implemented in csParticleSystem, and csMeshObject.

virtual uint iMeshObject::GetMixMode | ( |  | ) | const`[pure virtual]`

Get mix mode.

Implemented in csParticleSystem, and csMeshObject.

virtual iObjectModel* iMeshObject::GetObjectModel | ( |  | ) | `[pure virtual]`

Get the generic interface describing the geometry of this mesh.

If the factory supports this you should preferably use the object model from the factory instead.

Implemented in csParticleSystem, and csMeshObject.

virtual csRenderMesh** iMeshObject::GetRenderMeshes | ( | int & | num,
|  | iRenderView * | rview,
|  | iMovable * | movable,
|  | uint32 | frustum_mask |
| ) |  |  | `[pure virtual]`

Returns the set of render meshes.

The frustum_mask is given by the culler and contains a mask with all relevant planes for the given object. These planes correspond with the clip planes kept by iRenderView.

Implemented in csParticleSystem, and csMeshObject.

virtual iMeshObjectDrawCallback* iMeshObject::GetVisibleCallback | ( |  | ) | const`[pure virtual]`

Get the current visible callback.

Implemented in csParticleSystem, and csMeshObject.

virtual void iMeshObject::HardTransform | ( | const csReversibleTransform & | t | ) | `[pure virtual]`

Do a hard transform of this object.

This transformation and the original coordinates are not remembered but the object space coordinates are directly computed (world space coordinates are set to the object space coordinates by this routine). Note that some implementations of mesh objects will not change the orientation of the object but only the position.

Implemented in csMeshObject.

virtual bool iMeshObject::HitBeamObject | ( | const csVector3 & | start,
|  | const csVector3 & | end,
|  | csVector3 & | isect,
|  | float * | pr,
|  | int * | polygon_idx = `0`,
|  | iMaterialWrapper ** | material = `0` |
| ) |  |  | `[pure virtual]`

Check if this mesh is hit by this object space vector.

Return the collision point in object space coordinates. This is the most detailed version (and also the slowest). The returned hit will be guaranteed to be the point closest to the 'start' of the beam. If the object supports this then an index of the hit polygon will be returned (or -1 if not supported or no hit).

Parameters:

  | start | Start of the beam to trace.
  | end | End of the beam to trace.
  | isect | Returns the point of the hit.
  | pr | Returns the position of the hit as a value between 0 and 1, where 0 means start and 1 means end.
  | polygon_idx | Index of the polygon hit on the mesh (or -1 if not supported).
  | material | If not 0 then the hit material will be put here. Or 0 in case this mesh object doesn't support material selection.

Implemented in csParticleSystem, and csMeshObject.

virtual bool iMeshObject::HitBeamOutline | ( | const csVector3 & | start,
|  | const csVector3 & | end,
|  | csVector3 & | isect,
|  | float * | pr |
| ) |  |  | `[pure virtual]`

Check if this mesh is hit by this object space vector.

This will do a test based on the outline of the object. This means that it is more accurate than HitBeamBBox(). Note that this routine will typically be faster than HitBeamObject(). The hit may be on the front or the back of the object, but will indicate that it iterrupts the beam.

Implemented in csParticleSystem, and csMeshObject.

virtual void iMeshObject::InvalidateMaterialHandles | ( |  | ) | `[pure virtual]`

Material changed.

This is an 'event' that the engine (or another party managing materials) will send out as soon as the material handles are changed in some way which requires the mesh object to fetch it again (i.e. to call materialwrapper->GetMaterialHandle()) again.

Implemented in csParticleSystem, and csMeshObject.

virtual void iMeshObject::NextFrame | ( | csTicks | current_time,
|  | const csVector3 & | pos,
|  | uint | currentFrame |
| ) |  |  | `[pure virtual]`

Control animation of this object.

Implemented in csParticleSystem, and csMeshObject.

virtual void iMeshObject::PositionChild | ( | iMeshObject * | child,
|  | csTicks | current_time |
| ) |  |  | `[pure virtual]`

The engine asks this mesh object to place one of his hierarchical children.

It must be placed where it should be at the given time. This object might or might not have been drawn, so you can't use it's current state.

Implemented in csParticleSystem, and csMeshObject.

virtual bool iMeshObject::SetColor | ( | const csColor & | color | ) | `[pure virtual]`

Set the base color of the mesh.

This color will be added to whatever color is set for lighting. Not all meshes need to support this. This function will return true if it worked.

Implemented in csParticleSystem, and csMeshObject.

virtual bool iMeshObject::SetMaterialWrapper | ( | iMaterialWrapper * | material | ) | `[pure virtual]`

Set the material of the mesh.

This only works for single-material meshes. If not supported this function will return false.

Implemented in csParticleSystem, and csMeshObject.

virtual void iMeshObject::SetMeshWrapper | ( | iMeshWrapper * | logparent | ) | `[pure virtual]`

Set a reference to the mesh wrapper holding the mesh objects.

Note that this function should NOT increase the ref-count of the given logical parent because this would cause a circular reference (since the logical parent already holds a reference to this mesh object).

Implemented in csParticleSystem, and csMeshObject.

virtual void iMeshObject::SetMixMode | ( | uint | mode | ) | `[pure virtual]`

Set mix mode. Note that not all meshes may support this.

Implemented in csParticleSystem, and csMeshObject.

virtual void iMeshObject::SetVisibleCallback | ( | iMeshObjectDrawCallback * | cb | ) | `[pure virtual]`

Register a callback to the mesh object which will be called from within Draw() if the mesh object thinks that the object is really visible.

Depending on the type of mesh object this can be very accurate or not accurate at all. But in all cases it will certainly be called if the object is visible.

Implemented in csParticleSystem, and csMeshObject.

virtual bool iMeshObject::SupportsHardTransform | ( |  | ) | const`[pure virtual]`

Return true if HardTransform is supported for this mesh object type.

Implemented in csMeshObject.

The documentation for this struct was generated from the following file:

- imesh/object.h