crystalspace.jbind.interfaces.iengine.sector
Interface iSector

All Superinterfaces:
iBase, iPointer
All Known Implementing Classes:
csSector

public interface iSector
extends iBase

The iSector interface is used to work with "sectors". A "sector" is an empty region of space that can contain other objects (mesh objects). A sector itself does not represent geometry but only contains other geometry. A sector does contain lights though. The sector is the basic building block for any Crystal Space level. A level can be made from one or more sectors. Using the thing mesh object one can use portals to connect multiple sectors.

Author:
Java wrapper - Quentin Anciaux, c++ version - http://crystal.sourceforge.net/docs/online/pubapi/structiSector.php To change the template for this generated type comment go to Window>Preferences>Java>Code Generation>Code and Comments

Method Summary
 void calculateSectorBBox(csBox3 bbox, boolean do_meshes)
          Calculate the bounding box of all objects in this sector.
 void checkFrustum(iFrustumView lview)
          Used for portal traversal.
 void decRecLevel()
          Remove one draw recursion level.
 void disableFog()
          Disable fog in this sector.
 void draw(iRenderView rview)
          Draw the sector with the given render view.
 iSector followSegment(csReversibleTransform t, csVector3 new_position, boolean mirror)
          Follow a segment starting at this sector.
 iSector followSegment(csReversibleTransform t, csVector3 new_position, boolean mirror, boolean only_portals)
          Follow a segment starting at this sector.
 csColor getDynamicAmbientLight()
          Get the last set dynamic ambient light for this sector.
 csFog getFog()
          Return the fog structure (even if fog is disabled);.
 iLightList getLights()
          Get the list of static and pseudo-dynamic lights in this sector.
 iMeshList getMeshes()
          Get the list of meshes in this sector.
 csSet_iMeshWrapper getPortalMeshes()
          Get the set of meshes containing portals that leave from this sector.
 int getRecLevel()
          Get the current draw recursion level.
 iSectorCallback getSectorCallback(int idx)
          Get the specified sector callback.
 int getSectorCallbackCount()
          Get the number of sector callbacks.
 iVisibilityCuller getVisibilityCuller()
          Get the visibility culler that is used for this sector.
 csRenderMeshList getVisibleMeshes(iRenderView rview)
          Get a set of visible meshes for given camera.
 boolean hasFog()
          Has this sector fog?
 iMeshWrapper hitBeam(csVector3 start, csVector3 end, csVector3 intersect, int polygon_idx)
          Follow a beam from start to end and return the first object that is hit.
 iMeshWrapper hitBeam(csVector3 start, csVector3 end, csVector3 intersect, int polygon_idx, boolean accurate)
          Follow a beam from start to end and return the first object that is hit.
 iMeshWrapper hitBeamPortals(csVector3 start, csVector3 end, csVector3 isect, int polygon_idx)
          Follow a beam from start to end and return the first polygon that is hit.
 void incRecLevel()
          Add one draw recursion level.
 void prepareDraw(iRenderView rview)
          Prepare the sector to draw.
 iObject queryObject()
          Get the iObject for this sector.
 void registerPortalMesh(iMeshWrapper mesh)
          Deprecated. *to be removed*
 void removeSectorCallback(iSectorCallback cb)
          Remove a sector callback.
 void setDynamicAmbientLight(csColor color)
          Sets dynamic ambient light for all things in the sector.
 void setFog(float density, csColor color)
          Fill the fog structure with the given values.
 void setSectorCallback(iSectorCallback cb)
          Set the sector callback.
 boolean setVisibilityCullerPlugin(java.lang.String Name)
          Use the specified plugin as the visibility culler for this sector.
 void shineLights()
          Calculate lighting for all objects in this sector.
 void shineLights(iMeshWrapper mesh)
          Version of ShineLights(); which only affects one mesh object.
 void unregisterPortalMesh(iMeshWrapper mesh)
          Deprecated. *to be removed*
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getName, getRefCount, getVersion, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Method Detail

calculateSectorBBox

public void calculateSectorBBox(csBox3 bbox,
                                boolean do_meshes)
Calculate the bounding box of all objects in this sector. This function is not very efficient as it will traverse all objects in the sector one by one and compute a bounding box from that.

Parameters:
bbox -
do_meshes -

checkFrustum

public void checkFrustum(iFrustumView lview)
Used for portal traversal.

Parameters:
lview -

decRecLevel

public void decRecLevel()
Remove one draw recursion level.


disableFog

public void disableFog()
Disable fog in this sector.


draw

public void draw(iRenderView rview)
Draw the sector with the given render view.

Parameters:
rview -

followSegment

public iSector followSegment(csReversibleTransform t,
                             csVector3 new_position,
                             boolean mirror)
Follow a segment starting at this sector. If the segment intersects with a polygon it will stop there unless the polygon is a portal in which case it will recursively go to that sector (possibly applying warping transformations); and continue there. This routine will modify all the given parameters to reflect space warping. These should be used as the new camera transformation when you decide to really go to the new position. This function returns the resulting sector and new_position will be set to the last position that you can go to before hitting a wall. If only_portals is true then only portals will be checked. This means that intersection with normal polygons is not checked. This is a lot faster but it does mean that you need to use another collision detection system to test with walls.

Parameters:
t -
new_position -
mirror -
Returns:

followSegment

public iSector followSegment(csReversibleTransform t,
                             csVector3 new_position,
                             boolean mirror,
                             boolean only_portals)
