This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related 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

Inherits:Object

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


static ObjectMeshCluster(string arg1, int unique = 0)

ObjectMeshCluster constructor.

Arguments

  • string arg1 - Name of the mesh file.
  • int unique - When you create several objects out of a single .mesh file, the instance of the mesh geometry is created. If you then change the source geometry, its instances will be changed as well. To avoid this, set the unique flag to 1, so a copy of the mesh geometry will be created and changes won't be applied.

ObjectMeshCluster cast(Node node)

Casts an ObjectMeshCluster out of the Node instance.

Arguments

  • Node node - Node instance.

Return value

ObjectMeshCluster instance.

ObjectMeshCluster cast(Object base)

Casts an ObjectMeshCluster out of the Object instance.

Arguments

  • Object base - Object instance.

Return value

ObjectMeshCluster instance.

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.

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.

int setMesh(Mesh mesh)

Copies the source mesh into the current mesh.

Arguments

  • Mesh mesh - Source mesh to be copied.

Return value

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

int getMesh(Mesh mesh)

Copies the current mesh into the target mesh.

Arguments

  • Mesh mesh - Target mesh.

Return value

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

void setMeshName(string name, int force_load = 0)

Sets a name for the mesh handled by the mesh cluster and forces creating of the mesh with the new name.

Arguments

  • string name - Name to be set for the mesh.
  • int force_load - Force flag.
    • If 1 is specified, the mesh with the new name will be created immediately with the unique flag set to 0.
    • If 0 is specified, only the mesh name will be updated.

string getMeshName()

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

Return value

Mesh name.

void setMeshTransform(int num, mat4 transform)

Sets the transformation for the given mesh instance.

Arguments

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

mat4 getMeshTransform(int num)

Returns the transformation of the given mesh instance.

Arguments

  • int num - Mesh instance number.

Return value

Mesh transformation matrix.

int getNumMeshes()

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

Return value

Number of meshes.

int getNumSurfaceTargets(int surface)

Returns the total number of surface targets.

Arguments

  • int surface - Surface number.

Return value

Total number of surface targets.

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.

void setVisibleDistance(float distance)

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

Arguments

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

float getVisibleDistance()

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

Return value

Visibility distance for meshes in units.

void clearMeshes()

Deletes all meshes currently baked into mesh cluster.

int createMesh(string name, int unique = 0)

Creates the cluster with the specified parameters.

Arguments

  • string name - Mesh name.
  • int unique - When you create several objects out of a single .mesh file, the instance of the mesh geometry is created. If you then change the source geometry, its instances will be changed as well. To avoid this, set the unique flag to 1, so a copy of the mesh geometry will be created and changes won't be applied.

Return value

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

void createMeshes(int transforms)

Creates meshes is accordance with the transformations vector and bakes them into the cluster. All baked meshes are identical to the source mesh and have the same material applied to their surfaces.

Arguments

  • int transforms - Transformations vector.

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 flushMesh()

Flushes the mesh geometry into the video memory.

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 - Path to the .mesh file.

Return value

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

int saveMesh(string name)

Saves the cluster mesh to a .mesh file.

Arguments

  • string name - Path to the .mesh file.

Return value

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

int removeClusterTransforms(WorldBoundBox bb)

Removes cluster meshes, found within the specified bounding box, from the cluster.

Arguments

  • WorldBoundBox bb - Bounding box, defining the area, within which the cluster meshes are to be removed from the cluster.

Return value

Number of cluster meshes removed from the cluster; or 0, if there are no cluster meshes found within the specified bounding box.
Last update: 2018-08-10
Build: ()