## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iVisibilityCuller Struct Reference
[Visibility, Visibility]

This interface represents a visibility culling system. More...

`#include <iengine/viscull.h>`

Inheritance diagram for iVisibilityCuller:

[legend]
List of all members.

## Public Member Functions

virtual void | CastShadows (iFrustumView *fview)=0
| Start casting shadows from a given point in space.
virtual bool | IntersectSegment (const csVector3 &start, const csVector3 &end, csVector3 &isect, float *pr=0, iMeshWrapper **p_mesh=0, int *poly_idx=0, bool accurate=true)=0
| Intersect a beam using this culler and return the intersection point, the mesh and optional polygon index.
virtual csPtr< iVisibilityObjectIterator > | IntersectSegment (const csVector3 &start, const csVector3 &end, bool accurate=false)=0
| Intersect a segment with all objects in the visibility culler and return them all in an iterator.
virtual csPtr< iVisibilityObjectIterator > | IntersectSegmentSloppy (const csVector3 &start, const csVector3 &end)=0
| Intersect a segment with all objects in the visibility culler and return them all in an iterator.
virtual const char * | ParseCullerParameters (iDocumentNode *node)=0
| Parse a document node with additional parameters for this culler.
virtual void | PrecacheCulling ()=0
| Precache visibility culling.
virtual void | RegisterVisObject (iVisibilityObject *visobj)=0
| Register a visibility object with this culler.
virtual void | Setup (const char *name)=0
| Setup all data for this visibility culler.
virtual void | UnregisterVisObject (iVisibilityObject *visobj)=0
| Unregister a visibility object with this culler.
virtual void | VisTest (csPlane3 *plane, int num_planes, iVisibilityCullerListener *viscallback)=0
| Notify the visibility callback of all objects that are in the volume formed by the set of planes.
virtual csPtr< iVisibilityObjectIterator > | VisTest (csPlane3 *plane, int num_planes)=0
| Mark all objects as visible that are in the volume formed by the set of planes.
virtual void | VisTest (const csSphere &sphere, iVisibilityCullerListener *viscallback)=0
| Notify the visibility callback of all objects that intersect with the given bounding sphere.
virtual csPtr< iVisibilityObjectIterator > | VisTest (const csSphere &sphere)=0
| Mark all objects as visible that intersect with the given bounding sphere.
virtual csPtr< iVisibilityObjectIterator > | VisTest (const csBox3 &box)=0
| Mark all objects as visible that intersect with the given bounding box.
virtual bool | VisTest (iRenderView *irview, iVisibilityCullerListener *viscallback)=0
| Do the visibility test from a given viewpoint.

## Detailed Description

This interface represents a visibility culling system.

To use it you first register visibility objects (which are all the objects for which you want to test visibility) to this culler. A visibility culler can usually also support shadow calculation.

Main creators of instances implementing this interface:

- Dynavis culler plugin (crystalspace.culling.dynavis)
- Frustvis culler plugin (crystalspace.culling.frustvis)

Main ways to get pointers to this interface:

- CS_QUERY_REGISTRY()
- CS_LOAD_PLUGIN()
- iSector::GetVisibilityCuller()

Main users of this interface:

- iEngine

Definition at line 102 of file viscull.h.

## Member Function Documentation

virtual void iVisibilityCuller::CastShadows | ( | iFrustumView * | fview | ) | `[pure virtual]`

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.

virtual bool iVisibilityCuller::IntersectSegment | ( | const csVector3 & | start,
|  | const csVector3 & | end,
|  | csVector3 & | isect,
|  | float * | pr = `0`,
|  | iMeshWrapper ** | p_mesh = `0`,
|  | int * | poly_idx = `0`,
|  | bool | accurate = `true`
| ) | `[pure virtual]`

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.

virtual csPtr<iVisibilityObjectIterator> iVisibilityCuller::IntersectSegment | ( | const csVector3 & | start,
|  | const csVector3 & | end,
|  | bool | accurate = `false`
| ) | `[pure virtual]`

| 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.

virtual csPtr<iVisibilityObjectIterator> iVisibilityCuller::IntersectSegmentSloppy | ( | const csVector3 & | start,
|  | const csVector3 & | end
| ) | `[pure virtual]`

| Intersect a segment with all objects in the visibility culler and return them all in an iterator. This function is less accurate then IntersectSegment() because it might also return objects that are not even hit by the beam but just close to it.

virtual const char* iVisibilityCuller::ParseCullerParameters | ( | iDocumentNode * | node | ) | `[pure virtual]`

| Parse a document node with additional parameters for this culler. Returns error message on error or 0 otherwise.

virtual void iVisibilityCuller::PrecacheCulling | ( |  | ) | `[pure virtual]`

| Precache visibility culling. This can be useful in case you want to ensure that render speed doesn't get any hickups as soon as a portal to this sector becomes visible. iEngine->PrecacheDraw() will call this function.

virtual void iVisibilityCuller::RegisterVisObject | ( | iVisibilityObject * | visobj | ) | `[pure virtual]`

| 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.

virtual void iVisibilityCuller::Setup | ( | const char * | name | ) | `[pure virtual]`

| 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.

virtual void iVisibilityCuller::UnregisterVisObject | ( | iVisibilityObject * | visobj | ) | `[pure virtual]`

| Unregister a visibility object with this culler.

virtual void iVisibilityCuller::VisTest | ( | csPlane3 * | plane,
|  | int | num_planes,
|  | iVisibilityCullerListener * | viscallback
| ) | `[pure virtual]`

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.

virtual csPtr<iVisibilityObjectIterator> iVisibilityCuller::VisTest | ( | csPlane3 * | plane,
|  | int | num_planes
| ) | `[pure virtual]`

| 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.

virtual void iVisibilityCuller::VisTest | ( | const csSphere & | sphere,
|  | iVisibilityCullerListener * | viscallback
| ) | `[pure virtual]`

| Notify the visibility callback of all objects that intersect with the given bounding sphere.

virtual csPtr<iVisibilityObjectIterator> iVisibilityCuller::VisTest | ( | const csSphere & | sphere | ) | `[pure virtual]`

| Mark all objects as visible that intersect with the given bounding sphere.

virtual csPtr<iVisibilityObjectIterator> iVisibilityCuller::VisTest | ( | const csBox3 & | box | ) | `[pure virtual]`

| Mark all objects as visible that intersect with the given bounding box.

virtual bool iVisibilityCuller::VisTest | ( | iRenderView * | irview,
|  | iVisibilityCullerListener * | viscallback
| ) | `[pure virtual]`

| 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.

The documentation for this struct was generated from the following file:

- iengine/viscull.h