region_set(STRING* name, var mode)
Disables or enables all branches of the ABT resp. BSP tree that are contained in the region with the given name. This is like punching a rectangular hole into the view frustum, thus clipping away all objects inside that region. It can be used f.i. for disabling the rendering of objects inside a building as long as the camera is outside or the doors are closed.
Parameters:
name - region name, STRING* or char*.
mode - 0: no clipping (default), 1: clip away objects that are mostly inside the region, 2: clip away objects that are fully inside the region.
In the future, further modes can be used for triggering events etc.
Returns:
0 if the region was not found, otherwise nonzero.
Speed:
Medium.
Remarks:
- Different regions can have the same name. In that case, region_set affects all regions with the given name.
- Mode 1 clips objects when their geometric center (not their origin) is inside the region. Mode 2 only clips objects that are completely inside the region in all possible rotations.
- Regions can be placed in WED by clicking Add Region, or created with region_create.
Edition:
A8 P
Example:
region_set("reg_001",1); // clips away all regions with the name "reg_001"
See also:
path_set, region_check, region_create, region_find,
region_get
► latest
version online