Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

iMeshWrapper Struct Reference

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 csMeshWrapperGetPrivateObject ()=0
 UGLY!!!@. More...

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 iMeshFactoryWrapperGetFactory () const=0
 Get the parent factory.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

virtual void Draw (iRenderView *rview)=0
 Draw this mesh. More...

virtual bool WantToDie ()=0
 Returns true if the object wants to die.


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.


Member Function Documentation

void iMeshWrapper::DeferUpdateLighting ( int flags,
int num_lights ) [pure virtual]
 

Update lighting as soon as the object becomes visible.

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

void iMeshWrapper::Draw ( iRenderView * rview ) [pure virtual]
 

Draw this mesh.

This is a function that you normally don't have to call on your own as the engine does this for you. However it can be useful to have this function in some special cases where you want to render mesh objects in a CSWS window or something like that.

csFlags & iMeshWrapper::GetFlags ( ) [pure virtual]
 

Get flags for this meshwrapper.

The following flags are supported:

  • CS_ENTITY_CONVEX: entity is convex. This can help the engine with optimizing rendering.
  • CS_ENTITY_DETAIL: this is a detail object. Again this is a hint for the engine to render this object differently.
  • CS_ENTITY_CAMERA: entity will always be centered around the camera.
  • CS_ENTITY_INVISIBLE: entity is invisible.
  • CS_ENTITY_NOSHADOWS: cast no shadows.
  • CS_ENTITY_NOLIGHTING: do not light this object.

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.

iMeshWrapper * iMeshWrapper::GetParentContainer ( ) [pure virtual]
 

Get the parent of this mesh.

Returns NULL if the mesh has no parent (i.e. it is contained in the engine directly).

csMeshWrapper * iMeshWrapper::GetPrivateObject ( ) [pure virtual]
 

UGLY!!!@.

@

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.

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.

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.

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.

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.

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. Usefull for grid structures.

bool iMeshWrapper::HitBeamObject ( const csVector3 & start,
const csVector3 & end,
csVector3 & isect,
float * pr ) [pure virtual]
 

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

Return the collision point in object space coordinates.

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.

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.

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

void iMeshWrapper::SetParentContainer ( iMeshWrapper * p ) [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.

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.

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.

void iMeshWrapper::UpdateLighting ( iLight ** lights,
int num_lights ) [pure virtual]
 

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

fill the vertex color array). No shadow calculation will be done. This is assumed to have been done earlier. This is a primitive lighting process based on the lights which hit one point of the sprite (usually the center). More elaborate lighting systems are possible but this will do for now.


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