crystalspace.jbind.impl.engine.viscul
Class csVisibilityCuller

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.engine.viscul.csVisibilityCuller
All Implemented Interfaces:
iBase, iPointer, iVisibilityCuller

public class csVisibilityCuller
extends csBase
implements iVisibilityCuller

Author:
Quentin Anciaux

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csVisibilityCuller(iPointer nPointer)
           
 
Method Summary
 void castShadows(iFrustumView fview)
          Start casting shadows from a given point in space.
 java.lang.String getName()
          Return the name of the interface
 int getVersion()
          Return the version of the interface
 iVisibilityObjectIterator intersectSegment(csVector3 start, csVector3 end)
          Intersect a segment with all objects in the visibility culler and return them all in an iterator.
 iVisibilityObjectIterator intersectSegment(csVector3 start, csVector3 end, boolean accurate)
          Intersect a segment with all objects in the visibility culler and return them all in an iterator.
 boolean intersectSegment(csVector3 start, csVector3 end, csVector3 isect)
          Intersect a beam using this culler and return the intersection point, the mesh and optional polygon index.
 boolean intersectSegment(csVector3 start, csVector3 end, csVector3 isect, float pr)
          Intersect a beam using this culler and return the intersection point, the mesh and optional polygon index.
 boolean intersectSegment(csVector3 start, csVector3 end, csVector3 isect, float pr, iMeshWrapper p_mesh)
          Intersect a beam using this culler and return the intersection point, the mesh and optional polygon index.
 boolean intersectSegment(csVector3 start, csVector3 end, csVector3 isect, float pr, iMeshWrapper p_mesh, int poly_idx)
          Intersect a beam using this culler and return the intersection point, the mesh and optional polygon index.
 boolean intersectSegment(csVector3 start, csVector3 end, csVector3 isect, float pr, iMeshWrapper p_mesh, int poly_idx, boolean accurate)
          Intersect a beam using this culler and return the intersection point, the mesh and optional polygon index.
protected  boolean isNativePointerValidSafe(long pointer)
           
 void registerVisObject(iVisibilityObject visobj)
          Register a visibility object with this culler.
 void setup(java.lang.String name)
          Setup all data for this visibility culler.
 void unregisterVisObject(iVisibilityObject visobj)
          Unregister a visibility object with this culler.
 iVisibilityObjectIterator visTest(csBox3 box)
          Mark all objects as visible that intersect with the given bounding box.
 iVisibilityObjectIterator visTest(csPlane3 plane, int num_planes)
          Mark all objects as visible that are in the volume formed by the set of planes.
 void visTest(csPlane3 plane, int num_planes, iVisibilityCullerListener viscallback)
          Notify the visibility callback of all objects that are in the volume formed by the set of planes.
 iVisibilityObjectIterator visTest(csSphere sphere)
          Mark all objects as visible that intersect with the given bounding sphere.
 void visTest(csSphere sphere, iVisibilityCullerListener viscallback)
          Notify the visibility callback of all objects that intersect with the given bounding sphere.
 boolean visTest(iRenderView irview, iVisibilityCullerListener viscallback)
          Do the visibility test from a given viewpoint.
 
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

csVisibilityCuller

public csVisibilityCuller(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: iBase
Return the name of the interface

Specified by:
getName in interface iBase
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)

castShadows

public void castShadows(iFrustumView fview)
Description copied from interface: iVisibilityCuller
Start casting shadows from a given point in space. What this will do is traverse all objects registered to the visibility culler. If some object implements iShadowCaster then this function will use the shadows casted by that object and put them in the frustum view. This function will then also call the object function which is assigned to iFrustumView. That object function will (for example); call iShadowReceiver->CastShadows(); to cast the collected shadows on the shadow receiver. Implemented in csDynaVis, and csFrustumVis.

Specified by:
castShadows in interface iVisibilityCuller
Parameters:
fview -
See Also:
iVisibilityCuller.castShadows(crystalspace.jbind.interfaces.iengine.fview.iFrustumView)

intersectSegment

public boolean intersectSegment(csVector3 start,
                                csVector3 end,
                                csVector3 isect)
Description copied from interface: iVisibilityCuller
Intersect a beam using this culler and return the intersection point, the mesh and optional polygon index. If the returned mesh is 0 then this means that the object belonging to the culler itself was hit. Some meshes don't support returning polygon indices in which case that field will always be -1. If accurate is false then a less accurate (and faster); method is used. In that case the polygon index will never be filled. Implemented in csDynaVis, and csFrustumVis.

Specified by:
intersectSegment in interface iVisibilityCuller
Parameters:
start -
end -
isect -
Returns:
See Also:
iVisibilityCuller.intersectSegment(crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3)

