iMeshWrapper Struct Reference
[Mesh support]
A mesh wrapper is an engine-level object that wraps around an actual mesh object (iMeshObject). More...
#include <iengine/mesh.h>
Public Member Functions | |
virtual size_t | AddExtraRenderMesh (CS::Graphics::RenderMesh *renderMesh, csZBufMode zBufMode)=0 |
Adds a render mesh to the list of extra render meshes. | |
virtual size_t | AddExtraRenderMesh (CS::Graphics::RenderMesh *renderMesh)=0 |
Adds a render mesh to the list of extra render meshes. | |
virtual csShaderVariable * | AddInstance (csVector3 &position, csMatrix3 &rotation)=0 |
Adds a (pseudo-)instance at the given position. | |
virtual void | AddMeshToStaticLOD (int lod, iMeshWrapper *mesh)=0 |
Set a given child mesh at a specific lod level. | |
virtual iLODControl * | CreateStaticLOD ()=0 |
Create a LOD control for this mesh wrapper. | |
virtual void | DestroyStaticLOD ()=0 |
Destroy the LOD control for this mesh. | |
virtual iMeshWrapper * | FindChildByName (const char *name)=0 |
Find a child mesh by name. | |
virtual iMeshDrawCallback * | GetDrawCallback (int idx) const =0 |
Get the specified draw callback. | |
virtual int | GetDrawCallbackCount () const =0 |
Get the number of draw callbacks. | |
virtual CS::Graphics::RenderMesh * | GetExtraRenderMesh (size_t idx) const =0 |
Get a specific extra render mesh. | |
virtual size_t | GetExtraRenderMeshCount () const =0 |
Get the number of extra render meshes. | |
virtual csZBufMode | GetExtraRenderMeshZBufMode (size_t idx) const =0 |
Gets the z-buffer mode of a specific extra rendermesh. | |
virtual iMeshFactoryWrapper * | GetFactory () const =0 |
Get the parent factory. | |
virtual csFlags & | GetFlags ()=0 |
Get flags for this meshwrapper. | |
virtual float | GetMaximumRenderDistance () const =0 |
Get the maximum distance at which this mesh will be rendered. | |
virtual iSharedVariable * | GetMaximumRenderDistanceVar () const =0 |
Get the maximum distance at which this mesh will be rendered. | |
virtual iMeshObject * | GetMeshObject () const =0 |
Get the iMeshObject. | |
virtual float | GetMinimumRenderDistance () const =0 |
Get the minimum distance at which this mesh will be rendered. | |
virtual iSharedVariable * | GetMinimumRenderDistanceVar () const =0 |
Get the minimum distance at which this mesh will be rendered. | |
virtual iMovable * | GetMovable () const =0 |
Get the movable instance for this object. | |
virtual iPortalContainer * | GetPortalContainer () const =0 |
If this mesh is a portal container you can use GetPortalContainer() to get the portal container interface. | |
virtual csSphere | GetRadius () const =0 |
Get the radius of this mesh and all its children. | |
virtual csRenderMesh ** | GetRenderMeshes (int &num, iRenderView *rview, uint32 frustum_mask)=0 |
Get the render mesh list for this mesh wrapper and given view. | |
virtual CS::Graphics::RenderPriority | GetRenderPriority () const =0 |
Get the render priority. | |
virtual csScreenBoxResult | GetScreenBoundingBox (iCamera *camera)=0 |
Get a very inaccurate bounding box of the object in screen space. | |
virtual iLODControl * | GetStaticLOD ()=0 |
Get the LOD control for this mesh. | |
virtual iShaderVariableContext * | GetSVContext ()=0 |
Get the shader variable context of the mesh object. | |
virtual csBox3 | GetTransformedBoundingBox (const csReversibleTransform &trans)=0 |
Get the bounding box of this object after applying a transformation to it. | |
virtual const csBox3 & | GetWorldBoundingBox ()=0 |
Get the bounding box of this object in world space. | |
virtual csZBufMode | GetZBufMode () const =0 |
Get the Z-buf drawing mode. | |
virtual void | HardTransform (const csReversibleTransform &t)=0 |
Do a hard transform of this object. | |
virtual csHitBeamResult | HitBeam (const csVector3 &start, const csVector3 &end, bool do_material=false)=0 |
Check if this object is hit by this world space vector. | |
virtual csHitBeamResult | HitBeamBBox (const csVector3 &start, const csVector3 &end)=0 |
Check if this mesh is hit by this object space vector. | |
virtual csHitBeamResult | HitBeamObject (const csVector3 &start, const csVector3 &end, bool do_material=false)=0 |
Check if this object is hit by this object space vector. | |
virtual csHitBeamResult | HitBeamOutline (const csVector3 &start, const csVector3 &end)=0 |
Check if this object is hit by this object space vector. | |
virtual void | PlaceMesh ()=0 |
This routine will find out in which sectors a mesh object is positioned. | |
virtual iObject * | QueryObject ()=0 |
Get the iObject for this mesh object. | |
virtual iSceneNode * | QuerySceneNode ()=0 |
Get the scene node that this object represents. | |
virtual void | RemoveDrawCallback (iMeshDrawCallback *cb)=0 |
Remove a draw callback. | |
virtual void | RemoveInstance (csShaderVariable *instance)=0 |
Removes a (pseudo-)instance of the mesh. | |
virtual void | RemoveMeshFromStaticLOD (iMeshWrapper *mesh)=0 |
Remove a child mesh from all lod levels. | |
virtual void | ResetMinMaxRenderDistance ()=0 |
Reset minimum/maximum render range to defaults (i.e. | |
virtual void | SetDrawCallback (iMeshDrawCallback *cb)=0 |
Set a callback which is called just before the object is drawn. | |
virtual void | SetFactory (iMeshFactoryWrapper *factory)=0 |
Set the parent factory (this only sets a pointer). | |
virtual void | SetFlagsRecursive (uint32 mask, uint32 flags=~0)=0 |
Set some flags with the given mask for this mesh and all children. | |
virtual void | SetMaximumRenderDistance (float min)=0 |
Set the maximum distance at which this mesh will be rendered. | |
virtual void | SetMaximumRenderDistanceVar (iSharedVariable *min)=0 |
Set the maximum distance at which this mesh will be rendered. | |
virtual void | SetMeshObject (iMeshObject *)=0 |
Set the iMeshObject. | |
virtual void | SetMinimumRenderDistance (float min)=0 |
Set the minimum distance at which this mesh will be rendered. | |
virtual void | SetMinimumRenderDistanceVar (iSharedVariable *min)=0 |
Set the minimum distance at which this mesh will be rendered. | |
virtual void | SetRenderPriority (CS::Graphics::RenderPriority rp)=0 |
The renderer will render all objects in a sector based on this number. | |
virtual void | SetRenderPriorityRecursive (CS::Graphics::RenderPriority rp)=0 |
Same as SetRenderPriority() but this version will recursively set render priority for the children too. | |
virtual void | SetZBufMode (csZBufMode mode)=0 |
Set the Z-buf drawing mode to use for this object. | |
virtual void | SetZBufModeRecursive (csZBufMode mode)=0 |
Same as SetZBufMode() but this will also set the z-buf mode for the children too. | |
virtual void | RemoveExtraRenderMesh (size_t idx)=0 |
Deletes a specific extra rendermesh. | |
virtual void | RemoveExtraRenderMesh (CS::Graphics::RenderMesh *renderMesh)=0 |
Deletes a specific extra rendermesh. |
Detailed Description
A mesh wrapper is an engine-level object that wraps around an actual mesh object (iMeshObject).
Every mesh object in the engine is represented by a mesh wrapper, which keeps the pointer to the mesh object, its position, its name, etc.
Think of the mesh wrapper as the hook that holds the mesh object in the engine. An effect of this is that the i???State interfaces (e.g. iSprite3DState) must be queried from the mesh *objects*, not the wrappers!
Note that a mesh object should never be contained in more than one wrapper.
Main creators of instances implementing this interface:
- iEngine::CreateMeshWrapper()
- iEngine::LoadMeshWrapper()
- iEngine::CreatePortalContainer()
- iEngine::CreatePortal()
- iLoader::LoadMeshObject()
- CS::Geometry::GeneralMeshBuilder::CreateMesh()
Main ways to get pointers to this interface:
- iEngine::FindMeshObject()
- iMeshList::Get()
- iMeshList::FindByName()
- iMeshWrapperIterator::Next()
- iLoaderContext::FindMeshObject()
Main users of this interface:
Definition at line 263 of file mesh.h.
Member Function Documentation
virtual size_t iMeshWrapper::AddExtraRenderMesh | ( | CS::Graphics::RenderMesh * | renderMesh, | |
csZBufMode | zBufMode | |||
) | [pure virtual] |
Adds a render mesh to the list of extra render meshes.
This list is used for special cases (like decals or lines) where additional things need to be renderered for the mesh in an abstract way.
- Warning:
- : you must keep the memory ownership of the render mesh, ie you must do delete on the object once you don't use it anymore.
- Deprecated:
- Deprecated in 2.1. Pass zbuf mode in render mesh
virtual size_t iMeshWrapper::AddExtraRenderMesh | ( | CS::Graphics::RenderMesh * | renderMesh | ) | [pure virtual] |
Adds a render mesh to the list of extra render meshes.
This list is used for special cases (like decals or lines) where additional things need to be renderered for the mesh in an abstract way.
- Warning:
- : you must keep the memory ownership of the render mesh, ie you must call delete on the object once you have done using it.
virtual csShaderVariable* iMeshWrapper::AddInstance | ( | csVector3 & | position, | |
csMatrix3 & | rotation | |||
) | [pure virtual] |
Adds a (pseudo-)instance at the given position.
Returns the instance transform shadervar.
virtual void iMeshWrapper::AddMeshToStaticLOD | ( | int | lod, | |
iMeshWrapper * | mesh | |||
) | [pure virtual] |
Set a given child mesh at a specific lod level.
Note that a mesh can be at several lod levels at once.
virtual iLODControl* iMeshWrapper::CreateStaticLOD | ( | ) | [pure virtual] |
Create a LOD control for this mesh wrapper.
This is relevant only if the mesh is a hierarchical mesh. The LOD control will be used to select which children are visible and which are not. Use this to create static lod.
virtual void iMeshWrapper::DestroyStaticLOD | ( | ) | [pure virtual] |
Destroy the LOD control for this mesh.
After this call the hierarchical mesh will act as usual.
virtual iMeshWrapper* iMeshWrapper::FindChildByName | ( | const char * | name | ) | [pure virtual] |
Find a child mesh by name.
If there is a colon in the name then this function is able to search for children too. i.e. like mesh:childmesh:childmesh.
virtual iMeshDrawCallback* iMeshWrapper::GetDrawCallback | ( | int | idx | ) | const [pure virtual] |
Get the specified draw callback.
virtual int iMeshWrapper::GetDrawCallbackCount | ( | ) | const [pure virtual] |
Get the number of draw callbacks.
virtual CS::Graphics::RenderMesh* iMeshWrapper::GetExtraRenderMesh | ( | size_t | idx | ) | const [pure virtual] |
Get a specific extra render mesh.
virtual size_t iMeshWrapper::GetExtraRenderMeshCount | ( | ) | const [pure virtual] |
Get the number of extra render meshes.
virtual csZBufMode iMeshWrapper::GetExtraRenderMeshZBufMode | ( | size_t | idx | ) | const [pure virtual] |
Gets the z-buffer mode of a specific extra rendermesh.
- Deprecated:
- Deprecated in 2.1. Obtain zbuf mode from render mesh
virtual iMeshFactoryWrapper* iMeshWrapper::GetFactory | ( | ) | const [pure virtual] |
Get the parent factory.
virtual csFlags& iMeshWrapper::GetFlags | ( | ) | [pure virtual] |
Get flags for this meshwrapper.
The following flags are supported:
- CS_ENTITY_DETAIL: this is a detail object. Again this is a hint for the engine to render this object differently. Currently not used.
- CS_ENTITY_CAMERA: entity will always be centered around the camera.
- CS_ENTITY_INVISIBLEMESH: entity is not rendered.
- CS_ENTITY_NOHITBEAM: this entity will not be considered by HitBeam() calls.
- CS_ENTITY_INVISIBLE: means that either CS_ENTITY_INVISIBLEMESH and CS_ENTITY_NOHITBEAM are set.
- CS_ENTITY_NOSHADOWS: cast no shadows.
- CS_ENTITY_NOLIGHTING: do not light this object.
- CS_ENTITY_NOCLIP: do not clip this object.
- Remarks:
- Despite the name, this method does not only provide read access to the mesh flags, as the returned reference to a csFlags object also provides write access.
virtual float iMeshWrapper::GetMaximumRenderDistance | ( | ) | const [pure virtual] |
Get the maximum distance at which this mesh will be rendered.
virtual iSharedVariable* iMeshWrapper::GetMaximumRenderDistanceVar | ( | ) | const [pure virtual] |
Get the maximum distance at which this mesh will be rendered.
If lod was not set using variables then it will return 0.
virtual iMeshObject* iMeshWrapper::GetMeshObject | ( | ) | const [pure virtual] |
Get the iMeshObject.
virtual float iMeshWrapper::GetMinimumRenderDistance | ( | ) | const [pure virtual] |
Get the minimum distance at which this mesh will be rendered.
virtual iSharedVariable* iMeshWrapper::GetMinimumRenderDistanceVar | ( | ) | const [pure virtual] |
Get the minimum distance at which this mesh will be rendered.
If lod was not set using variables then it will return 0.
virtual iMovable* iMeshWrapper::GetMovable | ( | ) | const [pure virtual] |
Get the movable instance for this object.
It is very important to call GetMovable()UpdateMove() after doing any kind of modification to this movable to make sure that internal data structures are correctly updated.
virtual iPortalContainer* iMeshWrapper::GetPortalContainer | ( | ) | const [pure virtual] |
If this mesh is a portal container you can use GetPortalContainer() to get the portal container interface.
virtual csSphere iMeshWrapper::GetRadius | ( | ) | const [pure virtual] |
Get the radius of this mesh and all its children.
virtual csRenderMesh** iMeshWrapper::GetRenderMeshes | ( | int & | num, | |
iRenderView * | rview, | |||
uint32 | frustum_mask | |||
) | [pure virtual] |
Get the render mesh list for this mesh wrapper and given view.
virtual CS::Graphics::RenderPriority iMeshWrapper::GetRenderPriority | ( | ) | const [pure virtual] |
Get the render priority.
virtual csScreenBoxResult iMeshWrapper::GetScreenBoundingBox | ( | iCamera * | camera | ) | [pure virtual] |
Get a very inaccurate bounding box of the object in screen space.
Returns -1 if object behind the camera or else the distance between the camera and the furthest point of the 3D box.
virtual iLODControl* iMeshWrapper::GetStaticLOD | ( | ) | [pure virtual] |
Get the LOD control for this mesh.
This will return 0 if this is a normal (hierarchical) mesh. Otherwise it will return an object with which you can control the static LOD of this object.
virtual iShaderVariableContext* iMeshWrapper::GetSVContext | ( | ) | [pure virtual] |
Get the shader variable context of the mesh object.
virtual csBox3 iMeshWrapper::GetTransformedBoundingBox | ( | const csReversibleTransform & | trans | ) | [pure virtual] |
Get the bounding box of this object after applying a transformation to it.
This is really a very inaccurate function as it will take the bounding box of the object in object space and then transform this bounding box.
virtual const csBox3& iMeshWrapper::GetWorldBoundingBox | ( | ) | [pure virtual] |
Get the bounding box of this object in world space.
This routine will cache the bounding box and only recalculate it if the movable changes.
virtual csZBufMode iMeshWrapper::GetZBufMode | ( | ) | const [pure virtual] |
Get the Z-buf drawing mode.
virtual void iMeshWrapper::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.
Note also that some mesh objects don't support HardTransform. You can find out by calling iMeshObject::SupportsHardTransform(). In that case you can sometimes still call HardTransform() on the factory.
virtual csHitBeamResult iMeshWrapper::HitBeam | ( | const csVector3 & | start, | |
const csVector3 & | end, | |||
bool | do_material = false | |||
) | [pure virtual] |
Check if this object is hit by this world space vector.
Return the collision point in world space coordinates. This version can also return the material that was hit (this will only happen if 'do_material' is true). This is not supported by all meshes so this can return 0 even if there was a hit.
virtual csHitBeamResult iMeshWrapper::HitBeamBBox | ( | const csVector3 & | start, | |
const csVector3 & | end | |||
) | [pure virtual] |
Check if this mesh is hit by this object space vector.
This will do a rough but fast test based on bounding box only. So this means that it might return a hit even though the object isn't really hit at all. Depends on how much the bounding box overestimates the object. This also returns the face number as defined in csBox3 on which face the hit occured. Useful for grid structures.
- See also:
- csHitBeamResult
virtual csHitBeamResult iMeshWrapper::HitBeamObject | ( | const csVector3 & | start, | |
const csVector3 & | end, | |||
bool | do_material = false | |||
) | [pure virtual] |
Check if this object is hit by this object space vector.
Return the collision point in object space coordinates. This version is more accurate than HitBeamOutline. This version can also return the material that was hit (this will only happen if 'do_material' is true). This is not supported by all meshes so this can return 0 even if there was a hit.
- See also:
- csHitBeamResult
virtual csHitBeamResult iMeshWrapper::HitBeamOutline | ( | const csVector3 & | start, | |
const csVector3 & | end | |||
) | [pure virtual] |
virtual void iMeshWrapper::PlaceMesh | ( | ) | [pure virtual] |
This routine will find out in which sectors a mesh object is positioned.
To use it the mesh has to be placed in one starting sector. This routine will then start from that sector, find all portals that touch the sprite and add all additional sectors from those portals. Note that this routine using a bounding sphere for this test so it is possible that the mesh will be added to sectors where it really isn't located (but the sphere is).
If the mesh is already in several sectors those additional sectors will be ignored and only the first one will be used for this routine.
Placing a mesh in different sectors is important when the mesh crosses a portal boundary. If you don't do this then it is possible that the mesh will be clipped wrong. For small mesh objects you can get away by not doing this in most cases.
virtual iObject* iMeshWrapper::QueryObject | ( | ) | [pure virtual] |
Get the iObject for this mesh object.
This can be used to get the name of the mesh wrapper and also to attach other user objects to this mesh (like for collision detection or game data).
virtual iSceneNode* iMeshWrapper::QuerySceneNode | ( | ) | [pure virtual] |
Get the scene node that this object represents.
virtual void iMeshWrapper::RemoveDrawCallback | ( | iMeshDrawCallback * | cb | ) | [pure virtual] |
Remove a draw callback.
virtual void iMeshWrapper::RemoveExtraRenderMesh | ( | size_t | idx | ) | [pure virtual] |
Deletes a specific extra rendermesh.
virtual void iMeshWrapper::RemoveExtraRenderMesh | ( | CS::Graphics::RenderMesh * | renderMesh | ) | [pure virtual] |
Deletes a specific extra rendermesh.
virtual void iMeshWrapper::RemoveInstance | ( | csShaderVariable * | instance | ) | [pure virtual] |
Removes a (pseudo-)instance of the mesh.
virtual void iMeshWrapper::RemoveMeshFromStaticLOD | ( | iMeshWrapper * | mesh | ) | [pure virtual] |
Remove a child mesh from all lod levels.
The mesh is not removed from the list of child meshes however.
virtual void iMeshWrapper::ResetMinMaxRenderDistance | ( | ) | [pure virtual] |
Reset minimum/maximum render range to defaults (i.e.
unlimited).
virtual void iMeshWrapper::SetDrawCallback | ( | iMeshDrawCallback * | cb | ) | [pure virtual] |
Set a callback which is called just before the object is drawn.
This is useful to do some expensive computations which only need to be done on a visible object. Note that this function will be called even if the object is not visible. In general it is called if there is a likely probability that the object is visible (i.e. it is in the same sector as the camera for example).
virtual void iMeshWrapper::SetFactory | ( | iMeshFactoryWrapper * | factory | ) | [pure virtual] |
Set the parent factory (this only sets a pointer).
virtual void iMeshWrapper::SetFlagsRecursive | ( | uint32 | mask, | |
uint32 | flags = ~0 | |||
) | [pure virtual] |
Set some flags with the given mask for this mesh and all children.
- Parameters:
-
mask The bits to modify; only those bits are affected. flags The values the bits specified in mask are set to.
Enabling flags:
csRef<iMeshWrapper> someWrapper = ...; someWrapper->SetFlagsRecursive (CS_ENTITY_INVISIBLE | CS_ENTITY_NOCLIP);
Disabling flags:
csRef<iMeshWrapper> someWrapper = ...; someWrapper->SetFlagsRecursive (CS_ENTITY_INVISIBLE | CS_ENTITY_NOCLIP, 0);
- Remarks:
- To set flags non-recursive, use GetFlags().Set().
virtual void iMeshWrapper::SetMaximumRenderDistance | ( | float | min | ) | [pure virtual] |
Set the maximum distance at which this mesh will be rendered.
By default this is 0.
virtual void iMeshWrapper::SetMaximumRenderDistanceVar | ( | iSharedVariable * | min | ) | [pure virtual] |
Set the maximum distance at which this mesh will be rendered.
This version uses a variable. By default this is 1000000000.0.
virtual void iMeshWrapper::SetMeshObject | ( | iMeshObject * | ) | [pure virtual] |
Set the iMeshObject.
virtual void iMeshWrapper::SetMinimumRenderDistance | ( | float | min | ) | [pure virtual] |
Set the minimum distance at which this mesh will be rendered.
By default this is 0.
virtual void iMeshWrapper::SetMinimumRenderDistanceVar | ( | iSharedVariable * | min | ) | [pure virtual] |
Set the minimum distance at which this mesh will be rendered.
This version uses a variable. By default this is -1000000000.0.
virtual void iMeshWrapper::SetRenderPriority | ( | CS::Graphics::RenderPriority | rp | ) | [pure virtual] |
The renderer will render all objects in a sector based on this number.
Low numbers get rendered first. High numbers get rendered later. There are a few often used slots:
- 1. Sky objects are rendered before everything else. Usually they are rendered using ZFILL (or ZNONE).
- 2. Walls are rendered after that. They usually use ZFILL.
- 3. After that normal objects are rendered using the Z-buffer (ZUSE).
- 4. Alpha transparent objects or objects using some other transparency system are rendered after that. They are usually rendered using ZTEST.
virtual void iMeshWrapper::SetRenderPriorityRecursive | ( | CS::Graphics::RenderPriority | rp | ) | [pure virtual] |
Same as SetRenderPriority() but this version will recursively set render priority for the children too.
virtual void iMeshWrapper::SetZBufMode | ( | csZBufMode | mode | ) | [pure virtual] |
Set the Z-buf drawing mode to use for this object.
Possible values are:
- CS_ZBUF_NONE: do not read nor write the Z-buffer.
- CS_ZBUF_FILL: only write the Z-buffer but do not read.
- CS_ZBUF_USE: write and read the Z-buffer.
- CS_ZBUF_TEST: only read the Z-buffer but do not write.
virtual void iMeshWrapper::SetZBufModeRecursive | ( | csZBufMode | mode | ) | [pure virtual] |
Same as SetZBufMode() but this will also set the z-buf mode for the children too.
The documentation for this struct was generated from the following file:
- iengine/mesh.h
Generated for Crystal Space 2.0 by doxygen 1.6.1