In file include/csengine/portal.h:

## class csPortal

> This class represents a portal

### Public Methods

  virtual void | CalculateLighting (csLightView& lview) Update lighting of all polygons reachable through this portal
  | csPortal () Create a portal
  void | DisableSpaceWarping () Disable space warping
  virtual bool | Draw (csPolygon2D* new_clipper, csPolygon3D* portal_polygon, csRenderView& rview) Draw the sector that is visible through this portal
  virtual csSector* | FollowSegment (csReversibleTransform& t, csVector3& new_position, bool& mirror) Follow a segment through this portal and modify the given camera transformation according to the space warping
  int | GetAlpha ()
  csSector* | GetSector () Return the sector that this portal points too
  virtual csPolygon3D* | HitBeam (csVector3& start, csVector3& end) Follow a beam through this portal and return the polygon that it hits with
  virtual csPolygon3D* | IntersectSphere (csVector3& center, float radius, float* pr = NULL) Intersects world-space sphere through this sector
  bool | IsClippingPortal () Is this a clipping portal?
  bool | IsSpaceWarped () Check if space is warped by this portal
  bool | IsStaticDest () Get static destination
  void | ObjectToWorld (const csReversibleTransform& t) Transform the warp matrix from object space to world space
  void | SetAlpha (int a)
  void | SetClippingPortal (bool c) Disable/enable clipping portal
  void | SetFilter (float r, float g, float b) Set the filter (instead of the texture)
  void | SetSector (csSector* s) Set the sector that this portal points too
  void | SetStaticDest (bool sd) Set static destination
  void | SetTexture (ITextureHandle* ft) Set the texture (used for filtering)
  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) Set the warping transformation for this portal in object space and world space
  void | WarpSpace (csReversibleTransform& t, bool& mirror) Warp space using the given world->camera transformation
  virtual | ~csPortal () Destructor.

### Protected Fields

  int | cfg_alpha 0 is no alpha, 25 is 25% see through and 75% texture,
  bool | do_clip_portal If true then this portal will clip geometry in the destination sector
  bool | do_mirror A flag which indicates if this portal mirrors space (changes the order of the vertices)
  bool | do_warp_space If this polygon is a portal it possibly has a transformation matrix and vector to warp space in some way
  float | filter_r If filter_texture is NULL then this filter is used instead
  ITextureHandle* | filter_texture A portal will change the intensity/color of the light that passes through it depending on the texture
  bool | static_dest A flag which indicates if the destination of this portal should not be transformed from object to world space
  csReversibleTransform | warp_obj Warp transform in object space.
  csReversibleTransform | warp_wor Warp transform in world space.

### Private Fields

  csSector* | sector The sector that this portal points to.

## Documentation

> This class represents a portal. It belongs to some polygon which is then considered a portal to another sector.

`csSector* sector`
  The sector that this portal points to.

`int cfg_alpha`
  0 is no alpha, 25 is 25% see through and 75% texture, ... Possible values are 0, 25, 50, and 75.

`bool do_warp_space`
  If this polygon is a portal it possibly has a transformation matrix and vector to warp space in some way. This way mirrors can be implemented. If true the space should be warped through the portal.

`bool do_mirror`
  A flag which indicates if this portal mirrors space (changes the order of the vertices). A normal space warping transformation which just relocates space does not mirror space. A reflecting wall mirrors space.

`bool do_clip_portal`
  If true then this portal will clip geometry in the destination sector. This must be used for portals which arrive in the middle of a sector. But don't use it otherwise because it decreases efficiency.

`bool static_dest`
  A flag which indicates if the destination of this portal should not be transformed from object to world space. For mirrors you should disable this flag because you want the destination to move with the source.

`csReversibleTransform warp_obj`
  Warp transform in object space.

`csReversibleTransform warp_wor`
  Warp transform in world space.

`ITextureHandle* filter_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

`csPortal()`
  Create a portal

`virtual ~csPortal()`
  Destructor.

`csSector* GetSector()`
  Return the sector that this portal points too

`void SetSector(csSector* s)`
  Set the sector that this portal points too

`void ObjectToWorld(const csReversibleTransform& t)`
  Transform the warp matrix from object space to world 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)`
  Set the warping transformation for this portal in object space and world space

`bool IsSpaceWarped()`
  Check if space is warped by this portal

`void DisableSpaceWarping()`
  Disable space warping

`void SetClippingPortal(bool c)`
  Disable/enable clipping portal. If true then this portal will clip geometry in the destination sector. This must be used for portals which arrive in the middle of a sector. But don't use it otherwise because it decreases efficiency.

`bool IsClippingPortal()`
  Is this a clipping portal?

`void SetStaticDest(bool sd)`
  Set static destination. If this field is true then the portal points to a static destination. This means that when the portal moves (because it is part of a thing that moves for example) then the destination of the portal will remain fixed. For mirrors you want this to be false so that the destination moves with the portal.

`bool IsStaticDest()`
  Get static destination

`void SetTexture(ITextureHandle* ft)`
  Set the texture (used for filtering)

`void SetFilter(float r, float g, float b)`
  Set the filter (instead of the texture)

`int GetAlpha()`

`void SetAlpha(int a)`

`void WarpSpace(csReversibleTransform& t, bool& mirror)`
  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.

`virtual bool Draw(csPolygon2D* new_clipper, csPolygon3D* portal_polygon, csRenderView& 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 csRenderView.

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

`virtual csPolygon3D* HitBeam(csVector3& start, csVector3& end)`
  Follow a beam through this portal and return the polygon that it hits with. NOTE@@@! This function does not take proper care of space warping!

`virtual csPolygon3D* IntersectSphere(csVector3& center, float radius, float* pr = NULL)`
  Intersects world-space sphere through this sector. Return closest polygon that is hit (or NULL) and the intersection point. If 'pr' != NULL it will also return the distance where the intersection happened.

`virtual csSector* FollowSegment(csReversibleTransform& t, csVector3& new_position, bool& mirror)`
  Follow a segment through this portal and modify the given camera transformation according to the space warping. This function will modify all the given parameters. These should be used as the new camera transformation when you decide to use it.

  This function returns the destination.

`virtual void CalculateLighting(csLightView& lview)`
  Update lighting of all polygons reachable through this portal

This class has no child classes.

alphabetic index hierarchy of classes

this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de