CrystalSpace

Public API Reference

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

csMeshWrapper Class Reference

The holder class for all implementations of iMeshObject. More...

#include <meshobj.h>

Inheritance diagram for csMeshWrapper:

csObject iObject iBase List of all members.

Public Methods

 csMeshWrapper (iMeshWrapper *theParent, iMeshObject *meshobj)
 Constructor. More...

 csMeshWrapper (iMeshWrapper *theParent)
 Constructor. More...

void SetParentContainer (iMeshWrapper *newParent)
 Set parent container for this object. More...

iMeshWrapperGetParentContainer () const
 Get parent container for this object. More...

void SetFactory (iMeshFactoryWrapper *factory)
 Set the mesh factory. More...

iMeshFactoryWrapperGetFactory () const
 Get the mesh factory. More...

void SetMeshObject (iMeshObject *meshobj)
 Set the mesh object. More...

iMeshObjectGetMeshObject () const
 Get the mesh object. More...

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

csZBufMode GetZBufMode () const
 Get the Z-buf drawing mode. More...

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

void SetVisibilityNumber (uint32 vis)
 Mark this object as visible. More...

uint32 GetVisibilityNumber () const
 Return if this object is visible. More...

void UpdateLighting (iLight **lights, int num_lights)
 Light object according to the given array of lights (i.e. More...

void DeferUpdateLighting (int flags, int num_lights)
 Update lighting as soon as the object becomes visible. More...

void Draw (iRenderView *rview)
 Draw this mesh object given a camera transformation. More...

csRenderMesh ** GetRenderMeshes (int &num)
 Draw the zpass for the object. More...

void DrawShadow (iRenderView *rview, iLight *light)
 This pass sets up the shadow stencil buffer. More...

void DrawLight (iRenderView *rview, iLight *light)
 This pass draws the diffuse lit mesh. More...

void CastHardwareShadow (bool castShadow)
 Enable/disable hardware based shadows alltogheter. More...

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

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

float GetSquaredDistance (iRenderView *rview)
 Calculate the squared distance between the camera and the object. More...

csMovableGetMovable ()
 Get the movable instance for this object. More...

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

int HitBeamBBox (const csVector3 &start, const csVector3 &end, csVector3 &isect, float *pr)
 Check if this object is hit by this object space vector. More...

bool HitBeamOutline (const csVector3 &start, const csVector3 &end, csVector3 &isect, float *pr)
 Check if this object is hit by this object space vector. More...

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

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

const csMeshMeshListGetChildren () const
 Get the children of this mesh object. More...

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

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

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

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

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

void SetRenderPriority (long rp)
 Set the render priority for this object. More...

long GetRenderPriority () const
 Get the render priority for this object. More...

void SetImposterActive (bool flag, iObjectRegistry *objreg)
 Set true if this Mesh should use Impostering. More...

bool GetImposterActive () const
 Determine if this mesh is using Impostering (not if Imposter is being drawn, but simply considered). More...

void SetMinDistance (iSharedVariable *dist)
 Minimum Imposter Distance is the distance from camera beyond which imposter is used. More...

void SetRotationTolerance (iSharedVariable *angle)
 Rotation Tolerance is the maximum allowable angle difference between when the imposter was created and the current position of the camera. More...

void CreateImposter (csReversibleTransform &)
 Tells the object to create its proctex and polygon for use by main render process later, relative to the specified Point Of View. More...

bool DrawImposter (iRenderView *rview)
 Renders the imposter on the screen. More...

bool WouldUseImposter (csReversibleTransform &)
 Determine if imposter or true rendering will be used. More...

bool CheckImposterRelevant (iRenderView *rview)
 This is true function to check distances. Fn above may not be needed. More...

void DrawIntFull (iRenderView *rview)
 Draw this mesh object given a camera transformation, non-impostered. More...


Public Attributes

csFlags flags
 Set of flags. More...

csFlags culler_flags
 Culler flags. More...


Protected Methods

void GetFullBBox (csBox3 &box)
 Get the bounding box in world space and correct in hierarchy. More...

void UpdateDeferedLighting (const csBox3 &box)
 Update defered lighting. More...

void MoveToSector (iSector *s)
 Move this object to the specified sector. Can be called multiple times. More...

void RemoveFromSectors ()
 Remove this object from all sectors it is in (but not from the engine). More...

void UpdateMove ()
 Update transformations after the object has moved (through updating the movable instance). More...

void DrawInt (iRenderView *rview)
 This function determines whether to draw the imposter or the true mesh and calls the appropriate function. More...

virtual ~csMeshWrapper ()
 Destructor. More...


Protected Attributes

iMeshWrapperParent
 The parent mesh object, or 0. More...

csBox3 wor_bbox
 Bounding box in world space. More...

long wor_bbox_movablenr
 Last used movable number for wor_bbox. More...

int defered_num_lights
 Defered lighting. If > 0 then we have defered lighting. More...

int defered_lighting_flags
 Flags to use for defered lighting. More...

bool draw_test
 For NR: Cached value from DrawTest. More...

bool in_light
 For NR: Cached light test. More...

bool cast_hardware_shadow
 For NR: Should we draw anything in drawshadow at all? More...

bool draw_after_fancy_stuff
 For NR: should we draw last. More...

csTicks last_anim_time
 This value indicates the last time that was used to do animation. More...

uint32 visnr
 Current visibility number used by the visibility culler. More...

csMovable movable
 Position in the world. More...

csRef< csStaticLODMeshstatic_lod
 Optional LOD control that will turn a hierarchical mesh in a mesh that supports static LOD. More...

long render_priority
 The renderer will render all objects in a sector based on this number. More...


Friends

class csMovable
class csMovableSectorList

Detailed Description

The holder class for all implementations of iMeshObject.

Definition at line 147 of file meshobj.h.


Constructor & Destructor Documentation

virtual csMeshWrapper::~csMeshWrapper   [protected, virtual]
 

Destructor.

This is private in order to force clients to use DecRef() for object destruction.

csMeshWrapper::csMeshWrapper iMeshWrapper   theParent,
iMeshObject   meshobj
 

Constructor.

csMeshWrapper::csMeshWrapper iMeshWrapper   theParent
 

Constructor.


Member Function Documentation

void csMeshWrapper::CastHardwareShadow bool    castShadow
 

Enable/disable hardware based shadows alltogheter.

bool csMeshWrapper::CheckImposterRelevant iRenderView   rview
 

This is true function to check distances. Fn above may not be needed.

void csMeshWrapper::CreateImposter csReversibleTransform   [inline]
 

Tells the object to create its proctex and polygon for use by main render process later, relative to the specified Point Of View.

Definition at line 540 of file meshobj.h.

void csMeshWrapper::DeferUpdateLighting int    flags,
int    num_lights
 

Update lighting as soon as the object becomes visible.

This will call engine->GetNearestLights with the supplied parameters.

void csMeshWrapper::Draw iRenderView   rview
 

Draw this mesh object given a camera transformation.

If needed the skeleton state will first be updated. Optionally update lighting if needed (DeferUpdateLighting()).

bool csMeshWrapper::DrawImposter iRenderView   rview
 

Renders the imposter on the screen.

void csMeshWrapper::DrawInt iRenderView   rview [protected]
 

This function determines whether to draw the imposter or the true mesh and calls the appropriate function.

void csMeshWrapper::DrawIntFull iRenderView   rview
 

Draw this mesh object given a camera transformation, non-impostered.

If needed the skeleton state will first be updated. Optionally update lighting if needed (DeferUpdateLighting()).

void csMeshWrapper::DrawLight iRenderView   rview,
iLight   light
 

This pass draws the diffuse lit mesh.

void csMeshWrapper::DrawShadow iRenderView   rview,
iLight   light
 

This pass sets up the shadow stencil buffer.

const csMeshMeshList& csMeshWrapper::GetChildren   const [inline]
 

Get the children of this mesh object.

Definition at line 457 of file meshobj.h.

bool csMeshWrapper::GetDrawAfterShadow  
 

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

iMeshFactoryWrapper* csMeshWrapper::GetFactory   const [inline]
 

Get the mesh factory.

Definition at line 303 of file meshobj.h.

void csMeshWrapper::GetFullBBox csBox3   box [protected]
 

Get the bounding box in world space and correct in hierarchy.

bool csMeshWrapper::GetImposterActive   const [inline]
 

Determine if this mesh is using Impostering (not if Imposter is being drawn, but simply considered).

Definition at line 513 of file meshobj.h.

iMeshObject* csMeshWrapper::GetMeshObject   const [inline]
 

Get the mesh object.

Definition at line 311 of file meshobj.h.

csMovable& csMeshWrapper::GetMovable   [inline]
 

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.

Definition at line 415 of file meshobj.h.

iMeshWrapper* csMeshWrapper::GetParentContainer   const [inline]
 

Get parent container for this object.

Definition at line 295 of file meshobj.h.

void csMeshWrapper::GetRadius csVector3   rad,
csVector3   cent
const
 

Get the radius of this mesh and all its children.

csRenderMesh** csMeshWrapper::GetRenderMeshes int &    num
 

Draw the zpass for the object.

If this object doesn't use lighting then it can be drawn fully here.

long csMeshWrapper::GetRenderPriority   const [inline]
 

Get the render priority for this object.

Definition at line 499 of file meshobj.h.

References render_priority.

float csMeshWrapper::GetScreenBoundingBox const iCamera   camera,
csBox2   sbox,
csBox3   cbox
 

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.

float csMeshWrapper::GetSquaredDistance iRenderView   rview
 

Calculate the squared distance between the camera and the object.

void csMeshWrapper::GetTransformedBoundingBox const csReversibleTransform   trans,
csBox3   cbox
 

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.

uint32 csMeshWrapper::GetVisibilityNumber   const [inline]
 

Return if this object is visible.

Definition at line 358 of file meshobj.h.

References uint32, and visnr.

void csMeshWrapper::GetWorldBoundingBox csBox3   cbox
 

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.

csZBufMode csMeshWrapper::GetZBufMode   const [inline]
 

Get the Z-buf drawing mode.

Definition at line 316 of file meshobj.h.

References csZBufMode.

void csMeshWrapper::HardTransform const csReversibleTransform   t
 

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.

bool csMeshWrapper::HitBeam const csVector3   start,
const csVector3   end,
csVector3   isect,
float *    pr
 

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

Return the collision point in world space coordinates.

int csMeshWrapper::HitBeamBBox const csVector3   start,
const csVector3   end,
csVector3   isect,
float *    pr
 

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

BBox version.

bool csMeshWrapper::HitBeamObject const csVector3   start,
const csVector3   end,
csVector3   isect,
float *    pr
 

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

Return the collision point in object space coordinates.

bool csMeshWrapper::HitBeamOutline const csVector3   start,
const csVector3   end,
csVector3   isect,
float *    pr
 

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

Outline version.

void csMeshWrapper::MoveToSector iSector   s [protected]
 

Move this object to the specified sector. Can be called multiple times.

void csMeshWrapper::PlaceMesh  
 

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.

void csMeshWrapper::RemoveFromSectors   [protected]
 

Remove this object from all sectors it is in (but not from the engine).

void csMeshWrapper::SetDrawAfterShadow bool    drawAfter
 

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

void csMeshWrapper::SetDrawCallback iMeshDrawCallback   cb [inline]
 

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).

