This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
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
创建内容
内容优化
材质
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.

See Also#

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

ObjectMeshStatic Class

枚举

LIGHTMAP_QUALITY#

Lightmap baking quality preset to be used.
Name描述
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.
Name描述
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.
Name描述
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.

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.

bool applyMeshProcedural ( const Ptr<Mesh> & mesh ) #

Sets the specified mesh as the source mesh for the object. The object must be in the procedural mesh mode.
Source code (C++)
ObjectMeshStaticPtr my_static_mesh;
// ...

// switch the object to procedural mesh mode
my_static_mesh->setMeshProceduralMode(true);

// update the source mesh of the "my_static_mesh" object via the source_mesh instance
my_static_mesh->applyMeshProcedural(source_mesh);

Arguments

  • const Ptr<Mesh> & mesh - Mesh to be applied.

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<Mesh> getMeshCurrentRAM ( ) #

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<Mesh> 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<Mesh> 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> getMeshProceduralRAM ( ) #

Returns the procedural source mesh used for the object and loads it to memory (RAM) using the specific streaming mode for procedural meshes. A procedural mesh is a mesh created via code, such meshes have a specific streaming mode — they are always kept in memory after creation and never unloaded until the object is destroyed via code or the mesh returns to its normal mode (streaming from a source file). Changing of the static mesh is possible only if it is in the procedural mode.

Return value

A procedural source mesh used for the object.

Ptr<MeshRender> getMeshProceduralVRAM ( ) #

Returns the procedural render mesh used for the object and loads it to video memory (VRAM) using the specific streaming mode for procedural meshes. A procedural mesh is a mesh created via code, such meshes have a specific streaming mode — they are always kept in memory after creation and never unloaded until the object is destroyed via code or the mesh returns to its normal mode (streaming from a source file). Changing of the static mesh is possible only if it is in the procedural mode.

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.

bool asyncCalculateNodes ( int surface ) #

Asynchronously calculates the mesh surface internal spatial tree used for quick calculation of collisions and intersections. This method is recommended for implementing your own prefetch system (i.e. asynchronous pre-loading of meshes to memory before they are used).

Arguments

  • int surface - Mesh surface number.

Return value

true if the internal tree is calculated successfully; otherwise, false.

bool asyncCalculateEdges ( int surface ) #

Asynchronously calculates the edges of the mesh surface geometry. This method is recommended for implementing your own prefetch system (i.e. asynchronous pre-loading of meshes to memory before they are used).

Arguments

  • int surface - Mesh surface number.

Return value

true if the edges are calculated successfully; otherwise, false.

void setMeshProceduralMode ( bool meshproceduralmode ) #

Sets a value indicating if the source mesh used for the object is procedural. A procedural mesh is a mesh created via code, such meshes have a specific streaming mode - they are always kept in memory after creation and never unloaded until the object is destroyed via code or the mesh returns to its normal mode (streaming from a source file). Changing of the static mesh is possible only if it is in the procedural mode.

Arguments

  • bool meshproceduralmode - true to switch the source mesh used for the object to procedural mode; otherwise, false - normal mode (the source mesh is streamed from a source file).

bool isMeshProceduralMode ( ) const#

Returns a value indicating if the source mesh used for the object is procedural. A procedural mesh is a mesh created via code, such meshes have a specific streaming mode - they are always kept in memory after creation and never unloaded until the object is destroyed via code or the mesh returns to its normal mode (streaming from a source file). Changing of the static mesh is possible only if it is in the procedural mode.

Return value

true if the source mesh used for the object is procedural; otherwise, false - normal mode (the source mesh is streamed from a source file).

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.
Last update: 2024-09-03
Build: ()