Crystal Space: iPortal Struct Reference (Crystal Space Public API Reference)

| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iPortal Struct Reference
[Crystal Space 3D Engine]

This is the interface to the Portal objects. More...

`#include <iengine/portal.h>`

Inheritance diagram for iPortal:

[legend]
List of all members.

## Public Member Functions
virtual void | CheckFrustum (iFrustumView *lview, const csReversibleTransform &t, int alpha)=0
| Check frustum visibility of all polygons reachable through this portal.
virtual bool | CompleteSector (iBase *context)=0
| Check if the destination sector is 0 and if so call the callback.
virtual void | ComputeCameraPlane (const csReversibleTransform &t, csPlane3 &camplane)=0
| Calculate the camera space plane for this portal.
virtual void | GetColorFilter (float &r, float &g, float &b) const =0
| Get the current color filter.
virtual csFlags & | GetFlags ()=0
| Set portal flags (see CS_PORTAL_XXX values).
virtual int | GetMaximumSectorVisit () const =0
| Get the maximum sector visit.
virtual iPortalCallback * | GetMissingSectorCallback (int idx) const =0
| Get the specified missing sector callback.
virtual int | GetMissingSectorCallbackCount () const =0
| Get the number of missing sector callbacks.
virtual const char * | GetName () const =0
| Get the name of this portal.
virtual const csPlane3 & | GetObjectPlane ()=0
| Get the object space plane of this portal.
virtual iPortalCallback * | GetPortalCallback (int idx) const =0
| Get the specified portal callback.
virtual int | GetPortalCallbackCount () const =0
| Get the number of portal callbacks.
virtual iSector * | GetSector () const =0
| Return the sector that this portal points too.
virtual iTextureHandle * | GetTextureFilter () const =0
| Get the filter texture.
virtual int * | GetVertexIndices () const =0
| Get an array of vertex indices (indices in the array returned by GetVertices()).
virtual int | GetVertexIndicesCount () const =0
| Get the number of vertex indices.
virtual const csVector3 * | GetVertices () const =0
| Get an array of object space vertices.
virtual size_t | GetVerticesCount () const =0
| Get number of vertices in the array returned by GetVertices().
virtual const csReversibleTransform & | GetWarp () const =0
| Get the warping transformation.
virtual const csPlane3 & | GetWorldPlane ()=0
| Get the world space plane of this portal.
virtual const csVector3 * | GetWorldVertices ()=0
| Get an array of world space vertices.
virtual void | HardTransform (const csReversibleTransform &t)=0
| Hard transform the warp matrix.
virtual iMeshWrapper * | HitBeamPortals (const csReversibleTransform &t, const csVector3 &start, const csVector3 &end, csVector3 &isect, int *polygon_idx, iSector **final_sector=0)=0
| Follow a beam through this portal and return the mesh and polygon index that it hits with (0 incase no hit).
virtual void | ObjectToWorld (const csReversibleTransform &t, csReversibleTransform &warp_wor) const =0
| Transform the warp matrix from object space to world space.
virtual bool | PointOnPolygon (const csVector3 &point)=0
| Test if a point is on the polygon represented by this portal.
virtual void | RemoveMissingSectorCallback (iPortalCallback *cb)=0
| Remove a missing sector callback.
virtual void | RemovePortalCallback (iPortalCallback *cb)=0
| Remove a portal callback.
virtual void | SetFilter (float r, float g, float b)=0
| Set a color filter (instead of the texture).
virtual void | SetFilter (iTextureHandle *ft)=0
| Set the filter texture.
virtual void | SetMaximumSectorVisit (int msv)=0
| Set the number of times that this portal will allow for watching the same portal.
virtual void | SetMirror (const csPlane3 &plane)=0
| Set warping transformation to mirror around the given plane.
virtual void | SetMissingSectorCallback (iPortalCallback *cb)=0
| Set the missing sector callback.
virtual void | SetName (const char *name)=0
| Set the name of this portal.
virtual void | SetPortalCallback (iPortalCallback *cb)=0
| Set the portal callback.
virtual void | SetSector (iSector *s)=0
| Set the sector that this portal points too.
virtual void | SetWarp (const csTransform &t)=0
| Set the warping transformation for this portal in object space and world space.
virtual void | SetWarp (const csMatrix3 &m_w, const csVector3 &v_w_before, const csVector3 &v_w_after)=0
| Set the warping transformation for this portal in object space and world space.
virtual csVector3 | Warp (const csReversibleTransform &t, const csVector3 &pos) const =0
| Warp a position in world space given a object space to world space transform (this==object, other==world).
virtual void | WarpSpace (const csReversibleTransform &warp_wor, csReversibleTransform &t, bool &mirror) const =0
| Warp space using the given world->camera transformation.