intersectSegment

public boolean intersectSegment(csVector3 start,
                                csVector3 end,
                                csVector3 isect,
                                float pr)
Description copied from interface: iVisibilityCuller
Intersect a beam using this culler and return the intersection point, the mesh and optional polygon index. If the returned mesh is 0 then this means that the object belonging to the culler itself was hit. Some meshes don't support returning polygon indices in which case that field will always be -1. If accurate is false then a less accurate (and faster); method is used. In that case the polygon index will never be filled. Implemented in csDynaVis, and csFrustumVis.

Specified by:
intersectSegment in interface iVisibilityCuller
Parameters:
start -
end -
isect -
pr -
Returns:
See Also:
iVisibilityCuller.intersectSegment(crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3, float)

intersectSegment

public boolean intersectSegment(csVector3 start,
                                csVector3 end,
                                csVector3 isect,
                                float pr,
                                iMeshWrapper p_mesh)
Description copied from interface: iVisibilityCuller
Intersect a beam using this culler and return the intersection point, the mesh and optional polygon index. If the returned mesh is 0 then this means that the object belonging to the culler itself was hit. Some meshes don't support returning polygon indices in which case that field will always be -1. If accurate is false then a less accurate (and faster); method is used. In that case the polygon index will never be filled. Implemented in csDynaVis, and csFrustumVis.

Specified by:
intersectSegment in interface iVisibilityCuller
Parameters:
start -
end -
isect -
pr -
p_mesh -
Returns:
See Also:
iVisibilityCuller.intersectSegment(crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3, float, crystalspace.jbind.interfaces.iengine.mesh.iMeshWrapper)

intersectSegment

public boolean intersectSegment(csVector3 start,
                                csVector3 end,
                                csVector3 isect,
                                float pr,
                                iMeshWrapper p_mesh,
                                int poly_idx)
Description copied from interface: iVisibilityCuller
Intersect a beam using this culler and return the intersection point, the mesh and optional polygon index. If the returned mesh is 0 then this means that the object belonging to the culler itself was hit. Some meshes don't support returning polygon indices in which case that field will always be -1. If accurate is false then a less accurate (and faster); method is used. In that case the polygon index will never be filled. Implemented in csDynaVis, and csFrustumVis.

Specified by:
intersectSegment in interface iVisibilityCuller
Parameters:
start -
end -
isect -
pr -
p_mesh -
poly_idx -
Returns:
See Also:
iVisibilityCuller.intersectSegment(crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3, float, crystalspace.jbind.interfaces.iengine.mesh.iMeshWrapper, int)

intersectSegment

public boolean intersectSegment(csVector3 start,
                                csVector3 end,
                                csVector3 isect,
                                float pr,
                                iMeshWrapper p_mesh,
                                int poly_idx,
                                boolean accurate)
Description copied from interface: iVisibilityCuller
Intersect a beam using this culler and return the intersection point, the mesh and optional polygon index. If the returned mesh is 0 then this means that the object belonging to the culler itself was hit. Some meshes don't support returning polygon indices in which case that field will always be -1. If accurate is false then a less accurate (and faster); method is used. In that case the polygon index will never be filled. Implemented in csDynaVis, and csFrustumVis.

Specified by:
intersectSegment in interface iVisibilityCuller
Parameters:
start -
end -
isect -
pr -
p_mesh -
poly_idx -
accurate -
Returns:
See Also:
iVisibilityCuller.intersectSegment(crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3, float, crystalspace.jbind.interfaces.iengine.mesh.iMeshWrapper, int, boolean)

intersectSegment

public iVisibilityObjectIterator intersectSegment(csVector3 start,
                                                  csVector3 end)
Description copied from interface: iVisibilityCuller
Intersect a segment with all objects in the visibility culler and return them all in an iterator. If accurate is true then a more accurate (and slower); method is used. Implemented in csDynaVis, and csFrustumVis.

Specified by:
intersectSegment in interface iVisibilityCuller
Parameters:
start -
end -
Returns:
See Also:
iVisibilityCuller.intersectSegment(crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3)

intersectSegment

public iVisibilityObjectIterator intersectSegment(csVector3 start,
                                                  csVector3 end,
                                                  boolean accurate)
Description copied from interface: iVisibilityCuller
Intersect a segment with all objects in the visibility culler and return them all in an iterator. If accurate is true then a more accurate (and slower); method is used. Implemented in csDynaVis, and csFrustumVis.

Specified by:
intersectSegment in interface iVisibilityCuller
Parameters:
start -
end -
accurate -
Returns:
See Also:
iVisibilityCuller.intersectSegment(crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector3.csVector3, boolean)

registerVisObject

