C4 Engine
C4 Engine API Documentation


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

void SetVisibilityCallback(VisibilityCallback *callback);

callback A pointer to the function that performs the visibility test.
The SetVisibilityCallback function installs the callback function that is called when visibility testing is needed for a node. The VisibilityCallback type is defined as follows.

typedef bool VisibilityCallback(const Node *, const VisibilityRegion *);

When the visibility callback function is called, it can use whatever means is appropriate to determine whether the node is visible within the given region. This is normally accomplished by calling one or more of the following member functions of the VisibilityRegion class.

VisibilityRegion::PolygonVisible VisibilityRegion::SphereVisible VisibilityRegion::EllipsoidVisible VisibilityRegion::BoxVisible VisibilityRegion::CylinderVisible

The visibility 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 visibility callback function. This function passes the node's bounding sphere to the VisibilityRegion::SphereVisible function to determine whether the node is visible.

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

If a custom visibility procedure is installed using the SetVisibilityCallback, then a custom occlusion callback function should also be installed using the Node::SetOcclusionCallback function if occlusion portals are in use.
See Also