Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csPortal Class Reference

This class represents a portal. More...

#include <portal.h>

Inheritance diagram for csPortal:

csObject iObject iBase List of all members.

Public Methods

 csPortal ()
 Create a portal.

virtual ~csPortal ()
 Destructor.

iReferencedObjectGetReferencedObject () const
 For iReference.

void SetReferencedObject (iReferencedObject *b)
 For iReference.

iSectorGetSector () const
 Return the sector that this portal points too.

void SetSector (iSector *s)
 Set the sector that this portal points too. More...

csFlagsGetFlags ()
 Set portal flags (see CS_PORTAL_XXX values).

void SetMaximumSectorVisit (int msv)
 Set the maximum sector visit.

int GetMaximumSectorVisit () const
 Get the maximum sector visit.

void SetPortalCallback (iPortalCallback *cb)
 Set the portal callback.

iPortalCallbackGetPortalCallback () const
 Get the portal callback.

void SetMissingSectorCallback (iPortalCallback *cb)
 Set the missing sector callback.

iPortalCallbackGetMissingSectorCallback () const
 Get the missing sector callback.

void SetFilter (iTextureHandle *ft)
 Set the filter texture.

iTextureHandleGetTextureFilter () const
 Get the filter texture.

void SetFilter (float r, float g, float b)
 Set a color filter (instead of the texture).

void GetColorFilter (float &r, float &g, float &b) const
 Get the current color filter.

const csReversibleTransformGetWarp () const
 Get the warping transformation in object space.

void SetWarp (const csTransform &t)
 Set the warping transformation for this portal in object space and world space.

void SetWarp (const csMatrix3 &m_w, const csVector3 &v_w_before, const csVector3 &v_w_after)
void SetMirror (iPolygon3D *iPoly)
 Set warping transformation to mirror.

void ObjectToWorld (const csReversibleTransform &t)
 Transform the warp matrix from object space to world space.

void HardTransform (const csReversibleTransform &t)
 Hard transform the warp matrix.

csVector3 Warp (const csVector3 &pos) const
 Warp a position in world space.

void WarpSpace (csReversibleTransform &t, bool &mirror) const
 Warp space using the given world->camera transformation. More...

bool Draw (csPolygon2D *new_clipper, csPolygon3D *portal_polygon, iRenderView *rview)
 Draw the sector that is visible through this portal. More...

csPolygon3DHitBeam (const csVector3 &start, const csVector3 &end, csVector3 &isect)
 Follow a beam through this portal and return the polygon that it hits with. More...

csMeshWrapperHitBeam (const csVector3 &start, const csVector3 &end, csVector3 &isect, csPolygon3D **polygonPtr)
 Follow a beam through this portal and return the object that it hits with. More...

bool CompleteSector (iBase *context)
 Check if the destination sector is NULL and if so call the callback. More...

void CheckFrustum (iFrustumView *lview, int alpha)
 Check frustum visibility of all polygons reachable through this portal. More...

 SCF_DECLARE_IBASE_EXT (csObject)

Public Attributes

csFlags flags
 Set of flags.

csPortal::Portal  scfiPortal

Protected Attributes

csReversibleTransform warp_obj
 Warp transform in object space.

csReversibleTransform warp_wor
 Warp transform in world space.

iPortalCallbacksector_cb
 Callback when a sector is missing.

iPortalCallbackportal_cb
 Callback for traversing to a portal.

int max_sector_visit
 Maximum number of time a single sector will be visited by this portal.

iTextureHandlefilter_texture
 A portal will change the intensity/color of the light that passes through it depending on the texture.

float filter_r
 If filter_texture is NULL then this filter is used instead.

float filter_g
 If filter_texture is NULL then this filter is used instead.

float filter_b
 If filter_texture is NULL then this filter is used instead.


Detailed Description

This class represents a portal.

It belongs to some polygon which is then considered a portal to another sector.


Member Function Documentation

void csPortal::CheckFrustum ( iFrustumView * lview,
int alpha )
 

Check frustum visibility of all polygons reachable through this portal.

Alpha is the alpha value you'd like to use to pass through this portal (0 is no completely transparent, 100 is complete opaque).

bool csPortal::CompleteSector ( iBase * context )
 

Check if the destination sector is NULL and if so call the callback.

This function returns false if the portal should not be traversed.

bool csPortal::Draw ( csPolygon2D * new_clipper,
csPolygon3D * portal_polygon,
iRenderView * rview )
 

Draw the sector that is visible through this portal.

This function can be overriden by a subclass of Portal to support portals to other types of engines. This function also takes care of space warping.

'new_clipper' is the new 2D polygon to which all things drawn should be clipped.
'portal_polygon' is the polygon containing this portal. This routine will use the camera space plane of the portal polygon.
'rview' is the current iRenderView.

Return true if succesful, false otherwise. Failure to draw through a portal does not need to be harmful. It can just mean that some maximum number is reached (like the maximum number of times a certain sector can be drawn through a mirror).

csMeshWrapper * csPortal::HitBeam ( const csVector3 & start,
const csVector3 & end,
csVector3 & isect,
csPolygon3D ** polygonPtr )
 

Follow a beam through this portal and return the object that it hits with.

This function properly acounts for space warping portals and also checks for infinite recursion (does not allow traversing the same sector more than five times). Optionally returns the polygon in 'polygonPtr'.

csPolygon3D * csPortal::HitBeam ( const csVector3 & start,
const csVector3 & end,
csVector3 & isect )
 

Follow a beam through this portal and return the polygon that it hits with.

This function properly acounts for space warping portals and also checks for infinite recursion (does not allow traversing the same sector more than five times). Returns the intersection point with the polygon in 'isect'.

void csPortal::SetSector ( iSector * s )
 

Set the sector that this portal points too.

To avoid circular references, the sector is not IncRef'ed!

void csPortal::WarpSpace ( csReversibleTransform & t,
bool & mirror ) const
 

Warp space using the given world->camera transformation.

This function modifies the given camera transformation to reflect the warping change.

't' is the transformation from world to camera space.
'mirror' is true if the camera transformation transforms all polygons so that the vertices are ordered anti-clockwise. 'mirror' will be modified by warp_space if needed.


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