Portal

Engine/source/T3D/portal.h

A transitioning zone that connects other zones.

More...

Derived Portal Data

Update derived data, if necessary.

Update the world space portal geometry.

Detect whether this is an exterior, interior, or invalid portal.

Classification of this portal as interior or exterior portal.

For exterior portals, this is the side of the portal on which the connected interior zones lie.

bool

Whether the portal plane and polygon need to be updated.

Portal polygon in world space.

The plane defined by the portal's rectangle.

Public Types

enum
Classification {
  InvalidPortal 
  InteriorPortal 
  ExteriorPortal 
}

Identifies the type of portal.

enum
Side {
  FrontSide 
  BackSide 
}

Identifies the subspaces defined by the portal plane.

Parent 

Protected Types

enum
_Anonymous_ {
  PassableMask = Parent::NextFreeMask << 0
  NextFreeMask = Parent::NextFreeMask << 1
}

Protected Attributes

bool

Flags that allow preventing traversal through specific sides of the portal.

Protected Functions

Disconnect all zone spaces currently connected to this space.

bool

Compute a clipped culling volume from the portal geometry and current traversal state.

Render a visualization of the volume.

Hand the traversal over to connected zone spaces.

Called when this is removed from its current SceneManager.

Public Functions

Connect this zone space to the given zone space.

Return a textual description of the object.

If the object is a zone space, then this method is called to instruct the object to remove any zone connectivity to zoneSpace.

Return what kind of portal this is (interior or exterior).

For exterior portals, get the side on which the interior zones of the portal lie.

Return the plane that is defined by the portal's rectangle.

Return the side that the given point is in relative to the portal plane.

bool

Return true if the portal leads to the outdoor zone.

bool

Return true if the portal connects interior zones only.

bool

Test whether the given side of the portal is open for traversal.

packUpdate(NetConnection * conn, U32 mask, BitStream * stream)

Instructs this object to pack its state for transfer over the network.

setSidePassable(Side side, bool value)

Set whether the given portal side is passable.

Sets the Object -> World transform.

traverseZones(SceneTraversalState * state, U32 startZoneId)

Traverse the zones in this space starting with the given zone.

Instructs this object to read state data previously packed with packUpdate.

bool
writeField(StringTableEntry fieldname, const char * value)

Determine whether or not a field should be written.

Public Static Functions

Private Static Functions

bool
_setBackSidePassable(void * object, const char * index, const char * data)
bool
_setFrontSidePassable(void * object, const char * index, const char * data)

Detailed Description

A transitioning zone that connects other zones.

Basically a portal is two things:

1) A zone that overlaps multiple other zones and thus connects them. 2) A polygon standing upright in the middle of the portal zone's world box.

When traversing from zone to zone, portals serve as both zones in their own right (i.e. objects may be located in a portal zone) as well as a peek hole that determines what area of a target zone is visible through a portal.

Torque's portals are special in that they are two-way by default. This greatly simplifies zone setups but it also complicates handling in the engine somewhat. Also, these portals here are nothing but peek holes–they do not define transform portals that could be looking at a different location in space altogether.

Portals can be marked explicitly as being one-sided by flagging either of the portal's sides as impassable. This flagging can also be used dynamically to, for example, block a portal while a door is still down and then unblock the portal when the door is opened.

Portals are classified as either interior or exterior portals. An exterior portal is a portal that has only non-SceneRootZone zones on side of the portal plane and only the SceneRootZone on the other side of it. An interior portal is a portal that has only non-SceneRootZone zones on both sides of the portal plane. A mixture of the two is not allowed – when adding SceneRootZone to a portal, it must exist alone on its portal side.

Derived Portal Data

_update()

Update derived data, if necessary.

_updateGeometry()

Update the world space portal geometry.

_updateConnectivity()

Detect whether this is an exterior, interior, or invalid portal.

Classification mClassification 

Classification of this portal as interior or exterior portal.

Side mInteriorSide 

For exterior portals, this is the side of the portal on which the connected interior zones lie.

bool mIsGeometryDirty 

Whether the portal plane and polygon need to be updated.

Vector< Point3F > mPortalPolygonWS 

Portal polygon in world space.

PlaneF mPortalPlane 

The plane defined by the portal's rectangle.

Public Types

Classification

Enumerator

InvalidPortal

Portal does not connect anything.

InteriorPortal

Portal between interior zones.

ExteriorPortal

Portal between interior zones on one and side and SceneRootZone on the other.

Identifies the type of portal.

Side

Enumerator

FrontSide

Subspace on front side of portal plane.

BackSide

Subspace on back side of portal plane.

Identifies the subspaces defined by the portal plane.

typedef Zone Parent 

Protected Types

@198

Enumerator

PassableMask = Parent::NextFreeMask << 0

mPassableSides has changed.

NextFreeMask = Parent::NextFreeMask << 1

Protected Attributes

bool mPassableSides [2]

Flags that allow preventing traversal through specific sides of the portal.

By default, both sides are passable.

Protected Functions

_disconnectAllZoneSpaces()

Reimplemented from: SceneZoneSpace

_generateCullingVolume(SceneTraversalState * state, SceneCullingVolume & outVolume)

Compute a clipped culling volume from the portal geometry and current traversal state.

If successful, store the resulting culling volume in outVolume and return true.

_getDefaultEditorSolidColor()

Reimplemented from: Zone

_getDefaultEditorWireframeColor()

Reimplemented from: SceneSpace

_renderObject(ObjectRenderInst * ri, SceneRenderState * state, BaseMatInstance * overrideMat)

Reimplemented from: ScenePolyhedralObject

_traverseConnectedZoneSpaces(SceneTraversalState * state)

Reimplemented from: SceneZoneSpace

onSceneRemove()

Reimplemented from: SceneZoneSpace

Public Functions

Portal()

connectZoneSpace(SceneZoneSpace * zoneSpace)

Reimplemented from: SceneZoneSpace

DECLARE_CONOBJECT(Portal )

describeSelf()

Reimplemented from: SceneSimpleZone

disconnectZoneSpace(SceneZoneSpace * zoneSpace)

Reimplemented from: SceneZoneSpace

getClassification()

Return what kind of portal this is (interior or exterior).

getInteriorSideOfExteriorPortal()

For exterior portals, get the side on which the interior zones of the portal lie.

getPortalPlane()

Return the plane that is defined by the portal's rectangle.

getSideRelativeToPortalPlane(const Point3F & point)

Return the side that the given point is in relative to the portal plane.

isExteriorPortal()

Return true if the portal leads to the outdoor zone.

isInteriorPortal()

Return true if the portal connects interior zones only.

isSidePassable(Side side)

Test whether the given side of the portal is open for traversal.

packUpdate(NetConnection * conn, U32 mask, BitStream * stream)

Reimplemented from: SceneAmbientSoundObject

setSidePassable(Side side, bool value)

Set whether the given portal side is passable.

setTransform(const MatrixF & mat)

Reimplemented from: ScenePolyhedralZone

traverseZones(SceneTraversalState * state, U32 startZoneId)

Reimplemented from: SceneSimpleZone

unpackUpdate(NetConnection * conn, BitStream * stream)

Reimplemented from: SceneAmbientSoundObject

writeField(StringTableEntry fieldname, const char * value)

Reimplemented from: ScenePolyhedralObject

Public Static Functions

consoleInit()

initPersistFields()

Private Static Functions

_setBackSidePassable(void * object, const char * index, const char * data)

_setFrontSidePassable(void * object, const char * index, const char * data)