CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

iMeshWrapper Struct Reference
[Mesh support]

A mesh wrapper is an engine-level object that wraps around an actual mesh object (iMeshObject). More...

#include <mesh.h>

Inheritance diagram for iMeshWrapper:

iBase List of all members.

Public Methods

virtual iObjectQueryObject ()=0
 Get the iObject for this mesh object.

virtual iMeshObjectGetMeshObject () const=0
 Get the iMeshObject.

virtual void SetMeshObject (iMeshObject *)=0
 Set the iMeshObject.

virtual iPortalContainerGetPortalContainer () const=0
 If this mesh is a portal container you can use GetPortalContainer() to get the portal container interface.

virtual iLightingInfoGetLightingInfo () const=0
 Get the optional lighting information that is implemented by this mesh object.

virtual iShadowReceiverGetShadowReceiver ()=0
 Get the optional shadow receiver that is implemented by this mesh object.

virtual iShadowCasterGetShadowCaster ()=0
 Get the optional shadow caster that is implemented by this mesh object.

virtual uint GetVisibilityNumber () const=0
 Optimization to avoid having to do SCF_QUERY_INTERFACE for iVisibilityObject.

virtual iMeshFactoryWrapperGetFactory () const=0
 Get the parent factory.

virtual void SetFactory (iMeshFactoryWrapper *factory)=0
 Set the parent factory (this only sets a pointer).

virtual void SetLightingUpdate (int flags, int num_lights)=0
 Control how lighting updates should take place.

virtual iMovableGetMovable () const=0
 Get the movable instance for this object.

virtual void PlaceMesh ()=0
 This routine will find out in which sectors a mesh object is positioned.

virtual int HitBeamBBox (const csVector3 &start, const csVector3 &end, csVector3 &isect, float *pr)=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 object is hit by this object space vector.

virtual bool HitBeamObject (const csVector3 &start, const csVector3 &end, csVector3 &isect, float *pr, int *polygon_idx=0)=0
 Check if this object is hit by this object space vector.

virtual bool HitBeam (const csVector3 &start, const csVector3 &end, csVector3 &isect, float *pr)=0
 Check if this object is hit by this world space vector.

virtual void SetDrawCallback (iMeshDrawCallback *cb)=0
 Set a callback which is called just before the object is drawn.

virtual void RemoveDrawCallback (iMeshDrawCallback *cb)=0
 Remove a draw callback.

virtual int GetDrawCallbackCount () const=0
 Get the number of draw callbacks.

virtual iMeshDrawCallbackGetDrawCallback (int idx) const=0
 Get the specified draw callback.

virtual void SetRenderPriority (long rp)=0
 The renderer will render all objects in a sector based on this number.

virtual long GetRenderPriority () const=0
 Get the render priority.

virtual void SetRenderPriorityRecursive (long rp)=0
 Same as SetRenderPriority() but this version will recursively set render priority for the children too.

virtual csFlagsGetFlags ()=0
 Get flags for this meshwrapper.

virtual void SetFlagsRecursive (uint32 mask, uint32 flags)=0
 Set some flags with the given mask for this mesh and all children.

virtual void SetZBufMode (csZBufMode mode)=0
 Set the Z-buf drawing mode to use for this object.

virtual csZBufMode GetZBufMode () const=0
 Get the Z-buf drawing mode.

virtual void SetZBufModeRecursive (csZBufMode mode)=0
 Same as SetZBufMode() but this will also set the z-buf mode for the children too.

virtual void HardTransform (const csReversibleTransform &t)=0
 Do a hard transform of this object.

virtual void GetWorldBoundingBox (csBox3 &cbox)=0
 Get the bounding box of this object in world space.

virtual void GetTransformedBoundingBox (const csReversibleTransform &trans, csBox3 &cbox)=0
 Get the bounding box of this object after applying a transformation to it.

