Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

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 *mesh)
 Constructor.

 csMeshWrapper (iMeshWrapper *theParent)
 Constructor.

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

iMeshWrapperGetParentContainer () const
 Get parent container for this object.

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

iMeshFactoryWrapperGetFactory () const
 Get the mesh factory.

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

iMeshObjectGetMeshObject () const
 Get the mesh object.

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

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

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

iMeshDrawCallbackGetDrawCallback () const
 Get the draw callback.

void MarkVisible ()
 Mark this object as visible.

void MarkInvisible ()
 Mark this object as invisible.

bool IsVisible () const
 Return if this object is visible.

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

bool WantToDie ()
 Returns true if this object wants to die.

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.

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

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.

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

 SCF_DECLARE_IBASE_EXT (csObject)

Public Attributes

csFlags flags
 Set of flags.

csMeshWrapper::MeshWrapper  scfiMeshWrapper
csMeshWrapper::VisObject  scfiVisibilityObject

Protected Methods

void UpdateDeferedLighting (const csVector3 &pos)
 Update defered lighting.

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

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

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

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

virtual ~csMeshWrapper ()
 Destructor. More...


Protected Attributes

iMeshWrapperParent
 The parent mesh object, or NULL.

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

long wor_bbox_movablenr
 Last used movable number for wor_bbox.

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

int defered_lighting_flags
 Flags to use for defered lighting.

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

bool is_visible
 Flag which is set to true when the object is visible. More...

csMovable movable
 Position in the world.

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


Friends

class  csMovable
class  csMovableSectorList
class  MeshWrapper
class  VisObject

Detailed Description

The holder class for all implementations of iMeshObject.


Constructor & Destructor Documentation

csMeshWrapper::~csMeshWrapper ( ) [protected, virtual]
 

Destructor.

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


Member Function Documentation

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

void csMeshWrapper::DrawInt ( iRenderView * rview ) [protected]
 

Draw this mesh object given a camera transformation.

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

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.

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.

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.

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.

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

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();


Member Data Documentation

bool csMeshWrapper::is_visible [protected]
 

Flag which is set to true when the object is visible.

This is used by the c-buffer/bsp routines. The object itself will not use this flag in any way at all. It is simply intended for external visibility culling routines.

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.

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.

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


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000