This page has been translated automatically.
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
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

ObjectMeshCluster Class

MeshCluster class bakes identical meshes (with the same material applied to their surfaces) into one objects, which allows for less cluttered spatial tree, reduces the number of texture fetches and speeds up rendering.
Meshes are rendered within a specified distance from the camera. Further than this distance, nodes fade out and then disappear completely.

The following samples demonstrate the ObjectMeshCluster class usage:

ObjectMeshCluster Class

This class inherits from Object

Members


ObjectMeshCluster (string name)

Constructor. Creates a new mesh cluster to render instances of the specified mesh.

Arguments

  • string name - Mesh name.

void clearMeshes ()

Deletes all meshes currently baked into mesh cluster.

void createMeshes (int transforms)

Bakes child meshes of the mesh cluster into this cluster. For meshes to be baked, they must be identical to mesh cluster mesh and have the same material applied to its surfaces.

Arguments

  • int transforms - ID of array with transformation matrices for meshes.

float getFadeDistance ()

Returns the current distance up to which meshes handled by the mesh cluster are fading out (that is, fewer meshes will be rendered instead of all). The distance is measured starting from the visible distance. The default is 0.
Notice
In order for a fade distance to be applied, visibility distance should not be infinite.

Return value

Distance of nodes fading in units.

string getMeshName ()

Returns the name of the mesh handled by mesh cluster.

Return value

Mesh name.

mat4 getMeshTransform (int num)

Returns the transformation of the given mesh instance.

Arguments

  • int num - Mesh instance number.

Return value

Transformation matrix.

int getNumMeshes ()

Returns the total number of meshes handled by the mesh cluster.

Return value

Number of meshes.

float getShadowRadius ()

Returns the current distance to draw additional meshes outside the view frustum. This option allows you to eliminate popping of shadows at the edges of the screen when the camera is turning. The default is 0.

Return value

Distance in units.

float getVisibleDistance ()

Returns the current distance up to which meshes handled by the mesh cluster are rendered. The default is infinity.

Return value

Distance of visibility for meshes in units.

void setFadeDistance (float distance)

Sets the distance up to which meshes handled by the mesh cluster will be fading out (that is, fewer meshes will be rendered instead of all). The distance is measured starting from the visible distance. The default is 0.
Notice
In order for a fade distance to be applied, visibility distance should not be infinite.

Arguments

  • float distance - Distance of fading for meshes in units. If a negative value is provided, 0 will be used instead.

void setShadowRadius (float radius)

Sets the distance to draw additional meshes outside the view frustum. This option allows you to eliminate popping of shadows at the edges of the screen when the camera is turning. The default is 0.

Arguments

  • float radius - Distance in units. If a negative value is provided, 0 will be used instead.

void setVisibleDistance (float distance)

Sets the distance up to which meshes handled by the mesh cluster will be rendered. The default is infinity.

Arguments

  • float distance - Distance of visibility for meshes in units. If a negative value is provided, 0 will be used instead.
Last update: 03.07.2017
Build: ()