virtual float GetScreenBoundingBox (iCamera *camera, csBox2 &sbox, csBox3 &cbox)=0
 Get a very inaccurate bounding box of the object in screen space.

virtual iMeshListGetChildren ()=0
 Get all the children of this mesh object.

virtual iMeshWrapper * GetParentContainer ()=0
 Get the parent of this mesh.

virtual void SetParentContainer (iMeshWrapper *)=0
 Set the parent of this mesh.

virtual void GetRadius (csVector3 &rad, csVector3 &cent) const=0
 Get the radius of this mesh and all its children.

virtual iLODControlCreateStaticLOD ()=0
 Create a LOD control for this mesh wrapper.

virtual void DestroyStaticLOD ()=0
 Destroy the LOD control for this mesh.

virtual iLODControlGetStaticLOD ()=0
 Get the LOD control for this mesh.

virtual void AddMeshToStaticLOD (int lod, iMeshWrapper *mesh)=0
 Set a given child mesh at a specific lod level.

virtual void RemoveMeshFromStaticLOD (iMeshWrapper *mesh)=0
 Remove a child mesh from all lod levels.

virtual void DrawShadow (iRenderView *rview, iLight *light)=0
 Draws the shadow buffer pass.

virtual void DrawLight (iRenderView *rview, iLight *light)=0
 Draws the diffuse light mesh object.

virtual void CastHardwareShadow (bool castShadow)=0
 Enable/disable hardware based shadows alltogheter.

virtual void SetDrawAfterShadow (bool drawAfter)=0
 Sets so that the meshobject is rendered after all fancy HW-shadow-stuff.

virtual bool GetDrawAfterShadow ()=0
 Get if the meshobject is rendered after all fancy HW-shadow-stuff.


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:

Main ways to get pointers to this interface: Main users of this interface:

Definition at line 191 of file mesh.h.


Member Function Documentation

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 void iMeshWrapper::CastHardwareShadow bool    castShadow [pure virtual]
 

Enable/disable hardware based shadows alltogheter.

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 void iMeshWrapper::DrawLight iRenderView   rview,
iLight   light
[pure virtual]
 

Draws the diffuse light mesh object.

virtual void iMeshWrapper::DrawShadow iRenderView   rview,
iLight   light
[pure virtual]
 

Draws the shadow buffer pass.

This sets of the stencil for the lights

virtual iMeshList* iMeshWrapper::GetChildren   [pure virtual]
 

Get all the children of this mesh object.

This is used for hierarchical meshes. If you want to make a hierarchical mesh you can call GetChildren ()->Add (mesh).

virtual bool iMeshWrapper::GetDrawAfterShadow   [pure virtual]
 

Get if the meshobject is rendered after all fancy HW-shadow-stuff.

virtual iMeshDrawCallback* iMeshWrapper::GetDrawCallback int    idx const [pure virtual]
 

Get the specified draw callback.

virtual int iMeshWrapper::GetDrawCallbackCount   [pure virtual]
 

Get the number of draw callbacks.

virtual iMeshFactoryWrapper* iMeshWrapper::GetFactory   [pure virtual]
 

Get the parent factory.

virtual csFlags& iMeshWrapper::GetFlags   [pure virtual]
 

Get flags for this meshwrapper.

The following flags are supported:

virtual iLightingInfo* iMeshWrapper::GetLightingInfo   [pure virtual]
 

Get the optional lighting information that is implemented by this mesh object.

If the mesh object doesn't implement it then this will return 0. This is similar (but more efficient) to calling SCF_QUERY_INTERFACE on the mesh object for iLightingInfo.

virtual iMeshObject* iMeshWrapper::GetMeshObject   [pure virtual]
 

Get the iMeshObject.

