UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1

Unigine::ObjectMeshCluster Class

Interface for object mesh handling. See also the UnigineScript analog.

To use this class, include the UnigineObjectMeshCluster.h file.

Unigine::ObjectMeshCluster Class

Members


static int type ()

ObjectMeshClutter type.

Return value

ObjectMeshClutter type identifier.

static Ptr< ObjectMeshClutter > create (const NodePtr & node)

ObjectMeshClutter constructor.

Arguments

  • const NodePtr & node - Node smart pointer.

static Ptr< ObjectMeshClutter > create (const ObjectPtr & object)

ObjectMeshClutter constructor.

Arguments

  • const ObjectPtr & object - Object smart pointer.

static Ptr< ObjectMeshClutter > create (const char * name, int dynamic = 0)

ObjectMeshClutter constructor.

Arguments

  • const char * name - Mesh file 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

virtual int createMesh (const char * name, int dynamic = 0) =0

Creates the clutter mesh with the specified parameters.

Arguments

  • const char * name - Path to the mesh file.
  • 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.

virtual int loadMesh (const char * name) =0

Loads a new mesh instead of the current mesh from the .mesh file. This function doesn't change the mesh name.

Arguments

  • const char * name - Path to the mesh file.

Return value

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

virtual int saveMesh (const char * name) const =0

Saves the mesh into a file.

Arguments

  • const char * name - Path to the mesh file.

Return value

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

virtual int setMesh (const MeshPtr & mesh) =0

Copies the source mesh into the current mesh.

Arguments

  • const MeshPtr & mesh - The source mesh to be copied.

Return value

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

virtual int getMesh (const MeshPtr & mesh) const =0

Copies the current mesh into the source mesh.

Arguments

  • const MeshPtr & mesh - The source mesh.

Return value

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

virtual void flushMesh () const =0

Flushes the mesh geometry into the video memory.

virtual void setMeshName (const char * name) =0

Sets a name for the mesh scattered by the mesh clutter.

Arguments

  • const char * name - Name to be set for the mesh.

virtual const char * getMeshName () const =0

Returns the name of the mesh scattered by mesh clutter.

Return value

Mesh name.

virtual void setCollision (int collision) =0

Sets a value indicating if collisions with the object should be taken into account.
Notice
If the collision parameter is set to 0, the new geometry will never be generated by collision detection request.

Arguments

  • int collision - 1 to take collisions into account and make the object important for physics; 0 to allow collisions only with already generated geometry.

virtual int getCollision () const =0

Returns a value indicating if collisions with the object should be taken into account.
Notice
If the return value is 0 the new geometry will never be generated by collision detection request.

Return value

1 if collisions are taken into account; 0 if collisions are allowed only with already generated geometry.

virtual void setOrientation (int orientation) =0

Sets a value indicating whether meshes should be oriented along the normals of the ground (either the terrain or a mesh set as a parent node).

Arguments

  • int orientation - Positive number to enable orientation; 0 to disable.

virtual int getOrientation () const =0

Returns a value indicating whether meshes are oriented along the normals of the ground (either the terrain or a mesh set as a parent node).

Return value

1 if orientation is enabled; otherwise, 0.

virtual void setIntersection (int intersection) =0

Sets a value indicating whether meshes should be scattered upon the ground (along its relief): either the terrain or a mesh set as a parent node.

Arguments

  • int intersection - Positive number to enable intersection; 0 to disable.

virtual int getIntersection () const =0

Returns a value indicating whether meshes are scattered upon the ground (along its relief): either the terrain or a mesh set as a parent node.

Return value

1 if intersection is enabled; otherwise, 0.

virtual void setVisibleDistance (float distance) =0

Sets the distance up to which meshes scattered by the mesh clutter will be rendered.

Arguments

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

virtual float getVisibleDistance () const =0

Returns the current distance up to which meshes scattered by the mesh clutter are rendered.

Return value

Distance of visibility for meshes in units.

virtual void setFadeDistance (float distance) =0

Sets the distance up to which meshes scattered by the mesh clutter will be fading out (that is, fewer meshes will be rendered instead of all). The distance is measured starting from the visible 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.

virtual float getFadeDistance () const =0

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

Return value

Distance of nodes fading in units.

virtual void setShadowRadius (float radius) =0

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.

