This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Basics
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API Reference
Animations-Related Classes
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
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Unigine::ObjectMeshStatic Class

Header: #include <UnigineObjects.h>
Inherits from: Object

This class is used for handling static meshes.

A static mesh represents a non-deformable collection of vertices, edges, and triangles defining the object's geometry. By default, its geometry is fixed at runtime and can only be transformed as a whole (moved, rotated, scaled). However, ObjectMeshStatic supports optional procedural modes, which allows modifying or generating mesh data in runtime via code.

Const Meshes#

UNIGINE uses smart pointer types to manage procedural mesh data in ObjectMeshStatic and other related classes (ObjectGuiMesh, DecalMesh, ObjectMeshCluster, ObjectMeshClutter). In particular, the engine distinguishes between MeshPtr (a modifiable pointer to a mesh) and ConstMeshPtr (a pointer to a read-only mesh). Some methods, such as getMeshCurrentRAM(), return a ConstMeshPtr to ensure that the returned mesh cannot be modified directly.

This allows to expose mesh data for inspection while protecting it from unintended changes:

Source code (C++)
Ptr<ConstMesh> mesh = object->getMeshCurrentRAM();
mesh.addSurface("new_surface");				// Error! Cannot modify through ConstMeshPtr

Ptr<Mesh> editable_mesh = object->getMeshDynamicRAM();
editable_mesh.addSurface("new_surface"); 	// Success! Mesh modified

Procedural Mesh Workflow#

Static meshes support streaming, allowing geometry to be loaded from disk on demand to reduce memory usage. However, when procedural mode is enabled, streaming behavior changes depending on the selected mode, some modes keep all data in memory, while others allow disk-based access. These differences directly affect performance and memory consumption during runtime.

When using static meshes for procedural geometry, the typical workflow is:

  1. Create or Load a Mesh

    Begin by creating a mesh using the Mesh API or loading an existing one from disk. You can fully define geometry in code (vertices, indices, surfaces, etc.), or reuse prepared assets as input data.

  2. Bind the Mesh to the Object

    Assign the mesh to a static mesh using one of the available application methods (see below). At this stage, the mesh is not yet editable unless procedural mode is enabled.

  3. Enable Procedural Mode

    Call setMeshProceduralMode to enable runtime modification. Geometry cannot be modified unless one of the procedural modes is selected.

    Notice
    Each procedural mode has specific behavior regarding how geometry is stored and accesed (in RAM, VRAM, or file). See the PROCEDURAL_MODE descriptions for details on how each mode handles memory, streaming, and performance.
  4. Apply or Generate Geometry

    There are two main approaches to updating procedural mesh data:

    • Use Simplified Generation API

      For common procedural workflows, the runGenerateMeshProceduralAsync() and runGenerateMeshProceduralForce() methods allow you to schedule mesh generation via callbacks. The engine handles threading and timing internally. In your callback, you define how the geometry is built (e.g. populate Mesh and MeshRender), and the engine will apply it automatically.

    • Use Direct Application Methods

      You can also apply mesh data directly using a set of methods that differ by update strategy. All of them serve the same purpose: replace the current mesh with new data. The differences are encoded in the method names:

      • copy: Mesh data is copied into the object's internal memory.
      • move: Mesh data is transferred into the object using move semantics, without memory copying. This avoids the cost of copying operations and allows for faster updates.
      • force: The operation is executed immediately in the main thread. Useful for real-time updates when delay is unacceptable. In PROCEDURAL_MODE_DYNAMIC, forced move behaves identically to its asynchronous variant.
      • async: This avoids blocking the main thread and is especially useful in PROCEDURAL_MODE_FILE or PROCEDURAL_MODE_BLOB modes, where disk I/O or memory streaming can be offloaded.
      Notice
      If a method name contains one of these terms, it reflects how the mesh data is transferred and when the operation is performed.

      Choose the method that matches your needs, e.g. use applyCopyMeshProceduralForce() for an immediate copy, or applyMoveMeshProceduralAsync() to transfer data without blocking the main thread.

  5. Finalize for Collision and Intersection Support

    If the mesh is intended to participate in collision and intersection checks, you must explicitly call createCollisionData() after geometry modification is complete. That ensures that required internal data structures (such as edges and spatial tree) are generated and up-to-date.

