C4 Engine
C4 Engine API Documentation

Node::SetOcclusionCallback

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

void SetOcclusionCallback(OcclusionCallback *callback);

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

typedef bool OcclusionCallback(const Node *, const VisibilityRegion *, const List<OcclusionRegion> *);

When the occlusion callback function is called, it should perform the same visibility test as the function installed by the Node::SetVisibilityCallback function. The occlusion callback function should then use whatever means is appropriate to determine whether the node is occluded within any of the regions in the list specified by the last parameter. This is normally accomplished by calling one or more of the following member functions of the OcclusionRegion class.

OcclusionRegion::PolygonOccluded OcclusionRegion::SphereOccluded OcclusionRegion::EllipsoidOccluded OcclusionRegion::BoxOccluded OcclusionRegion::CylinderOccluded

The occlusion callback function should return true if the node is visible and false otherwise.

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

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

If a custom occlusion callback function is installed using the SetOcclusionCallback, then a custom visibility callback function should also be installed using the Node::SetVisibilityCallback function.
See Also

Node::NodeVisible

Node::SetVisibilityCallback

VisibilityRegion

OcclusionRegion