Definition at line 326 of file meshobj.h.

References csArray< T *, csRefArrayElementHandler< T * > >::Push.

void csMeshWrapper::SetFactory iMeshFactoryWrapper   factory [inline]
 

Set the mesh factory.

Definition at line 298 of file meshobj.h.

void csMeshWrapper::SetImposterActive bool    flag,
iObjectRegistry   objreg
 

Set true if this Mesh should use Impostering.

void csMeshWrapper::SetMeshObject iMeshObject   meshobj
 

Set the mesh object.

void csMeshWrapper::SetMinDistance iSharedVariable   dist [inline]
 

Minimum Imposter Distance is the distance from camera beyond which imposter is used.

Imposter gets a ptr here because value is a shared variable which can be changed at runtime for many objects.

Definition at line 522 of file meshobj.h.

void csMeshWrapper::SetParentContainer iMeshWrapper   newParent [inline]
 

Set parent container for this object.

Definition at line 293 of file meshobj.h.

void csMeshWrapper::SetRenderPriority long    rp
 

Set the render priority for this object.

void csMeshWrapper::SetRotationTolerance iSharedVariable   angle [inline]
 

Rotation Tolerance is the maximum allowable angle difference between when the imposter was created and the current position of the camera.

Angle greater than this triggers a re-render of the imposter.

