This page has been translated automatically.
Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
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
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.

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

ObjectMeshCluster type.

Return value

ObjectMeshCluster type identifier.

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

ObjectMeshCluster constructor.

Arguments

  • const NodePtr & node - Node smart pointer.

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

ObjectMeshCluster constructor.

Arguments

  • const ObjectPtr & object - Object smart pointer.

static Ptr< ObjectMeshCluster > create (const char * name, int dynamic)

ObjectMeshCluster constructor.

Arguments

  • const char * name - Mesh file name.
  • int dynamic - Create dynamic mesh.

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

Creates a mesh.

Arguments

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

Return value

Returns 1 if the mesh is created successfully; otherwise, 0.

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

Loads a mesh file.

Arguments

  • const char * name - Mesh file name.

Return value

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

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

Saves the dynamic mesh into a file.

Arguments

  • const char * name - Mesh file name.

Return value

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

virtual int setMesh (const MeshPtr & mesh) const =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) const =0

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

Arguments

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

virtual const char * getMeshName () const =0

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

Return value

Mesh name.

virtual void setVisibleDistance (float distance) const =0

Sets the distance up to which meshes handled by the mesh cluster will be rendered. The default is infinity (in this case, fade distance will be ignored).

Arguments

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

virtual float getVisibleDistance () const =0

Returns the distance up to which meshes handled by the mesh cluster are rendered. The default is infinity (in this case, fade distance is ignored).

Return value

Visibility distance for meshes in units.

virtual void setFadeDistance (float distance) const =0

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. Using fade distance allows the objects to disappear one by one until up to the fade distance only a few left. It makes the disappearing smooth and much less noticeable.

Arguments

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

virtual float getFadeDistance () const =0

Returns the distance up to which meshes handled by the mesh cluster will be fading out. The default is 0.

Return value

Fading distance for meshes in units.

virtual void setShadowRadius (float radius) const =0

Sets the distance to draw additional meshes outside the view frustum. Setting the shadow radius allows you to eliminate popping shadows at the edges of the screen when the camera turns. The shadow radius depends on the mesh size, how high meshes are positioned and also the angle of the global light (which determines how long the shadows from them would be). The longer shadows, the bigger shadow radius is required.

Arguments

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

virtual float getShadowRadius () const =0

Returns the distance to draw additional meshes outside the view frustum. The shadow radius depends on the mesh size, how high meshes are positioned and also the angle of the global light (which determines how long the shadows from them would be). The longer shadows, the bigger shadow radius is required.

Return value

Distance in units.

virtual int getNumMeshes () const =0

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

Return value

Number of meshes.

virtual mat4 getMeshTransform (int num) const =0

Returns the transformation of the given mesh instance.

Arguments

  • int num - Mesh instance number.

Return value

Mesh transformation matrix.

virtual void setMeshTransform (int num, const mat4 & transform) =0

Sets the transformation of the given mesh instance.

Arguments

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

virtual void createMeshes (const Vector< UNIGINE_MAT4 > & transforms) const =0

Creates mesh transformations vector, which is used to bake 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

  • const Vector< UNIGINE_MAT4 > & transforms - Transformations vector.

virtual void clearMeshes () const =0

Deletes all meshes from the mesh cluster.

virtual int getNumSurfaceTargets (int surface) const =0

Returns the number of surface targets.

Arguments

  • int surface - Surface number.

Return value

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 an surface target with a given name.

Arguments

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

Return value

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