crystalspace.jbind.impl.engine.portal
Class csPortal

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.engine.portal.csPortal
All Implemented Interfaces:
iBase, iPointer, iPortal

public class csPortal
extends csBase
implements iPortal

Author:
Quentin Anciaux

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csPortal(iPointer nPointer)
           
 
Method Summary
 void checkFrustum(iFrustumView lview, csReversibleTransform t, int alpha)
          Check frustum visibility of all polygons reachable through this portal.
 boolean completeSector(iBase context)
          Check if the destination sector is 0 and if so call the callback.
 void computeCameraPlane(csReversibleTransform t, csPlane3 camplane)
          Calculate the camera space plane for this portal.
 float[] getColorFilter()
          Get the current color filter.
 csFlags getFlags()
          Set portal flags (see CS_PORTAL_XXX values).
 int getMaximumSectorVisit()
          Get the maximum sector visit.
 iPortalCallback getMissingSectorCallback(int idx)
          Get the specified missing sector callback.
 int getMissingSectorCallbackCount()
          Get the number of missing sector callbacks.Implemented in csPortal.
 java.lang.String getName()
          Get the name of this portal.Implemented in csPortal.
 csPlane3 getObjectPlane()
          Get the object space plane of this portal.Implemented in csPortal.
 iPortalCallback getPortalCallback(int idx)
          Get the specified portal callback.Implemented in csPortal.
 int getPortalCallbackCount()
          Get the number of portal callbacks.Implemented in csPortal.
 iSector getSector()
          Return the sector that this portal points too.Implemented in csPortal.
 iTextureHandle getTextureFilter()
          Get the filter texture.Implemented in csPortal.
 int getVersion()
          Return the version of the interface
 int[] getVertexIndices()
          Get an array of vertex indices (indices in the array returned by GetVertices()).
 int getVertexIndicesCount()
          Get the number of vertex indices.Implemented in csPortal.
 csVector3[] getVertices()
          Get an array of object space vertices.
 csReversibleTransform getWarp()
          Get the warping transformation.Implemented in csPortal.
 csPlane3 getWorldPlane()
          Get the world space plane of this portal.
 csPlane3 getWorldPlane(iMovable movable)
          Get the world space plane of this portal.
 void hardTransform(csReversibleTransform t)
          Hard transform the warp matrix.Implemented in csPortal.
 iMeshWrapper hitBeamPortals(csReversibleTransform t, csVector3 start, csVector3 end, csVector3 isect, int[] polygon_idx)
          Follow a beam through this portal and return the mesh and polygon index that it hits with (0 incase no hit).
protected  boolean isNativePointerValidSafe(long pointer)
           
 void objectToWorld(csReversibleTransform t, csReversibleTransform warp_wor)
          Transform the warp matrix from object space to world space.
 boolean pointOnPolygon(csVector3 point)
          Test if a point is on the polygon represented by this portal.
 boolean pointOnPolygon(csVector3 point, iMovable movable)
          Test if a point is on the polygon represented by this portal.
 iObject queryObject()
          Get the iObject for this portal. @ OBSOLETE!!!
 void removeMissingSectorCallback(iPortalCallback cb)
          Remove a missing sector callback.Implemented in csPortal.
 void removePortalCallback(iPortalCallback cb)
          Remove a portal callback.Implemented in csPortal.
 void setFilter(float r, float g, float b)
          Set a color filter (instead of the texture).Implemented in csPortal.
 void setFilter(iTextureHandle ft)
          Set the filter texture.Implemented in csPortal.
 void setMaximumSectorVisit(int msv)
          Set the number of times that this portal will allow for watching the same portal.
 void setMirror(csPlane3 plane)
          Set warping transformation to mirror around the given plane.
 void setMissingSectorCallback(iPortalCallback cb)
          Set the missing sector callback.
 void setName(java.lang.String name)
          Set the name of this portal.Implemented in csPortal.
 void setPortalCallback(iPortalCallback cb)
          Set the portal callback.
 void setSector(iSector s)
          Set the sector that this portal points too.
 void setWarp(csMatrix3 m_w, csVector3 v_w_before, csVector3 v_w_after)
          Set the warping transformation for this portal in object space and world space.
 void setWarp(csTransform t)
          Set the warping transformation for this portal in object space and world space.
 csVector3 warp(csReversibleTransform t, csVector3 pos)
          Warp a position in world space given a object space to world space transform (this==object, other==world).
 void warpSpace(csReversibleTransform warp_wor, csReversibleTransform t, boolean mirror)
          Warp space using the given world->camera transformation.
 