Definition at line 532 of file meshobj.h.

void csMeshWrapper::SetVisibilityNumber uint32    vis [inline]
 

Mark this object as visible.

Definition at line 347 of file meshobj.h.

References uint32, and visnr.

void csMeshWrapper::SetZBufMode csZBufMode    mode [inline]
 

Set the Z-buf drawing mode to use for this object.

Definition at line 314 of file meshobj.h.

References csZBufMode.

void csMeshWrapper::UpdateDeferedLighting const csBox3   box [protected]
 

Update defered lighting.

void csMeshWrapper::UpdateLighting iLight **    lights,
int    num_lights
 

Light object according to the given array of lights (i.e.

fill the vertex color array).

void csMeshWrapper::UpdateMove   [protected]
 

Update transformations after the object has moved (through updating the movable instance).

This MUST be done after you change the movable otherwise some of the internal data structures will not be updated correctly. This function is called by movable.UpdateMove();

bool csMeshWrapper::WouldUseImposter csReversibleTransform   [inline]
 

Determine if imposter or true rendering will be used.

Definition at line 549 of file meshobj.h.


Member Data Documentation

bool csMeshWrapper::cast_hardware_shadow [protected]
 

For NR: Should we draw anything in drawshadow at all?

Definition at line 176 of file meshobj.h.

