UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials

WorldOccluderMesh Class

This class creates a mesh-shaped occluder out of the loaded mesh and is used to cull surfaces that are currently hidden behind it. The objects behind the occluder are not sent to the GPU which saves performance.

Usage

In order to enhance performance, occluders should be used wisely.

  • Occluders can be highly effective in case of complex environments where there are many objects that occlude each other and are costly to render (they have a lot of polygons and/or heavy shaders).
  • Effective culling is possible if objects are not too large, since if any part of their surface is seen, it cannot be culled. In case objects are big and have a few surfaces, it is likely that an additional performance load of an occluder will not pay off.
  • In case the scene is filled with flat objects or a camera looks down on the scene from above (for example, in flight simulators), it is better not to use occluders at all or disable them.

WorldOccluderMesh Class

This class inherits from Node

Members


WorldOccluderMesh ()

Constructor. Creates a new world mesh occluder with default properties.

WorldOccluderMesh (string name)

Constructor. Creates a new world mesh occluder from given mesh file.

Arguments

  • string name - Name of a mesh file.

float getDistance ()

Returns the current distance of disabling occluder.

Return value

Distance in units.

int getMesh (ObjectMesh mesh)

Allows to receive a mesh node as an argument.

Arguments

  • ObjectMesh mesh - Name of the mesh.

Return value

Mesh node.

int load (string name)

Loads a mesh file and re-generates the world mesh occluder.

Arguments

  • string name - Name of a mesh file.

Return value

1 if success; 0 otherwise.

int save (string name)

Saves the world mesh occluder into a file.

Arguments

  • string name - Name of a mesh file.

Return value

1 if success; 0 otherwise.

void setDistance (float distance)

Updates the distance for disabling occluder. The default is infinity.

Arguments

  • float distance - Distance in units.

int setMesh (ObjectMesh mesh)

Allows to reinitialize the WorldOccluderMesh object.

Arguments

  • ObjectMesh mesh - Name of the mesh node.

Return value

1 if the mesh node is successfully set, otherwise - 0.
Last update: 2017-07-03