Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.threed.jpct
Class Portals

    java.lang.Object
      com.threed.jpct.Portals

All Implemented Interfaces:
  java.io.Serializable

public final class Portals
extends java.lang.Object
implements java.io.Serializable

Portals handles the sectors and portals used for portal rendering. Portal rendering is a visibility algorithm (mostly) for indoor scenes. The basic idea is to connect different sectors (defined by a sector-number) with portals (n-polygons). Portal rendering can speed up rendering significantly, because it reduces overdraw by a very large amount. To get the idea better, one may have a look at some of the more detailed papers about this topic out there. Portals is always part of the World object.

See Also:
  `World.getPortals()`, Serialized Form

Field Summary
`static int` | `PORTAL_NOTDEFINITE` The portal is not definite (can be the case if more than one portal from a sector into other sectors is visible).
`static int` | `SECTOR_UNDEFINED` The sector is undefined (this is sector 0).

Method Summary
`void` | `addPortalCoord(float x, float y, float z)` Adds a new vertex to the portal.
`void` | `addPortalCoord(SimpleVector vert)` Adds a new vertex to the portal.
`void` | `completePortal()` Signals that all vertices have been added to the portal and that the attributes have been set.
`void` | `setAABoundingBox(int sector, float minx, float miny, float minz, float maxx, float maxy, float maxz)` Sets the axis-aligned bounding box for a sector.
`void` | `setPortalAttributes(int from, int to)` Sets the attributes of the portal.
`void` | `startNewPortal()` Starts a new portal definition.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PORTAL_NOTDEFINITE

    public static final int PORTAL_NOTDEFINITE

  The portal is not definite (can be the case if more than one portal from a sector into other sectors is visible). I can't recall where this information is given to the application, so consider this as an internal thing :-)

  See Also:
    Constant Field Values

### SECTOR_UNDEFINED

    public static final int SECTOR_UNDEFINED

  The sector is undefined (this is sector 0). Objects that belong to an undefined sector will be processed regardless from the sector/portal combination in the current scene.

  See Also:
    Constant Field Values

Method Detail

### startNewPortal

    public void startNewPortal()

  Starts a new portal definition. This method should be called before adding portal coordinates to a portal. The normal procedure is like this:
  Portals p=theWorld.getPortals(); p.startNewPortal();
  p.addPortalCoord(......); <- add as many coordinates as this portal has
  ... p.setPortalAttributes(from, to);
  p.completePortal();

### addPortalCoord

    public void addPortalCoord(SimpleVector vert)

  Adds a new vertex to the portal. Portals don't have to be triangles. Vertices have to be added counter-clockwise, because portals are backface culled.

  Parameters:
    `vert` - the new portal vertex

### addPortalCoord

    public void addPortalCoord(float x,
                               float y,
                               float z)

  Adds a new vertex to the portal. Portals don't have to be triangles. Vertices have to be added counter-clockwise, because portals are backface culled.

  Parameters:
    `x` - the x component of the new portal vertex
    `y` - the y component of the new portal vertex
    `z` - the z component of the new portal vertex

### setPortalAttributes

    public void setPortalAttributes(int from,
                                    int to)

  Sets the attributes of the portal. A portal always goes from one sector into another. To connect two sectors (A and B), two portals are needed (at least): One connects A with B, the other one connects B with A. Portals are backface culled.

  Parameters:
    `from` - the "from-sector"
    `to` - the "to-sector"

### completePortal

    public void completePortal()

  Signals that all vertices have been added to the portal and that the attributes have been set.

### setAABoundingBox

    public void setAABoundingBox(int sector,
                                 float minx,
                                 float miny,
                                 float minz,
                                 float maxx,
                                 float maxy,
                                 float maxz)

  Sets the axis-aligned bounding box for a sector. Normally, calling this method is not required as this information is automatically derived from the main world when calling build() for the main world's object.

  Parameters:
    `sector` - the sector's number (anything greater than zero)
    `minx` - the minimum x-value of the bounding box
    `miny` - the minimum y-value of the bounding box
    `minz` - the minimum z-value of the bounding box
    `maxx` - the maximum x-value of the bounding box
    `maxy` - the maximum y-value of the bounding box
    `maxz` - the maximum z-value of the bounding box
  See Also:
    `Object3D.build()`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD