This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

ObjectMeshCluster Class

A MeshCluster class allows you to bake identical meshes (with the same material applied to their surfaces) into one object, which provides less cluttered spatial tree, reduces the number of texture fetches and speeds up rendering.

Meshes are rendered within a specified visibility distance from the camera. When moving away from this distance, meshes fade out and then disappear completely.

The following samples demonstrate the ObjectMeshCluster class usage:

ObjectMeshCluster Class

Members


ObjectMeshCluster (string arg1, int dynamic = 0)

Arguments

  • string arg1
  • int dynamic

void setVisibleDistance (float distance)

Sets the distance up to which meshes handled by the mesh cluster will be rendered.

Arguments

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

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 visibility distance.
Notice
In order for a fade distance to be applied, visibility distance should not be infinite.

Return value

Fade distance, in units.

void setMeshName (string name)

Sets a name for the mesh handled by the mesh cluster.

Arguments

  • string name - Name to be set for the mesh.

float getVisibleDistance ()

Returns the current distance up to which meshes handled by the mesh cluster are rendered.

Return value

Distance of visibility for meshes, in units.

void createMeshes (int transforms)

Bakes children meshes into the cluster. For meshes to be baked, they must be identical to the source mesh and have the same material applied to their surfaces.

Arguments

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

int getNumMeshes ()

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

Return value

Number of meshes.

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 visibility distance.
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.

int findSurfaceTarget (string name, int surface)

Searches for a surface target with a given name.

Arguments

  • string name - Target name.
  • int surface - Surface number.

Return value

Target number if it exists; otherwise, -1.

void clearMeshes ()

Deletes all meshes currently baked into mesh cluster.

void flushMesh ()

Flushes the mesh geometry into the video memory.

int setMesh (Mesh mesh)

Copies the source mesh into the current mesh.

Arguments

  • Mesh mesh - The source mesh to be copied.

Return value

1 if the mesh is copied successfully; otherwise, 0.

int saveMesh (string name)

Saves the mesh into the .mesh format.

Arguments

  • string name - The path to the file.

Return value

1 if the mesh is saved successfully; otherwise, 0.

void setMeshTransform (int num, mat4 transform)

Sets the transformation for the given mesh instance.

Arguments

  • int num - Mesh instance number.
  • mat4 transform - Transformation matrix.

int getNumSurfaceTargets (int surface)

Returns the total number of surface targets.

Arguments

  • int surface - Surface number.

Return value

Total number of surface targets.

int getMesh (Mesh mesh)

Copies the current mesh into the source mesh.

Arguments

  • Mesh mesh - The source mesh.

Return value

1 if the mesh is copied successfully.

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.

Arguments

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

int createMesh (string name, int dynamic = 0)

Creates the cluster with the specified parameters.

Arguments

  • string name - Mesh name.
  • int dynamic - Dynamic flag:
    • 0 - If the mesh vertices are changed in run-time, meshes loaded from the same file will be also changed.
    • 1 - If the mesh vertices are changed in run-time, meshes loaded from the same file won't be changed

Return value

1 if the mesh is created successfully; otherwise - 0.

int loadMesh (string name)

Loads the mesh for the current mesh from the .mesh file. This function doesn't change the mesh name.

Arguments

  • string name - The path to the .mesh file.

Return value

1 if the mesh is loaded successfully; otherwise, 0.

string getMeshName ()

Returns the name of the mesh handled by a mesh cluster.

Return value

Mesh name.

string getSurfaceTargetName (int surface, int target)

Returns the name of a given surface target.

Arguments

  • int surface - Surface number.
  • int target - Target number.

Return value

Target name.

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.

Return value

Distance, in units.

mat4 getMeshTransform (int num)

Returns the transformation of the given mesh instance.

Arguments

  • int num - Mesh instance number.

Return value

Transformation matrix.
Last update: 2017-07-03
Build: ()