virtual iMovable* iMeshWrapper::GetMovable   [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 iMeshWrapper* iMeshWrapper::GetParentContainer   [pure virtual]
 

Get the parent of this mesh.

Returns 0 if the mesh has no parent (i.e. it is contained in the engine directly). If not 0 then this mesh is part of a hierarchical mesh.

virtual iPortalContainer* iMeshWrapper::GetPortalContainer   [pure virtual]
 

If this mesh is a portal container you can use GetPortalContainer() to get the portal container interface.

virtual void iMeshWrapper::GetRadius csVector3   rad,
csVector3   cent
const [pure virtual]
 

Get the radius of this mesh and all its children.

virtual long iMeshWrapper::GetRenderPriority   [pure virtual]
 

Get the render priority.

virtual float iMeshWrapper::GetScreenBoundingBox iCamera   camera,
csBox2   sbox,
csBox3   cbox
[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 iShadowCaster* iMeshWrapper::GetShadowCaster   [pure virtual]
 

Get the optional shadow caster that is implemented by this mesh object.

If the mesh object doesn't implement it then this will return 0. This is similar (but more efficient) to calling SCF_QUERY_INTERFACE on the mesh object for iShadowCaster.

Note! If the mesh is a static lod mesh (i.e. a parent of a mesh hierarchy that is used for static lod) then this will return a shadow caster that gets shadows from the highest detail objects.

virtual iShadowReceiver* iMeshWrapper::GetShadowReceiver   [pure virtual]
 

Get the optional shadow receiver that is implemented by this mesh object.

If the mesh object doesn't implement it then this will return 0. This is similar (but more efficient) to calling SCF_QUERY_INTERFACE on the mesh object for iShadowReceiver.

Note! If the mesh is a static lod mesh (i.e. a parent of a mesh hierarchy that is used for static lod) then this will return a shadow receiver that automatically multiplexes the receiving shadows to all child meshes.

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 void iMeshWrapper::GetTransformedBoundingBox const csReversibleTransform   trans,
csBox3   cbox
[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 uint iMeshWrapper::GetVisibilityNumber   [pure virtual]
 

Optimization to avoid having to do SCF_QUERY_INTERFACE for iVisibilityObject.

virtual void iMeshWrapper::GetWorldBoundingBox csBox3   cbox [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   [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 bool iMeshWrapper::HitBeam const csVector3   start,
const csVector3   end,
csVector3   isect,
float *    pr
[pure virtual]
 

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

Return the collision point in world space coordinates.

virtual int iMeshWrapper::HitBeamBBox 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 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.

virtual bool iMeshWrapper::HitBeamObject const csVector3   start,
const csVector3   end,
csVector3   isect,
float *    pr,
int *    polygon_idx = 0
[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.

virtual bool iMeshWrapper::HitBeamOutline const csVector3   start,
const csVector3   end,
csVector3   isect,
float *    pr
[pure virtual]
 

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

Outline check.

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 void iMeshWrapper::RemoveDrawCallback iMeshDrawCallback   cb [pure virtual]
 

Remove a draw callback.

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::SetDrawAfterShadow bool    drawAfter [pure virtual]
 

Sets so that the meshobject is rendered after all fancy HW-shadow-stuff.

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
[pure virtual]
 

Set some flags with the given mask for this mesh and all children.

virtual void iMeshWrapper::SetLightingUpdate int    flags,
int    num_lights
[pure virtual]
 

Control how lighting updates should take place.

'num_lights' is the number of lights that will be given to the mesh object at maximum (default is 8). 'flags' can be a combination of one of the following:

Note that this function has no effect on thing mesh objects as they use another lighting system (lightmaps). Also some genmesh objects can optionally also use the other lighting system in which nothing will happen either.

virtual void iMeshWrapper::SetMeshObject iMeshObject   [pure virtual]
 

Set the iMeshObject.

virtual void iMeshWrapper::SetParentContainer iMeshWrapper *    [pure virtual]
 

Set the parent of this mesh.

This only changes the 'parent' pointer but does not add the mesh as a child mesh. Internal use only.

virtual void iMeshWrapper::SetRenderPriority long    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 long    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:

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:
Generated for Crystal Space by doxygen 1.2.18