virtual float getShadowRadius () const =0

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.

virtual int getSpawnCount () const =0

Returns the number of cells to be generated.

Return value

Number of cells to be generated if the scene generation is not completed; otherwise, 0.

virtual void setSeed (int seed) =0

Sets the seed for pseudo-random positioning of meshes.

Arguments

  • int seed - Number used to initialize a pseudo-random sequence. If a negative value is provided, 0 will be used instead.

virtual int getSeed () const =0

Returns the seed used for pseudo-random positioning of meshes.

Return value

Number used to initialize a pseudo-random sequence.

virtual void setSizeX (float size) =0

Sets the width of the mesh clutter along the X-coordinate.

Arguments

  • float size - X-coordinate width in units. If a negative value is provided, 0 will be used instead.

virtual float getSizeX () const =0

Returns the current width of the mesh clutter along the X-coordinate.

Return value

X-coordinate width in units.

virtual void setSizeY (float size) =0

Sets the length of the mesh clutter along the Y-coordinate.

Arguments

  • float size - Y-coordinate length in units. If a negative value is provided, 0 will be used instead.

virtual float getSizeY () const =0

Returns the current length of the mesh clutter along the Y-coordinate.

Return value

Y-coordinate length in units.

virtual void setStep (float step) =0

Sets the step for cells used to render mesh clutter.

Arguments

  • float step - Step for clutter cells in units.

virtual float getStep () const =0

Returns the step for cells used to render meshes scattered by the mesh clutter.

Return value

Step for clutter cells in units.

virtual void setDensity (float density) =0

Sets the density factor that defines the number of meshes per square unit.

Arguments

  • float density - Density factor. If a negative value is provided, 0 will be used instead.

virtual float getDensity () const =0

Returns the current density factor that defines the number of meshes per square unit.

Return value

Density factor.

virtual void setThreshold (float threshold) =0

Sets the density threshold (for a mask) starting from which meshes are rendered if placed dense enough.

Arguments

  • float threshold - Density threshold. The provided value will be clipped in range [0;1].

virtual float getThreshold () const =0

Returns the current density threshold (for a mask) starting from which meshes are rendered if placed dense enough.

Return value

Density threshold.

virtual void setAngle (float angle) =0

Sets the angle cosine that defines the slope steepness appropriate for positioning meshes.

Arguments

  • float angle - Slope angle cosine. The provided value will be clipped in range [0;1].

virtual float getAngle () const =0

Returns the current angle cosine that defines the slope steepness appropriate for positioning meshes.

Return value

Slope angle cosine.

virtual void setMinScale (float mean, float spread) =0

Sets the scale for meshes in the areas with low density (according to the mask). With the minimum scale it is possible to automatically render, for example, small trees at the forest border. A spread value allows you to control the range of scales relative to the mean value.

Arguments

  • float mean - Scale mean value.
  • float spread - Maximum spread value to randomly upscale or downscale objects.

virtual float getMinScaleMean () const =0

Returns the scale mean value for meshes in the areas with low density (according to the mask).

Return value

Scale mean value.

virtual float getMinScaleSpread () const =0

Returns the scale spread value that controls the range of mesh scales in the areas with low density (according to the mask).

Return value

Scale spread value.

virtual void setMaxScale (float mean, float spread) =0

Sets the scale for meshes in the areas with high density (according to the mask). With the minimum scale it is possible to automatically render, for example, big trees in the center of the forest. A spread value allows you to control the range of scales relative to the mean value.

Arguments

  • float mean - Scale mean value.
  • float spread - Maximum spread value to randomly upscale or downscale objects.

virtual float getMaxScaleMean () const =0

Returns the scale mean value for meshes in the areas with high density (according to the mask).

Return value

Scale mean value.

virtual float getMaxScaleSpread () const =0

Returns the scale spread value that controls the range of mesh scales in the areas with high density (according to the mask).

Return value

Scale spread value.

virtual void setOffset (float mean, float spread) =0

Sets the vertical offset that determines the placement of meshes above or below the surface.

Arguments

  • float mean - Mean value of the offset in units.
  • float spread - Spread value of the offset in units.

virtual float getOffsetMean () const =0

Returns the current mean value of the vertical offset that determines the placement of meshes above or below the surface.