Methods inherited from class crystalspace.jbind.impl.csutil.scf.csBase
decRef, equals, finalize, getRefCount, incRef, nDelete, queryInterface, queryInterfaceSafe
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getRefCount, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Constructor Detail

csPortal

public csPortal(iPointer nPointer)
Parameters:
nPointer -
Method Detail

getVersion

public int getVersion()
Description copied from interface: iBase
Return the version of the interface

Specified by:
getVersion in interface iBase
Specified by:
getVersion in class csBase
See Also:
iBase.getVersion()

getName

public java.lang.String getName()
Description copied from interface: iPortal
Get the name of this portal.Implemented in csPortal.

Specified by:
getName in interface iPortal
Specified by:
getName in class csBase
See Also:
iBase.getName()

isNativePointerValidSafe

protected boolean isNativePointerValidSafe(long pointer)
Specified by:
isNativePointerValidSafe in class csNativeObject
See Also:
csNativeObject.isNativePointerValidSafe(long)

checkFrustum

public void checkFrustum(iFrustumView lview,
                         csReversibleTransform t,
                         int alpha)
Description copied from interface: iPortal
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). Implemented in csPortal.

Specified by:
checkFrustum in interface iPortal
Parameters:
lview -
t -
alpha -
See Also:
iPortal.checkFrustum(crystalspace.jbind.interfaces.iengine.fview.iFrustumView, crystalspace.jbind.impl.csgeom.transfrm.csReversibleTransform, int)

completeSector

public boolean completeSector(iBase context)
Description copied from interface: iPortal
Check if the destination sector is 0 and if so call the callback. This function returns false if the portal should not be traversed. Implemented in csPortal.

Specified by:
completeSector in interface iPortal
Parameters:
context -
Returns:
See Also:
iPortal.completeSector(crystalspace.jbind.interfaces.iutil.scf.iBase)

computeCameraPlane

public void computeCameraPlane(csReversibleTransform t,
                               csPlane3 camplane)
Description copied from interface: iPortal
Calculate the camera space plane for this portal. Implemented in csPortal.

Specified by:
computeCameraPlane in interface iPortal
Parameters:
t -
camplane -
See Also:
iPortal.computeCameraPlane(crystalspace.jbind.impl.csgeom.transfrm.csReversibleTransform, crystalspace.jbind.impl.csgeom.plane3.csPlane3)

getColorFilter

public float[] getColorFilter()
Description copied from interface: iPortal
Get the current color filter. Implemented in csPortal.

Specified by:
getColorFilter in interface iPortal
Returns:
See Also:
iPortal.getColorFilter()

getFlags

public csFlags getFlags()
Description copied from interface: iPortal
Set portal flags (see CS_PORTAL_XXX values). Implemented in csPortal.

Specified by:
getFlags in interface iPortal
Returns:
See Also:
iPortal.getFlags()

getMaximumSectorVisit

public int getMaximumSectorVisit()
Description copied from interface: iPortal
Get the maximum sector visit. Implemented in csPortal.

Specified by:
getMaximumSectorVisit in interface iPortal
Returns:
See Also:
iPortal.getMaximumSectorVisit()

getMissingSectorCallback

public iPortalCallback getMissingSectorCallback(int idx)
Description copied from interface: iPortal
Get the specified missing sector callback. Implemented in csPortal.