## Detailed Description

This is the interface to the Portal objects.

Polygons that are really `openings' to different areas have a portal associated with them. The portal object defines where the opening leads, how exactly the geometry behind portal is to be handled and so on.

Main creators of instances implementing this interface:

- iPortalContainer::CreatePortal()
- iEngine::CreatePortal()

Main ways to get pointers to this interface:

- iPortalContainer::GetPortal()

Main users of this interface:

- iEngine

Definition at line 157 of file portal.h.

## Member Function Documentation

virtual void iPortal::CheckFrustum | ( | iFrustumView * | lview,
|  | const csReversibleTransform & | t,
|  | int | alpha |
| ) |  |  | `[pure virtual]`

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). 't' is the transform from object to world (this2other).

virtual bool iPortal::CompleteSector | ( | iBase * | context | ) | `[pure virtual]`

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

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

virtual void iPortal::ComputeCameraPlane | ( | const csReversibleTransform & | t,
|  | csPlane3 & | camplane |
| ) |  |  | `[pure virtual]`

Calculate the camera space plane for this portal.

virtual void iPortal::GetColorFilter | ( | float & | r,
|  | float & | g,
|  | float & | b |
| ) |  |  | const`[pure virtual]`

Get the current color filter.

virtual csFlags& iPortal::GetFlags | ( |  | ) | `[pure virtual]`

Set portal flags (see CS_PORTAL_XXX values).

virtual int iPortal::GetMaximumSectorVisit | ( |  | ) | const`[pure virtual]`

Get the maximum sector visit.

virtual iPortalCallback* iPortal::GetMissingSectorCallback | ( | int | idx | ) | const`[pure virtual]`

Get the specified missing sector callback.

virtual int iPortal::GetMissingSectorCallbackCount | ( |  | ) | const`[pure virtual]`

Get the number of missing sector callbacks.

virtual const char* iPortal::GetName | ( |  | ) | const`[pure virtual]`

Get the name of this portal.

virtual const csPlane3& iPortal::GetObjectPlane | ( |  | ) | `[pure virtual]`

Get the object space plane of this portal.

virtual iPortalCallback* iPortal::GetPortalCallback | ( | int | idx | ) | const`[pure virtual]`

Get the specified portal callback.

virtual int iPortal::GetPortalCallbackCount | ( |  | ) | const`[pure virtual]`

Get the number of portal callbacks.

virtual iSector* iPortal::GetSector | ( |  | ) | const`[pure virtual]`

Return the sector that this portal points too.

virtual iTextureHandle* iPortal::GetTextureFilter | ( |  | ) | const`[pure virtual]`

Get the filter texture.

virtual int* iPortal::GetVertexIndices | ( |  | ) | const`[pure virtual]`

Get an array of vertex indices (indices in the array returned by GetVertices()).

virtual int iPortal::GetVertexIndicesCount | ( |  | ) | const`[pure virtual]`

Get the number of vertex indices.

virtual const csVector3* iPortal::GetVertices | ( |  | ) | const`[pure virtual]`

Get an array of object space vertices.

Use this in combination with GetVertexIndices() to find out where the portal is.

virtual size_t iPortal::GetVerticesCount | ( |  | ) | const`[pure virtual]`

Get number of vertices in the array returned by GetVertices().

virtual const csReversibleTransform& iPortal::GetWarp | ( |  | ) | const`[pure virtual]`

Get the warping transformation.

virtual const csPlane3& iPortal::GetWorldPlane | ( |  | ) | `[pure virtual]`

Get the world space plane of this portal.

virtual const csVector3* iPortal::GetWorldVertices | ( |  | ) | `[pure virtual]`

Get an array of world space vertices.

Use this in combination with GetVertexIndices() to find out where the portal is.

virtual void iPortal::HardTransform | ( | const csReversibleTransform & | t | ) | `[pure virtual]`

Hard transform the warp matrix.

virtual iMeshWrapper* iPortal::HitBeamPortals | ( | const csReversibleTransform & | t,
|  | const csVector3 & | start,
|  | const csVector3 & | end,
|  | csVector3 & | isect,
|  | int * | polygon_idx,
|  | iSector ** | final_sector = `0` |
| ) |  |  | `[pure virtual]`

Follow a beam through this portal and return the mesh and polygon index that it hits with (0 incase no hit).

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'. The given transform 't' is used to transform the warping matrix in the portal from object to world space (this==object, other==world).

virtual void iPortal::ObjectToWorld | ( | const csReversibleTransform & | t,
|  | csReversibleTransform & | warp_wor |
| ) |  |  | const`[pure virtual]`

Transform the warp matrix from object space to world space.

The transform 't' is object to world (this==object, other==world).

virtual bool iPortal::PointOnPolygon | ( | const csVector3 & | point | ) | `[pure virtual]`

Test if a point is on the polygon represented by this portal.

This test happens in world space.

virtual void iPortal::RemoveMissingSectorCallback | ( | iPortalCallback * | cb | ) | `[pure virtual]`

Remove a missing sector callback.

virtual void iPortal::RemovePortalCallback | ( | iPortalCallback * | cb | ) | `[pure virtual]`

Remove a portal callback.

virtual void iPortal::SetFilter | ( | float | r,
|  | float | g,
|  | float | b |
| ) |  |  | `[pure virtual]`

Set a color filter (instead of the texture).

virtual void iPortal::SetFilter | ( | iTextureHandle * | ft | ) | `[pure virtual]`

Set the filter texture.

virtual void iPortal::SetMaximumSectorVisit | ( | int | msv | ) | `[pure virtual]`

Set the number of times that this portal will allow for watching the same portal.

By default this is 5 which means that in one recursion level this portal will visit every sector at maximum 5 times.

virtual void iPortal::SetMirror | ( | const csPlane3 & | plane | ) | `[pure virtual]`

Set warping transformation to mirror around the given plane.

virtual void iPortal::SetMissingSectorCallback | ( | iPortalCallback * | cb | ) | `[pure virtual]`

Set the missing sector callback.

This will call IncRef() on the callback So make sure you call DecRef() to release your own reference. Note that as soon as one of these callbacks creates the missing sector, the loop to call these callbacks will stop.

virtual void iPortal::SetName | ( | const char * | name | ) | `[pure virtual]`

Set the name of this portal.

virtual void iPortal::SetPortalCallback | ( | iPortalCallback * | cb | ) | `[pure virtual]`

Set the portal callback.

This will call IncRef() on the callback So make sure you call DecRef() to release your own reference. Note that ALL portal callbacks have to return true before the portal is traversed.

virtual void iPortal::SetSector | ( | iSector * | s | ) | `[pure virtual]`

Set the sector that this portal points too.

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

virtual void iPortal::SetWarp | ( | const csTransform & | t | ) | `[pure virtual]`

Set the warping transformation for this portal in object space and world space.

virtual void iPortal::SetWarp | ( | const csMatrix3 & | m_w,
|  | const csVector3 & | v_w_before,
|  | const csVector3 & | v_w_after |
| ) |  |  | `[pure virtual]`

Set the warping transformation for this portal in object space and world space.

virtual csVector3 iPortal::Warp | ( | const csReversibleTransform & | t,
|  | const csVector3 & | pos |
| ) |  |  | const`[pure virtual]`

Warp a position in world space given a object space to world space transform (this==object, other==world).

virtual void iPortal::WarpSpace | ( | const csReversibleTransform & | warp_wor,
|  | csReversibleTransform & | t,
|  | bool & | mirror |
| ) |  |  | const`[pure virtual]`

Warp space using the given world->camera transformation.

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

'warp_wor' is the warp transformation in world space. '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 struct was generated from the following file:

- iengine/portal.h