See Also#

A set UnigineScript API samples located in the <UnigineSDK>/data/samples/objects/ folder:

ObjectMeshStatic Class

Enums

LIGHTMAP_QUALITY#

Lightmap baking quality preset to be used.
NameDescription
LIGHTMAP_QUALITY_GLOBAL = 0Global quality preset set in the Bake Lighting settings.
LIGHTMAP_QUALITY_DRAFT = 1Draft quality preset for lightmaps.
LIGHTMAP_QUALITY_LOW = 2Low quality preset for lightmaps.
LIGHTMAP_QUALITY_MEDIUM = 3Medium quality preset for lightmaps.
LIGHTMAP_QUALITY_HIGH = 4High quality preset for lightmaps.
LIGHTMAP_QUALITY_ULTRA = 5Ultra quality preset for lightmaps.

LIGHTMAP_MODE#

Lightmap mode defining the source of lightmap texture to be used.
NameDescription
LIGHTMAP_MODE_UNIQUE = 0Bake a unique lightmap texture for the surface.
LIGHTMAP_MODE_CUSTOM = 1Use a custom lightmap texture for the surface.
LIGHTMAP_MODE_SURFACE = 2Reuse an already baked lightmap texture from another surface. Can be used for LODs.

SURFACE_CUSTOM_TEXTURE_MODE#

Mode defining the source of surface custom texture to be used.
NameDescription
SURFACE_CUSTOM_TEXTURE_MODE_UNIQUE = 0Use a unique custom texture for the surface.
SURFACE_CUSTOM_TEXTURE_MODE_SURFACE = 1Use the custom texture from another surface. This option is intended for use with LODs having the same UV maps.

PROCEDURAL_MODE#

NameDescription
PROCEDURAL_MODE_DISABLE = 0Disables procedural mode. No procedural data is stored or managed.
PROCEDURAL_MODE_DYNAMIC = 1

This mode is optimized for high-speed dynamic modifications. Provides the fastest performance, but with the highest RAM and VRAM usage. Meshes are not automatically unloaded, manual memory cleanup is required using deleteDynamicMesh().

If a mesh is being streamed while modified, this may lead to a crash.

Notice
This mode is intended only for a small number of lightweight objects that are updated very frequently.
PROCEDURAL_MODE_FILE = 2

In this mode, procedural mesh data is stored as temporary files on disk. Each time a procedural mesh is modified, the corresponding file is updated. This allows the engine to unload both RAM and VRAM when needed, at the cost of slightly lower performance due to disk I/O operations.

Configuration is available through *.boot or Console, but only takes effect at engine startup:

  • mesh_procedural_path: defines the path where temporary procedural files are stored.
  • mesh_procedural_read_only: disables writing to disk.
Notice

Disabling procedural mode for a mesh will delete its corresponding file.

When multiple engine instances share the same mesh_procedural_path, one instance may delete files that are still in use by another.

PROCEDURAL_MODE_BLOB = 3In this mode, all procedural data is stored in memory as a temporary Blob. VRAM and RAM are loaded directly from this Blob, which the engine can unload when needed by itself. Modifications are faster compared to FILE mode, but at the cost of increased RAM usage. Rendered (visible) meshes are stored uncompressed for optimal performance, while non-visible meshes are compressed to save memory.

Members


static ObjectMeshStaticPtr create ( const char * path ) #

ObjectMeshStatic constructor. Creates a Static Mesh object with mesh loaded from the specified file.

Arguments

  • const char * path - Path to the source .mesh-file.

static ObjectMeshStaticPtr create ( ) #

ObjectMeshStatic constructor. Creates an empty Static Mesh object.

static int type ( ) #

Returns the type of the object.

Return value

Object Mesh Static type identifier.

void setMeshPath ( const char * path ) #

Sets the new path to the source mesh. Does not update mesh immediately using the new path. If the mesh is in the procedural mode, it will be reset.

Arguments

  • const char * path - Path to the source .mesh-file.

const char * getMeshPath ( ) const#

Returns the path to the current source mesh file.

Return value

Path to the source .mesh-file.

void setLightmapEnabled ( bool enabled, int surface ) #

Sets a value indicating if lightmapping is to be enabled for the surface with the specified number.