Specified by:
getMissingSectorCallback in interface iPortal
Parameters:
idx -
Returns:
See Also:
iPortal.getMissingSectorCallback(int)

getMissingSectorCallbackCount

public int getMissingSectorCallbackCount()
Description copied from interface: iPortal
Get the number of missing sector callbacks.Implemented in csPortal.

Specified by:
getMissingSectorCallbackCount in interface iPortal
Returns:
See Also:
iPortal.getMissingSectorCallbackCount()

getObjectPlane

public csPlane3 getObjectPlane()
Description copied from interface: iPortal
Get the object space plane of this portal.Implemented in csPortal.

Specified by:
getObjectPlane in interface iPortal
Returns:
See Also:
iPortal.getObjectPlane()

getPortalCallback

public iPortalCallback getPortalCallback(int idx)
Description copied from interface: iPortal
Get the specified portal callback.Implemented in csPortal.

Specified by:
getPortalCallback in interface iPortal
Parameters:
idx -
Returns:
See Also:
iPortal.getPortalCallback(int)

getPortalCallbackCount

public int getPortalCallbackCount()
Description copied from interface: iPortal
Get the number of portal callbacks.Implemented in csPortal.

Specified by:
getPortalCallbackCount in interface iPortal
Returns:
See Also:
iPortal.getPortalCallbackCount()

getSector

public iSector getSector()
Description copied from interface: iPortal
Return the sector that this portal points too.Implemented in csPortal.

Specified by:
getSector in interface iPortal
Returns:
See Also:
iPortal.getSector()

getTextureFilter

public iTextureHandle getTextureFilter()
Description copied from interface: iPortal
Get the filter texture.Implemented in csPortal.

Specified by:
getTextureFilter in interface iPortal
Returns:
See Also:
iPortal.getTextureFilter()

getVertexIndices

public int[] getVertexIndices()
Description copied from interface: iPortal
Get an array of vertex indices (indices in the array returned by GetVertices()). Implemented in csPortal.

Specified by:
getVertexIndices in interface iPortal
Returns:
See Also:
iPortal.getVertexIndices()

getVertexIndicesCount

public int getVertexIndicesCount()
Description copied from interface: iPortal
Get the number of vertex indices.Implemented in csPortal.

Specified by:
getVertexIndicesCount in interface iPortal
Returns:
See Also:
iPortal.getVertexIndicesCount()

getVertices

public csVector3[] getVertices()
Description copied from interface: iPortal
Get an array of object space vertices. Use this in combination with GetVertexIndices() to find out where the portal is.Implemented in csPortal.

Specified by:
getVertices in interface iPortal
Returns:
See Also:
iPortal.getVertices()

getWarp

public csReversibleTransform getWarp()
Description copied from interface: iPortal
Get the warping transformation.Implemented in csPortal.

Specified by:
getWarp in interface iPortal
Returns:
See Also:
iPortal.getWarp()

getWorldPlane

public csPlane3 getWorldPlane()
Description copied from interface: iPortal
Get the world space plane of this portal. Note! This function assumes the mesh containing this portal has previously been transformed to world space! The optional movable parameter can be used to recalculate the world plane if that is needed. If the movable parameter is not given then the last calculated world plane is used.Implemented in csPortal.

Specified by:
getWorldPlane in interface iPortal
Returns:
See Also:
iPortal.getWorldPlane()

getWorldPlane

public csPlane3 getWorldPlane(iMovable movable)
Description copied from interface: iPortal
Get the world space plane of this portal. Note! This function assumes the mesh containing this portal has previously been transformed to world space! The optional movable parameter can be used to recalculate the world plane if that is needed. If the movable parameter is not given then the last calculated world plane is used.Implemented in csPortal.

Specified by:
getWorldPlane in interface iPortal
Parameters:
movable -
Returns:
See Also:
iPortal.getWorldPlane(crystalspace.jbind.interfaces.iengine.movable.iMovable)