csFlags csMeshWrapper::culler_flags
 

Culler flags.

Definition at line 256 of file meshobj.h.

int csMeshWrapper::defered_lighting_flags [protected]
 

Flags to use for defered lighting.

Definition at line 169 of file meshobj.h.

int csMeshWrapper::defered_num_lights [protected]
 

Defered lighting. If > 0 then we have defered lighting.

Definition at line 166 of file meshobj.h.

bool csMeshWrapper::draw_after_fancy_stuff [protected]
 

For NR: should we draw last.

Definition at line 178 of file meshobj.h.

bool csMeshWrapper::draw_test [protected]
 

For NR: Cached value from DrawTest.

Definition at line 172 of file meshobj.h.

csFlags csMeshWrapper::flags
 

Set of flags.

Definition at line 254 of file meshobj.h.

bool csMeshWrapper::in_light [protected]
 

For NR: Cached light test.

Definition at line 174 of file meshobj.h.

csTicks csMeshWrapper::last_anim_time [protected]
 

This value indicates the last time that was used to do animation.

If 0 then we haven't done animation yet. We compare this value with the value returned by engine->GetLastAnimationTime() to see if we need to call meshobj->NextFrame() again.

Definition at line 186 of file meshobj.h.

csMovable csMeshWrapper::movable [protected]
 

Position in the world.

Definition at line 196 of file meshobj.h.

iMeshWrapper* csMeshWrapper::Parent [protected]
 

The parent mesh object, or 0.

Definition at line 154 of file meshobj.h.

long csMeshWrapper::render_priority [protected]
 

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 predefined slots which the application is free to use or not.

Definition at line 210 of file meshobj.h.

Referenced by GetRenderPriority.

csRef<csStaticLODMesh> csMeshWrapper::static_lod [protected]
 

Optional LOD control that will turn a hierarchical mesh in a mesh that supports static LOD.

Definition at line 202 of file meshobj.h.

uint32 csMeshWrapper::visnr [protected]
 

Current visibility number used by the visibility culler.

Definition at line 191 of file meshobj.h.

Referenced by GetVisibilityNumber, and SetVisibilityNumber.

csBox3 csMeshWrapper::wor_bbox [protected]
 

Bounding box in world space.

This is a cache for GetWorldBoundingBox() which will recalculate this if the movable changes (by using movablenr).

Definition at line 161 of file meshobj.h.

long csMeshWrapper::wor_bbox_movablenr [protected]
 

Last used movable number for wor_bbox.

Definition at line 163 of file meshobj.h.


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