Return value

Mean value of the offset in units.

virtual float getOffsetSpread () const =0

Returns the current spread value of the vertical offset that determines the placement of meshes above or below the surface.

Return value

Spread value of the offset in units.

virtual void setRotation (vec3 & mean, vec3 & spread) =0

Sets the rotation of meshes along X, Y and Z axes.

Arguments

  • vec3 & mean - Mean values of rotation angles in degrees.
  • vec3 & spread - Spread values of rotation angles in degrees.

virtual vec3 getRotationMean () const =0

Returns the mean value of meshes rotation along X, Y and Z axes.

Return value

Mean values of rotation angles in degrees.

virtual vec3 getRotationSpread () const =0

Returns the spread value of meshes rotation along X, Y and Z axes.

Return value

Spread values of rotation angles in degrees.

virtual int setMaskImage (ImagePtr & image) =0

Sets an image (in R8 format) that defines placement of meshes.

Arguments

  • ImagePtr & image - Image smart pointer.

Return value

1 if the mask image is successfully set; otherwise, 0.

virtual int getMaskImage (ImagePtr & image) const =0

Writes the image that is currently used as a mask for placement of meshes into the given buffer.

Arguments

  • ImagePtr & image - Image smart pointer.

Return value

1 if the mask image is successfully written into the buffer; otherwise, 0.

virtual void setMaskImageName (const char * name) =0

Sets the name of a mask texture (in R8 format) that defines the placement of meshes.

Arguments

  • const char * name - Name (path) of the mask texture.

virtual const char * getMaskImageName () const =0

Returns the name of a mask texture (in R8 format) that defines the placement of meshes.

Return value

Name (path) of the mask texture.

virtual void setMaskFlipX (int flip) =0

Flip the mask by X axis.

Arguments

  • int flip - Positive value to flip the mask; otherwise, 0.

virtual int getMaskFlipX () const =0

Returns a flag indicating if a mask is flipped by X axis.

Return value

Positive value if the mask is flipped; otherwise, 0.

virtual void setMaskFlipY (int flip) =0

Flip the mask by Y axis.

Arguments

  • int flip - Positive value to flip the mask; otherwise, 0.

virtual int getMaskFlipY () const =0

Returns a flag indicating if a mask is flipped by Y axis.

Return value

Positive value if the mask is flipped; otherwise, 0.

virtual void setMaskMinValue (int value) =0

Sets the minimum value of the mask application range.

Arguments

  • int value - Minimum mask value, [0;255].

virtual int getMaskMinValue () const =0

Returns the minimum value of the mask application range.

Return value

Minimum mask value.

virtual void setMaskMaxValue (int value) =0

Sets the maximum value of the mask application range.

Arguments

  • int value - Maximum mask value, [0;255].

virtual int getMaskMaxValue () const =0

Returns the maximum value of the mask application range.

Return value

Maximum mask value.

virtual void setMaskMeshName (const char * name) =0

Sets a mesh to be used as a mask for the mesh clutter. This mesh should be plane.

Arguments

  • const char * name - Path to the *.mesh file.

virtual const char * getMaskMeshName () const =0

Returns the current mesh to used as a mask for the mesh clutter. This mesh should be plane.

Return value

Path to the *.mesh file.

virtual void setMaskInverse (int inverse) =0

Specifies if clutter meshes should be rendered inside or outside the mask mesh contour.

Arguments

  • int inverse - 0 to render clutter meshes inside the mask mesh contour; 1 to render them outside.

virtual int getMaskInverse () const =0

Returns a flag indicating if clutter meshes are rendered inside or outside the mask mesh contour.

Return value

0 if clutter meshes are rendered inside the mask mesh contour; 1 if outside.

virtual int getNumSurfaceTargets (int surface) const =0

Returns the total number of surface targets.

Arguments

  • int surface - Surface number.

Return value

Total number of surface targets.

virtual const char * getSurfaceTargetName (int surface, int target) const =0

Returns the name of a given surface target.

Arguments

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

Return value

Target name.

virtual int findSurfaceTarget (const char * name, int surface) const =0

Searches for a surface target with a given name.

Arguments

  • const char * name - Target name.
  • int surface - Surface number.

Return value

Target number if it exists; otherwise, -1.
Last update: 2017-07-03