hardTransform

public void hardTransform(csReversibleTransform t)
Description copied from interface: iPortal
Hard transform the warp matrix.Implemented in csPortal.

Specified by:
hardTransform in interface iPortal
Parameters:
t -
See Also:
iPortal.hardTransform(crystalspace.jbind.impl.csgeom.transfrm.csReversibleTransform)

hitBeamPortals

public iMeshWrapper hitBeamPortals(csReversibleTransform t,
                                   csVector3 start,
                                   csVector3 end,
                                   csVector3 isect,
                                   int[] polygon_idx)
Description copied from interface: iPortal
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). Implemented in csPortal.

Specified by:
hitBeamPortals in interface iPortal
Parameters:
t -
start -
end -
isect -
polygon_idx -
Returns:
See Also:
iPortal.hitBeamPortals(crystalspace.jbind.impl.csgeom.transfrm.csReversibleTransform, crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3, int[])

objectToWorld

public void objectToWorld(csReversibleTransform t,
                          csReversibleTransform warp_wor)
Description copied from interface: iPortal
Transform the warp matrix from object space to world space. The transform 't' is object to world (this==object, other==world). Implemented in csPortal.

Specified by:
objectToWorld in interface iPortal
Parameters:
t -
warp_wor -
See Also:
iPortal.objectToWorld(crystalspace.jbind.impl.csgeom.transfrm.csReversibleTransform, crystalspace.jbind.impl.csgeom.transfrm.csReversibleTransform)

pointOnPolygon

public boolean pointOnPolygon(csVector3 point)
Description copied from interface: iPortal
Test if a point is on the polygon represented by this portal. This test happens in world space. The optional movable is used to update the world space vertices if needed. Otherwise the last calculated vertices are used.Implemented in csPortal.

Specified by:
pointOnPolygon in interface iPortal
Parameters:
point -
Returns:
See Also:
iPortal.pointOnPolygon(crystalspace.jbind.impl.csgeom.vector3.csVector3)

pointOnPolygon

public boolean pointOnPolygon(csVector3 point,
                              iMovable movable)
Description copied from interface: iPortal
Test if a point is on the polygon represented by this portal. This test happens in world space. The optional movable is used to update the world space vertices if needed. Otherwise the last calculated vertices are used.Implemented in csPortal.

Specified by:
pointOnPolygon in interface iPortal
Parameters:
point -
movable -
Returns:
See Also:
iPortal.pointOnPolygon(crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.interfaces.iengine.movable.iMovable)

queryObject

public iObject queryObject()
Description copied from interface: iPortal
Get the iObject for this portal. @ OBSOLETE!!! Implemented in csPortal.

Specified by:
queryObject in interface iPortal
Returns:
See Also:
iPortal.queryObject()

removeMissingSectorCallback

public void removeMissingSectorCallback(iPortalCallback cb)
Description copied from interface: iPortal
Remove a missing sector callback.Implemented in csPortal.

Specified by:
removeMissingSectorCallback in interface iPortal
Parameters:
cb -
See Also:
iPortal.removeMissingSectorCallback(crystalspace.jbind.interfaces.iengine.portal.iPortalCallback)

removePortalCallback

public void removePortalCallback(iPortalCallback cb)
Description copied from interface: iPortal
Remove a portal callback.Implemented in csPortal.

Specified by:
removePortalCallback in interface iPortal
Parameters:
cb -
See Also:
iPortal.removePortalCallback(crystalspace.jbind.interfaces.iengine.portal.iPortalCallback)

setFilter

public void setFilter(float r,
                      float g,
                      float b)
Description copied from interface: iPortal
Set a color filter (instead of the texture).Implemented in csPortal.

Specified by:
setFilter in interface iPortal
Parameters:
r -
g -
b -
See Also:
iPortal.setFilter(float, float, float)

setFilter

public void setFilter(iTextureHandle ft)
Description copied from interface: iPortal
Set the filter texture.Implemented in csPortal.