public void registerVisObject(iVisibilityObject visobj)
Description copied from interface: iVisibilityCuller
Register a visibility object with this culler. If this visibility object also supports iShadowCaster and this visibility culler supports shadow casting then it will automatically get registered as a shadow caster as well. Same for iShadowReceiver. Implemented in csDynaVis, and csFrustumVis.

Specified by:
registerVisObject in interface iVisibilityCuller
Parameters:
visobj -
See Also:
iVisibilityCuller.registerVisObject(crystalspace.jbind.interfaces.iengine.viscul.iVisibilityObject)

setup

public void setup(java.lang.String name)
Description copied from interface: iVisibilityCuller
Setup all data for this visibility culler. This needs to be called before the culler is used for the first time. The given name will be used to cache the data. Implemented in csDynaVis, and csFrustumVis.

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

unregisterVisObject

public void unregisterVisObject(iVisibilityObject visobj)
Description copied from interface: iVisibilityCuller
Unregister a visibility object with this culler. Implemented in csDynaVis, and csFrustumVis.

Specified by:
unregisterVisObject in interface iVisibilityCuller
Parameters:
visobj -
See Also:
iVisibilityCuller.unregisterVisObject(crystalspace.jbind.interfaces.iengine.viscul.iVisibilityObject)

visTest

public void visTest(csPlane3 plane,
                    int num_planes,
                    iVisibilityCullerListener viscallback)
Description copied from interface: iVisibilityCuller
Notify the visibility callback of all objects that are in the volume formed by the set of planes. Can be used for frustum intersection, box intersection, .... Remarks: Warning! This function can only use up to 32 planes. Implemented in csDynaVis, and csFrustumVis.

Specified by:
visTest in interface iVisibilityCuller
Parameters:
plane -
num_planes -
viscallback -
See Also:
iVisibilityCuller.visTest(crystalspace.jbind.impl.csgeom.plane3.csPlane3, int, crystalspace.jbind.interfaces.iengine.viscul.iVisibilityCullerListener)

visTest

public iVisibilityObjectIterator visTest(csPlane3 plane,
                                         int num_planes)
Description copied from interface: iVisibilityCuller
Mark all objects as visible that are in the volume formed by the set of planes. Can be used for frustum intersection, box intersection, .... Warning! This function can only use up to 32 planes. Implemented in csDynaVis, and csFrustumVis.

Specified by:
visTest in interface iVisibilityCuller
Parameters:
plane -
num_planes -
Returns:
See Also:
iVisibilityCuller.visTest(crystalspace.jbind.impl.csgeom.plane3.csPlane3, int)

visTest

public void visTest(csSphere sphere,
                    iVisibilityCullerListener viscallback)
Description copied from interface: iVisibilityCuller
Notify the visibility callback of all objects that intersect with the given bounding sphere. Implemented in csDynaVis, and csFrustumVis.

Specified by:
visTest in interface iVisibilityCuller
Parameters:
sphere -
viscallback -
See Also:
iVisibilityCuller.visTest(crystalspace.jbind.impl.csgeom.sphere.csSphere, crystalspace.jbind.interfaces.iengine.viscul.iVisibilityCullerListener)

visTest

public iVisibilityObjectIterator visTest(csSphere sphere)
Description copied from interface: iVisibilityCuller
Mark all objects as visible that intersect with the given bounding sphere. Implemented in csDynaVis, and csFrustumVis.

Specified by:
visTest in interface iVisibilityCuller
Parameters:
sphere -
Returns:
See Also:
iVisibilityCuller.visTest(crystalspace.jbind.impl.csgeom.sphere.csSphere)

visTest

public iVisibilityObjectIterator visTest(csBox3 box)
Description copied from interface: iVisibilityCuller
Mark all objects as visible that intersect with the given bounding box. Implemented in csDynaVis, and csFrustumVis.

Specified by:
visTest in interface iVisibilityCuller
Parameters:
box -
Returns:
See Also:
iVisibilityCuller.visTest(crystalspace.jbind.impl.csgeom.box.csBox3)

visTest

public boolean visTest(iRenderView irview,
                       iVisibilityCullerListener viscallback)
Description copied from interface: iVisibilityCuller
Do the visibility test from a given viewpoint. This will first clear the visible flag on all registered objects and then it will mark all visible objects. If this function returns false then all objects are visible. Implemented in csDynaVis, and csFrustumVis.

Specified by:
visTest in interface iVisibilityCuller
Parameters:
irview -
viscallback -
Returns:
See Also:
iVisibilityCuller.visTest(crystalspace.jbind.interfaces.iengine.rview.iRenderView, crystalspace.jbind.interfaces.iengine.viscul.iVisibilityCullerListener)