Arguments

  • bool enabled - true to enable lightmapping for the surface with the specified number, or false - to disable.
  • int surface - Mesh surface number.

bool isLightmapEnabled ( int surface ) const#

Returns a value indicating if lightmapping is enabled for the surface with the specified number.

Arguments

  • int surface - Mesh surface number.

Return value

true if lightmapping is enabled for the surface with the specified number;otherwise, false.

void setLightmapMode ( ObjectMeshStatic::LIGHTMAP_MODE mode, int surface ) #

Sets a new lightmap mode for the surface with the specified number.

Arguments

ObjectMeshStatic::LIGHTMAP_MODE getLightmapMode ( int surface ) const#

Returns the current lightmap mode for the surface with the specified number.

Arguments

  • int surface - Mesh surface number.

Return value

Current lightmap mode for the surface with the specified number. One of the LIGHTMAP_MODE values.

void setLightmapSourceSurface ( int source_surface, int surface ) #

Sets a new source mesh surface number for the surface with the specified number. A lightmap texture generated for the source mesh surface shall be used for the specified surface (available only when the lightmap mode for the surface is set to LIGHTMAP_MODE_SURFACE mode. This can be used as optimization for LODs.

Arguments

  • int source_surface - Source mesh surface number.
  • int surface - Mesh surface number.

int getLightmapSourceSurface ( int surface ) const#

Returns the current source mesh surface number for the surface with the specified number. A lightmap texture generated for the source mesh surface is used for the specified surface (available only when the lightmap mode for the surface is set to LIGHTMAP_MODE_SURFACE mode. This can be used as optimization for LODs.

Arguments

  • int surface - Mesh surface number.

Return value

Source mesh surface number.

bool isLightmapCompression ( int surface ) const#

Returns a value indicating if the lightmap texture baked for the surface with the specified number is to be compressed. Compressed lightmaps are lightweight, but please note that some compression artifacts may appear.

Arguments

  • int surface - Mesh surface number.

Return value

true if the lightmap texture baked for the surface with the specified number is to be compressed; otherwise, false.

void setLightmapCompression ( bool enabled, int surface ) #

Sets a value indicating if the lightmap texture baked for the surface with the specified number is to be compressed. Compressed lightmaps are lightweight, but please note that some compression artifacts may appear.

Arguments

  • bool enabled - true to enable compression for the lightmap texture baked for the surface with the specified number, or false - to disable.
  • int surface - Mesh surface number.

void setLightmapQuality ( ObjectMeshStatic::LIGHTMAP_QUALITY quality, int surface ) #

Sets a new lightmap baking quality preset for the surface with the specified number.

Arguments

ObjectMeshStatic::LIGHTMAP_QUALITY getLightmapQuality ( int surface ) const#

Returns the current lightmap baking quality preset for the surface with the specified number.

Arguments

  • int surface - Mesh surface number.

Return value

Current lightmap baking quality preset for the surface with the specified number. One of the LIGHTMAP_QUALITY values.

void setLightmapTextureFilePath ( const char * path, int surface ) #

Sets a new path to the baked lightmap texture file to be used for the surface with the specified number. You can use this method to specify a lightmap texture generated in a third-party software.

Arguments

  • const char * path - Path to the baked lightmap texture file to be used for the surface with the specified number.
  • int surface - Mesh surface number.

String getLightmapTextureFilePath ( int surface ) const#

Returns the path to the baked lightmap texture file currently used for the surface with the specified number.

Arguments

  • int surface - Mesh surface number.

Return value

Path to the baked lightmap texture file currently used for the surface with the specified number.

void setSurfaceCustomTextureEnabled ( bool enabled, int surface ) #

Sets a value indicating if a custom texture is to be used for the surface with the specified number.

Arguments

  • bool enabled - true to enable using the custom texture for the surface with the specified number, or false - to disable.
  • int surface - Mesh surface number.

bool isSurfaceCustomTextureEnabled ( int surface ) const#

Returns a value indicating if a custom texture is to be used for the surface with the specified number.

Arguments

  • int surface - Mesh surface number.

Return value

true if a custom texture is to be used for the surface with the specified number; otherwise, false.

void setSurfaceCustomTextureMode ( ObjectMeshStatic::SURFACE_CUSTOM_TEXTURE_MODE mode, int surface ) #

Sets a new mode for the custom texture of the surface with the specified number. This mode defines the source of the custom texture for the surface: either use a unique custom texture, or use a custom texture that is assigned to another surface of the mesh.

Arguments

ObjectMeshStatic::SURFACE_CUSTOM_TEXTURE_MODE getSurfaceCustomTextureMode ( int surface ) const#

Returns the current mode for the custom texture of the surface with the specified number. This mode defines the source of the custom texture for the surface: either use a unique custom texture, or use a custom texture that is assigned to another surface of the mesh.

Arguments

  • int surface - Mesh surface number.

Return value

Current custom texture mode for the surface with the specified number. One of the SURFACE_CUSTOM_TEXTURE_MODE_ values.

void setSurfaceCustomTextureSourceSurface ( int source_surface, int surface ) #

Sets a new source mesh surface number for the surface with the specified number. A custom texture generated for the source mesh surface shall be used for the specified surface (available only when the custom texture mode for the surface is set to SURFACE_CUSTOM_TEXTURE_MODE_SURFACE. This can be used as optimization for LODs.

Arguments

  • int source_surface - Source mesh surface number.
  • int surface - Mesh surface number.

int getSurfaceCustomTextureSourceSurface ( int surface ) const#

Returns the current source mesh surface number for the surface with the specified number. A custom texture generated for the source mesh surface is used for the specified surface (available only when the custom texture mode for the surface is set to SURFACE_CUSTOM_TEXTURE_MODE_SURFACE. This can be used as optimization for LODs.

Arguments

  • int surface - Mesh surface number.

Return value

Source mesh surface number.

void setSurfaceCustomTexturePath ( const char * path, int surface ) #

Sets a new path to the custom texture to be used for the surface with the specified number. You can use this method to specify a texture generated in a third-party software.

Arguments

  • const char * path - Path to the custom texture to be assigned to the surface with the specified number.
  • int surface - Mesh surface number.

const char * getSurfaceCustomTexturePath ( int surface ) const#

Returns the path to the custom texture currently assigned to the surface with the specified index.

Arguments

  • int surface - Mesh surface number.

Return value

Path to the custom texture currently assigned to the surface with the specified number.

void setSurfaceCustomTexture ( const Ptr<Texture> & texture, int surface ) #

Sets a new texture to be used as a custom texture for the surface with the specified number. You can use this method to set any texture.

Arguments

  • const Ptr<Texture> & texture - Texture to be set.
  • int surface - Mesh surface number.

Ptr<Texture> getSurfaceCustomTexture ( int surface ) const#

Returns the texture currently used as a custom texture for the surface with the specified number.

Arguments

  • int surface - Mesh surface number.

Return value

Texture used as a custom texture for the specified surface.

Ptr<ConstMesh> getMeshCurrentRAM ( ) const#

Returns the current source mesh used for the object and loaded to memory (RAM).

Return value

A current source mesh used for the object.

Ptr<MeshRender> getMeshCurrentVRAM ( ) #

Returns the current source mesh used for the object and loaded to video memory (VRAM).

Return value

A current render mesh used for the object.

Ptr<ConstMesh> getMeshForceRAM ( ) #

Returns the source mesh used for the object and loads it to memory (RAM) immediately.

Return value

A source mesh used for the object.

Ptr<MeshRender> getMeshForceVRAM ( ) #

Returns the render mesh used for the object and loads it to video memory (VRAM) immediately. At that, the static mesh will also be loaded to memory (RAM).
Notice
Loading to VRAM must be performed in the main thread only.

Return value

A render mesh used for the object.

Ptr<ConstMesh> getMeshAsyncRAM ( ) #

Returns the source mesh used for the object and loads it to memory (RAM) asynchronously.

Return value

A source mesh used for the object.

Ptr<MeshRender> getMeshAsyncVRAM ( ) #

Returns the render mesh used for the object and loads it to video memory (VRAM) asynchronously. At that, the static mesh will also be loaded to memory (RAM).
Notice
Loading to VRAM must be performed in the main thread only.

Return value

A render mesh used for the object.

Ptr<Mesh> getMeshDynamicRAM ( ) #

Returns the procedural source mesh associated with the object and ensures it is loaded into system memory (RAM). This method is only available when the mesh is in the dynamic (PROCEDURAL_MODE_DYNAMIC) mode. A procedural mesh is a mesh created via code and uses a specific streaming mode. In dynamic mode, the object constantly remains in memory after creation and is only unloaded manually using deleteDynamicMesh() or when the procedural mode is changed.
Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Return value

A procedural source mesh used for the object.

Ptr<MeshRender> getMeshDynamicVRAM ( ) #

Returns the procedural render mesh associated with the object and ensures it is loaded into video memory (VRAM). This method is only available when the mesh is in the dynamic (PROCEDURAL_MODE_DYNAMIC) mode. A procedural mesh is a mesh created via code and uses a specific streaming mode. In dynamic mode, the object constantly remains in memory after creation and is only unloaded manually using deleteDynamicMesh() or when the procedural mode is changed.
Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Return value

A procedural render mesh used for the object.

bool loadAsyncVRAM ( ) #

Asynchronously loads the mesh to video memory (VRAM) if the async streaming mode for meshes is enabled. Otherwise, the forced loading is performed. This method is recommended for implementing your own prefetch system (i.e. asynchronous pre-loading of meshes to video memory before they are used).
Notice
Loading to VRAM must be performed in the main thread only.

Return value

true if the mesh is loaded successfully, otherwise false. If the mesh is already loaded to VRAM, true will be returned.

bool loadAsyncRAM ( ) #

Asynchronously loads the mesh to memory (RAM) if the async streaming mode for meshes is enabled. Otherwise, the forced loading is performed. This method is recommended for implementing your own prefetch system (i.e. asynchronous pre-loading of meshes to memory before they are used).

Return value

true if the mesh is loaded successfully, otherwise false. If the mesh is already loaded to RAM, true will be returned.

bool loadForceVRAM ( ) #

Performs force-loading of the mesh to video memory (VRAM) immediately.
Notice
Loading to VRAM must be performed in the main thread only.

Return value

true if the mesh is loaded successfully, otherwise false. If the mesh is already loaded to VRAM, true will be returned.

bool loadForceRAM ( ) #

Performs force-loading of the mesh to memory (RAM) immediately.

Return value

true if the mesh is loaded successfully, otherwise false. If the mesh is already loaded to RAM, true will be returned.

void setMeshProceduralMode ( ObjectMeshStatic::PROCEDURAL_MODE mode, int mesh_render_flags = 0 ) #

Sets the procedural mode for the mesh. The specified mode defines how procedural data is stored, updated, and unloaded.
Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Arguments

ObjectMeshStatic::PROCEDURAL_MODE getMeshProceduralMode ( ) const#

Returns a value indicating which procedural mode assigned to the mesh. The value corresponds to one of the available PROCEDURAL_MODE types, determining how procedural data is stored, updated, and unloaded.
Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Return value

Current procedural mode of the mesh.

bool isMeshNull ( ) const#

Returns a value indicating if the source mesh used for the object is null (does not exist, unassigned, not loaded, etc.).

Return value

true if the source mesh used for the object is null; otherwise, false.

bool isMeshLoadedRAM ( ) const#

Returns a value indicating if the source mesh used for the object is loaded to memory (RAM).

Return value

true if the source mesh used for the object is loaded to RAM; otherwise, false.

bool isMeshLoadedVRAM ( ) const#

Returns a value indicating if the source mesh used for the object is loaded to video memory (VRAM).

Return value

true if the source mesh used for the object is loaded to VRAM; otherwise, false.

Ptr<Mesh> createCopyMeshRAM ( ) const#

Creates and returns a copy of the source mesh used by the object, loading it directly from disk if it is not present in cache. This method does not stream the copied mesh into memory cache, resulting in lower RAM usage.

Return value

A copy of the source mesh, or nullptr if source mesh is not presented in RAM or its file path is invalid.

bool getCopyMeshRAM ( Ptr<Mesh> & result ) const#

Retrieves a copy of the source mesh used by the object and writes it to the provided mesh object. If the mesh is not present in cache, it is loaded directly from disk. This method does not stream the copied mesh into memory cache, resulting in lower RAM usage.

Arguments

  • Ptr<Mesh> & result - Object that will receive a copy of the source mesh.

Return value

true if the mesh was copied successfully, false if source mesh is not present in RAM or its file path is invalid.

bool isMeshProceduralDone ( ) const#

Returns a value indicating if all asynchronous operations on the procedural mesh have completed.
Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Return value

true if no asynchronous geometry operation is active, otherwise false.

bool isMeshProceduralActive ( ) const#

Returns a value indicating if an asynchronous operation on the procedural mesh is currently in progress.
Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Return value

true if an asynchronous geometry operation is active, otherwise false.

bool isMeshProceduralDynamic ( ) const#

Returns a value indicating if the current procedural mode is PROCEDURAL_MODE_DYNAMIC.
Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Return value

true if PROCEDURAL_MODE_DYNAMIC is active, otherwise false.

bool applyCopyMeshProceduralForce ( const Ptr<ConstMesh> & mesh, int mesh_render_flags = 0 ) #

Copies all vertex data from the given mesh into the object's procedural mesh forcibly, executing the operation immediately. Works only when procedural mode is enabled.

Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Arguments

Return value

true if the mesh was copied successfully, otherwise false.

bool applyMoveMeshProceduralForce ( const Ptr<Mesh> & mesh, int mesh_render_flags = 0 ) #

Moves all vertex data from the given mesh into the object's procedural mesh forcibly, executing the operation immediately without memory allocation and data copying (move semantics). Works only when procedural mode is enabled.

In PROCEDURAL_MODE_DYNAMIC, this method behaves identically to its asynchronous variant.

Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Arguments

Return value

true if the mesh was moved (transferred without copying) successfully, otherwise false.

bool applyMoveMeshProceduralForce ( const Ptr<Mesh> & mesh_ram, const Ptr<MeshRender> & mesh_vram ) #

Moves all vertex and render data from the given mesh_ram and mesh_vram into the object's procedural mesh forcibly, executing the operation immediately using move semantics, without data copying or VRAM allocation. Works only when procedural mode is enabled.

Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Arguments

  • const Ptr<Mesh> & mesh_ram - Source mesh containing vertex data.
  • const Ptr<MeshRender> & mesh_vram - Source mesh containing render data.

Return value

true if the data was moved (transferred without copying) successfully, otherwise false.

bool applyCopyMeshProceduralAsync ( const Ptr<ConstMesh> & mesh, int mesh_render_flags = 0 ) #

Copies all vertex data from the given mesh into the object's procedural mesh asynchronously. The operation is not forced and is executed in the background with no noticeable delay. Works only when procedural mode is enabled.

In PROCEDURAL_MODE_FILE and PROCEDURAL_MODE_BLOB, this method performs faster compared to the forced variant, as file writes and memory operations are offloaded to background threads.

Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Arguments

Return value

true if the mesh was copied successfully, otherwise false.

bool applyMoveMeshProceduralAsync ( const Ptr<Mesh> & mesh, int mesh_render_flags = 0 ) #

Moves all vertex data from the given mesh into the object's procedural mesh asynchronously. The operation is not forced and is executed in the background with no noticeable delay, without memory allocation and data copying (move semantics). Works only when procedural mode is enabled.

In PROCEDURAL_MODE_FILE and PROCEDURAL_MODE_BLOB, this method performs faster compared to the forced variant, as file writes and memory operations are offloaded to background threads.

Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Arguments

bool applyMoveMeshProceduralAsync ( const Ptr<Mesh> & mesh_ram, const Ptr<MeshRender> & mesh_vram ) #

Moves all vertex and render data from the given mesh_ram and mesh_vram into the object's procedural mesh asynchronously, without copying or allocating VRAM. The operation is not forced and is executed in the background with no noticeable delay. Works only when procedural mode is enabled.

In PROCEDURAL_MODE_FILE and PROCEDURAL_MODE_BLOB, this method performs faster, as file writes and memory operations are offloaded to background threads.

In PROCEDURAL_MODE_DYNAMIC, this method behaves identically to its forced variant.

Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Arguments

  • const Ptr<Mesh> & mesh_ram - Source mesh containing vertex data.
  • const Ptr<MeshRender> & mesh_vram - Source mesh containing render data.

Return value

true if the data was moved successfully, otherwise false.

bool deleteDynamicMesh ( ) #

Releases all memory used by the procedural mesh, including both VRAM and RAM. Works only when procedural mode is set to PROCEDURAL_MODE_DYNAMIC.

Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Return value

true if the memory was released successfully, otherwise false.

bool runGenerateMeshProceduralAsync ( CallbackBase1<Ptr<Mesh>> * callback_generate, int mesh_render_flags = 0 ) #

Starts asynchronous generation of procedural mesh data. The callback_generate function is executed in a background thread and must create and fill a mesh object with new data. The generated mesh will be transferred to the object once complete, without blocking the main thread. Works only when procedural mode is enabled.

Note that the callback is executed in a single dedicated thread controlled by the engine, it is not parallelized and must not spawn additional threads.

Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Arguments

  • CallbackBase1<Ptr<Mesh>> * callback_generate - Callback function responsible for creating and filling the source mesh. Executed in the main thread.

    The function must be wrapped using MakeCallback() and have the following signature:

    void callback_generate(Ptr<Mesh> mesh)
  • int mesh_render_flags - Optional usage flags for MeshRender.

Return value

true if the modification was completed and applied successfully, otherwise false

bool runGenerateMeshProceduralAsync ( CallbackBase1<Ptr<Mesh>> * callback_generate, CallbackBase * callback_done, int mesh_render_flags = 0 ) #

Starts asynchronous generation of procedural mesh data. The callback_generate function is executed in a background thread and must create and fill a mesh object with new data. The generated mesh will be transferred to the object once complete, without blocking the main thread. After the mesh has been applied to the object, the optional callback_done will be called. Works only when procedural mode is enabled.

Note that the callback is executed in a single dedicated thread controlled by the engine, it is not parallelized and must not spawn additional threads.

Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Arguments

  • CallbackBase1<Ptr<Mesh>> * callback_generate - Callback function responsible for creating and filling the source mesh. Executed in the main thread.

    The function must be wrapped using MakeCallback() and have the following signature:

    void callback_generate(Ptr<Mesh> mesh)
  • CallbackBase * callback_done - Optional callback executed after geometry has been fully applied.

    The function must be wrapped using MakeCallback() and have the following signature:

    void callback_done()
  • int mesh_render_flags - Optional usage flags for MeshRender.

Return value

true if the generation was completed and applied successfully, otherwise false

bool runGenerateMeshProceduralForce ( CallbackBase1<Ptr<Mesh>> * callback_generate, int mesh_render_flags = 0 ) #

Starts immediate (forced) generation of procedural mesh data. The callback_generate function is executed in the main thread and must create and fill a mesh object with new data. The generated mesh is applied to the object as soon as generation completes. Works only when procedural mode is enabled.

Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Arguments

  • CallbackBase1<Ptr<Mesh>> * callback_generate - Callback function responsible for creating and filling the source mesh. Executed in the main thread.

    The function must be wrapped using MakeCallback() and have the following signature:

    void callback_generate(Ptr<Mesh> mesh)
  • int mesh_render_flags - Optional usage flags for MeshRender.

Return value

true if the generation was completed and applied successfully, otherwise false

bool runGenerateMeshProceduralForce ( CallbackBase1<Ptr<Mesh>> * callback_generate, CallbackBase * callback_done, int mesh_render_flags = 0 ) #

Starts immediate (forced) generation of procedural mesh data. The callback_generate function is executed in the main thread and must create and fill a Mesh object with vertex data. Once the mesh is applied to the object, the optional callback_done is called on the main thread. Works only when procedural mode is enabled.

Notice

Please note that procedural mesh modification directly affects streaming and memory usage (RAM, VRAM, and disk) depending on the selected procedural mode. For details, see the Procedural Mesh Workflow section.

Arguments

  • CallbackBase1<Ptr<Mesh>> * callback_generate - Callback function responsible for creating and filling the source mesh. Executed in the main thread.

    The function must be wrapped using MakeCallback() and have the following signature:

    void callback_generate(Ptr<Mesh> mesh)
  • CallbackBase * callback_done - Optional callback executed after geometry has been fully applied.

    The function must be wrapped using MakeCallback() and have the following signature:

    void callback_done()
  • int mesh_render_flags - Optional usage flags for MeshRender.

Return value

true if the generation was completed and applied successfully, otherwise false

The information on this page is valid for UNIGINE 2.20 SDK.

Last update: 2025-06-30
Build: ()