Specified by:
setFilter in interface iPortal
Parameters:
ft -
See Also:
iPortal.setFilter(crystalspace.jbind.interfaces.ivideo.texture.iTextureHandle)

setMaximumSectorVisit

public void setMaximumSectorVisit(int msv)
Description copied from interface: iPortal
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. Implemented in csPortal.

Specified by:
setMaximumSectorVisit in interface iPortal
Parameters:
msv -
See Also:
iPortal.setMaximumSectorVisit(int)

setMirror

public void setMirror(csPlane3 plane)
Description copied from interface: iPortal
Set warping transformation to mirror around the given plane. Implemented in csPortal.

Specified by:
setMirror in interface iPortal
Parameters:
plane -
See Also:
iPortal.setMirror(crystalspace.jbind.impl.csgeom.plane3.csPlane3)

setMissingSectorCallback

public void setMissingSectorCallback(iPortalCallback cb)
Description copied from interface: iPortal
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. Implemented in csPortal.

Specified by:
setMissingSectorCallback in interface iPortal
Parameters:
cb -
See Also:
iPortal.setMissingSectorCallback(crystalspace.jbind.interfaces.iengine.portal.iPortalCallback)

setName

public void setName(java.lang.String name)
Description copied from interface: iPortal
Set the name of this portal.Implemented in csPortal.

Specified by:
setName in interface iPortal
Parameters:
name -
See Also:
iPortal.setName(java.lang.String)

setPortalCallback

public void setPortalCallback(iPortalCallback cb)
Description copied from interface: iPortal
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. Implemented in csPortal.

Specified by:
setPortalCallback in interface iPortal
Parameters:
cb -
See Also:
iPortal.setPortalCallback(crystalspace.jbind.interfaces.iengine.portal.iPortalCallback)

setSector

public void setSector(iSector s)
Description copied from interface: iPortal
Set the sector that this portal points too. To avoid circular references, the sector is not IncRef'ed! Implemented in csPortal.

Specified by:
setSector in interface iPortal
Parameters:
s -
See Also:
iPortal.setSector(crystalspace.jbind.interfaces.iengine.sector.iSector)

setWarp

public void setWarp(csTransform t)
Description copied from interface: iPortal
Set the warping transformation for this portal in object space and world space. Implemented in csPortal.

Specified by:
setWarp in interface iPortal
Parameters:
t -
See Also:
iPortal.setWarp(crystalspace.jbind.impl.csgeom.transfrm.csTransform)

setWarp

public void setWarp(csMatrix3 m_w,
                    csVector3 v_w_before,
                    csVector3 v_w_after)
Description copied from interface: iPortal
Set the warping transformation for this portal in object space and world space. Implemented in csPortal.

Specified by:
setWarp in interface iPortal
Parameters:
m_w -
v_w_before -
v_w_after -
See Also:
iPortal.setWarp(crystalspace.jbind.impl.csgeom.matrix3.csMatrix3, crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3)

warp

public csVector3 warp(csReversibleTransform t,
                      csVector3 pos)
Description copied from interface: iPortal
Warp a position in world space given a object space to world space transform (this==object, other==world). Implemented in csPortal.

Specified by:
warp in interface iPortal
Parameters:
t -
pos -
Returns:
See Also:
iPortal.warp(crystalspace.jbind.impl.csgeom.transfrm.csReversibleTransform, crystalspace.jbind.impl.csgeom.vector3.csVector3)

warpSpace

public void warpSpace(csReversibleTransform warp_wor,
                      csReversibleTransform t,
                      boolean mirror)
Description copied from interface: iPortal
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. Implemented in csPortal.

Specified by:
warpSpace in interface iPortal
Parameters:
warp_wor -
t -
mirror -
See Also:
iPortal.warpSpace(crystalspace.jbind.impl.csgeom.transfrm.csReversibleTransform, crystalspace.jbind.impl.csgeom.transfrm.csReversibleTransform, boolean)