C4 Engine Terathon Software C4 Engine API Documentation

• World Manager

API Links
Developer Links

Node::SetOcclusionProc

Defined in:  C4Node.h
Sets the function that handles occlusion testing for a node.
Prototype

void SetOcclusionProc(OcclusionProc *proc);

Parameters
proc A pointer to the function that performs the occlusion test.
Description
The SetOcclusionProc function installs the procedure that is called when occlusion testing is needed for a node. The OcclusionProc type is defined as follows.

typedef bool OcclusionProc(const Node *, const Region *);

When the occlusion procedure is called, it can use whatever means is appropriate to determine whether the node is occluded within any of the regions in the list beginning with the region passed in. This is normally accomplished by calling one or more of the following member functions of the Region class. Region::PolygonOccluded Region::SphereOccluded Region::EllipsoidOccluded Region::BoxOccluded Region::CylinderOccluded

By default, the Node::SphereOccluded function is installed as a node's occlusion procedure. This function passes the node's bounding sphere to the Region::SphereOccluded function for each region in the list to determine whether the node is visible.

When the occlusion procedure function is called, the first region, passed as the second parameter, is guarenteed not to be nullptr. The ListElement::Next function should be used to iterate over all of the regions in the list.

The Node::NeverOccluded function may be installed as the occlusion procedure to force a node to be unoccluded all the time.

If a custom occlusion procedure is installed using the SetOcclusionProc, then a custom visibility procedure should also be installed using the Node::SetVisibilityProc function.
See Also

Node::Occluded

Node::SetVisibilityProc

Region