Follow a segment starting at this sector. If the segment intersects with a polygon it will stop there unless the polygon is a portal in which case it will recursively go to that sector (possibly applying warping transformations); and continue there. This routine will modify all the given parameters to reflect space warping. These should be used as the new camera transformation when you decide to really go to the new position. This function returns the resulting sector and new_position will be set to the last position that you can go to before hitting a wall. If only_portals is true then only portals will be checked. This means that intersection with normal polygons is not checked. This is a lot faster but it does mean that you need to use another collision detection system to test with walls.

Parameters:
t -
new_position -
mirror -
only_portals -
Returns:

getDynamicAmbientLight

public csColor getDynamicAmbientLight()
Get the last set dynamic ambient light for this sector.

Returns:

getFog

public csFog getFog()
Return the fog structure (even if fog is disabled);.

Returns:

getLights

public iLightList getLights()
Get the list of static and pseudo-dynamic lights in this sector. Do NOT add dynamic lights to this list. For a dynamic light you only have to call SetSector(); on those dynamic lights.

Returns:

getMeshes

public iMeshList getMeshes()
Get the list of meshes in this sector.

Returns:

getPortalMeshes

public csSet_iMeshWrapper getPortalMeshes()
Get the set of meshes containing portals that leave from this sector. Note that portals are uni-directional. The portals represented by this list are portals that are on some mesh object that is actually located in this sector.

Returns:

getRecLevel

public int getRecLevel()
Get the current draw recursion level.

Returns:

getSectorCallback

public iSectorCallback getSectorCallback(int idx)
Get the specified sector callback.

Parameters:
idx -
Returns:

getSectorCallbackCount

public int getSectorCallbackCount()
Get the number of sector callbacks.

Returns:

getVisibilityCuller

public iVisibilityCuller getVisibilityCuller()
Get the visibility culler that is used for this sector. If there is no culler yet a culler of type 'crystalspace.culling.frustvis' will be created and used for this sector.

Returns:

getVisibleMeshes

public csRenderMeshList getVisibleMeshes(iRenderView rview)
Get a set of visible meshes for given camera. These will be cached for a given frame and camera, but if the cached result isn't enough it will be reculled. The returned pointer is valid as long as the sector exsist (the sector will delete it);

Parameters:
rview -
Returns:

hasFog

public boolean hasFog()
Has this sector fog?

Returns:

hitBeam

public iMeshWrapper hitBeam(csVector3 start,
                            csVector3 end,
                            csVector3 intersect,
                            int polygon_idx)
Follow a beam from start to end and return the first object that is hit. In case it is a thing the polygon_idx field will be filled with the indices of the polygon that was hit. If polygon_idx is null then the polygon will not be filled in. This function doesn't support portals.

Parameters:
start -
end -
intersect -
polygon_idx -
Returns:

hitBeam

public iMeshWrapper hitBeam(csVector3 start,
                            csVector3 end,
                            csVector3 intersect,
                            int polygon_idx,
                            boolean accurate)
Follow a beam from start to end and return the first object that is hit. In case it is a thing the polygon_idx field will be filled with the indices of the polygon that was hit. If polygon_idx is null then the polygon will not be filled in. This function doesn't support portals.

Parameters:
start -
end -
intersect -
polygon_idx -
accurate -
Returns:

hitBeamPortals

public iMeshWrapper hitBeamPortals(csVector3 start,
                                   csVector3 end,
                                   csVector3 isect,
                                   int polygon_idx)
Follow a beam from start to end and return the first polygon that is hit. This function correctly traverse portals and space warping portals. Normally the sector you call this on should be the sector containing the 'start' point. 'isect' will be the intersection point if a polygon is returned. This function returns -1 if no polygon was hit or the polygon index otherwise.

Parameters:
start -
end -
isect -
polygon_idx -
Returns:

incRecLevel

public void incRecLevel()
Add one draw recursion level.


prepareDraw

public void prepareDraw(iRenderView rview)
Prepare the sector to draw. Must be called before any rendermesh is requested.

Parameters:
rview -

queryObject

public iObject queryObject()
Get the iObject for this sector.

Returns:

registerPortalMesh

public void registerPortalMesh(iMeshWrapper mesh)
Deprecated. *to be removed*

Register a mesh with a portal.

Parameters:
mesh -

removeSectorCallback

public void removeSectorCallback(iSectorCallback cb)
Remove a sector callback.

Parameters:
cb -

setDynamicAmbientLight

public void setDynamicAmbientLight(csColor color)
Sets dynamic ambient light for all things in the sector.

Parameters:
color -

setFog

public void setFog(float density,
                   csColor color)
Fill the fog structure with the given values.

Parameters:
density -
color -

setSectorCallback

public void setSectorCallback(iSectorCallback cb)
Set the sector callback. This will call IncRef(); on the callback So make sure you call DecRef(); to release your own reference.

Parameters:
cb -

setVisibilityCullerPlugin

public boolean setVisibilityCullerPlugin(java.lang.String Name)
Use the specified plugin as the visibility culler for this sector. Returns false if the culler could not be loaded for some reason.

Parameters:
Name -
Returns:

shineLights

public void shineLights(iMeshWrapper mesh)
Version of ShineLights(); which only affects one mesh object.

Parameters:
mesh -

shineLights

public void shineLights()
Calculate lighting for all objects in this sector.


unregisterPortalMesh

public void unregisterPortalMesh(iMeshWrapper mesh)
Deprecated. *to be removed*

Unregister a mesh with a portal.

Parameters:
mesh -