Unigine.ObjectMeshStatic Class
Inherits from: | Object |
ObjectMeshStatic Class
Enums
LIGHTMAP_QUALITY#
Lightmap baking quality preset to be used.Name | Description |
---|---|
GLOBAL = 0 | Global quality preset set in the Bake Lighting settings. |
DRAFT = 1 | Draft quality preset for lightmaps. |
LOW = 2 | Low quality preset for lightmaps. |
MEDIUM = 3 | Medium quality preset for lightmaps. |
HIGH = 4 | High quality preset for lightmaps. |
ULTRA = 5 | Ultra quality preset for lightmaps. |
LIGHTMAP_MODE#
Lightmap mode defining the source of lightmap texture to be used.SURFACE_CUSTOM_TEXTURE_MODE#
Mode defining the source of surface custom texture to be used.Name | Description |
---|---|
UNIQUE = 0 | Use a unique custom texture for the surface. |
SURFACE = 1 | Use the custom texture from another surface. This option is intended for use with LODs having the same UV maps. |
Properties
string MeshName#
The name of the current mesh.
Members
ObjectMeshStatic ( Mesh mesh ) #
ObjectMeshStatic constructor. Creates a new mesh object from a given file.Arguments
- Mesh mesh - A mesh smart pointer.
ObjectMeshStatic ( string path, bool unique = 0 ) #
ObjectMeshStatic constructor. Creates a new mesh object from a given file.Arguments
- string path - Path to the mesh file.
- bool 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 true (1), so a copy of the mesh geometry will be created and changes won't be applied.
void SetCIndex ( int num, int index, int surface ) #
Sets the new coordinate index for the given vertex of the given surface.Arguments
- int num - Vertex number in the range from 0 to the total number of coordinate indices for the given surface.
To get the total number of coordinate indices for the given surface, use the getNumCIndices() method.
- int index - Coordinate index to be set in the range from 0 to the total number of coordinate vertices for the given surface.
To get the total number of coordinate vertices for the given surface, use the getNumVertex() method.
- int surface - Mesh surface number.
int GetCIndex ( int num, int surface ) #
Returns the coordinate index for the given vertex of the given surface.Arguments
- int num - Vertex number in the range from 0 to the total number of coordinate indices for the given surface.
To get the total number of coordinate indices for the given surface, use the getNumCIndices() method.
- int surface - Mesh surface number.
Return value
Coordinate index.void SetColor ( int num, vec4 color, int surface ) #
Sets the color for the given triangle vertex of the given surface.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of vertex color entries of the given surface.
To get the total number of vertex color entries for the surface, call the getNumColors() method.
- vec4 color - Vertex color to be set.
- int surface - Mesh surface number.
vec4 GetColor ( int num, int surface ) #
Returns the color of the given triangle vertex of the given surface.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of vertex color entries of the given surface.
To get the total number of vertex color entries for the surface, call the getNumColors() method.
- int surface - Mesh surface number.
Return value
Vertex color.bool GetMesh ( Mesh mesh ) #
Copies the current mesh into the destination mesh. For example, you can obtain geometry of the static mesh and then change it:// a static mesh from which geometry will be obtained
ObjectMeshStatic staticMesh = new ObjectMeshStatic("box.mesh");
// create a new mesh
Mesh mesh = new Mesh();
// copy geometry to the created mesh
if (staticMesh.getMesh(mesh) == 1) {
// do something with the obtained mesh
}
else {
Log.Error("Failed to copy a mesh\n");
}
Arguments
- Mesh mesh - Destination mesh.
Return value
true if the mesh is copied successfully; otherwise, false.bool SetMesh ( Mesh mesh, bool unique = true ) #
Copies a given source mesh into the current mesh. For example, you can copy a mesh into another one as follows:// create ObjectMeshStatic instances
ObjectMeshStatic staticMesh = new ObjectMeshStatic("box.mesh");
ObjectMeshStatic staticMesh_2 = new ObjectMeshStatic("capsule.mesh");
// create a Mesh instance
Mesh firstMesh = new Mesh();
// get the mesh of the ObjectMeshStatic and copy it to the Mesh class instance
staticMesh.getMesh(firstMesh);
// put the firstMesh mesh to the staticMesh_2 instance
staticMesh_2.setMesh(firstMesh);
Arguments
- Mesh mesh - Source mesh to be copied.
- bool unique - Unique flag used when you create several objects out of a single Mesh instance :
- false (0) - An instance of source mesh geometry is created. If the source geometry is changed at runtime, its instances will be changed as well.
- true (1) - A copy of source mesh geometry is created and changes made to the source geometry do not affect the mesh.
Return value
true if the mesh is copied successfully; otherwise, false.void SetMeshNameForce ( string path ) #
Sets the new path to the mesh and forces mesh creation using the new path. The new mesh is created from the specified path immediately with the unique flag set to 0.Arguments
- string path - Path to the mesh file.
int GetMeshSurface ( Mesh mesh, int surface, int target = -1 ) #
Copies the specified mesh surface into the destination mesh.Arguments
- Mesh mesh - Destination mesh to copy the surface into.
- int surface - Number of the mesh surface to be copied.
- int target - Number of the surface target to be copied. The default value is -1 (all targets).
Return value
Number of the added mesh surface.vec3 GetNormal ( int num, int surface, int target = 0 ) #
Returns the normal for the given triangle vertex of the given surface target.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of vertex tangent entries of the given surface target.
Vertex normals are calculated using vertex tangents. To get the total number of vertex tangent entries for the surface target, call the getNumTangents() method.
- int surface - Mesh surface number.
- int target - Surface target number. The default value is 0.
Return value
Vertex normal.int GetNumCIndices ( int surface ) #
Returns the number of coordinate indices for the given mesh surface.Arguments
- int surface - Mesh surface number.
Return value
Number of coordinate indices.int GetNumColors ( int surface ) #
Returns the total number of vertex color entries for the given surface.Colors are specified for triangle vertices.
Arguments
- int surface - Surface number.
Return value
Number of vertex color entries.int GetNumSurfaceTargets ( int surface ) #
Returns the number of surface targets for the given mesh surface.Arguments
- int surface - Mesh surface number.
Return value
Number of surface targets.int GetNumTangents ( int surface ) #
Returns the number of vertex tangent entries of the given mesh surface.Tangents are specified for triangle vertices.
Arguments
- int surface - Mesh surface number.
Return value
Number of surface tangent vectors.void SetNumTexCoords0 ( int num, int surface ) #
Sets the number of the first UV map texture coordinates for the given mesh surface.First UV map texture coordinates are specified for triangle vertices.
Arguments
- int num - Number of the first UV map texture coordinates to be set.
- int surface - Mesh surface number.
int GetNumTexCoords0 ( int surface ) #
Returns the number of the first UV map texture coordinates for the given mesh surface.First UV map texture coordinates are specified for triangle vertices.
Arguments
- int surface - Mesh surface number.
Return value
Number of the first UV map texture coordinates.void SetNumTexCoords1 ( int num, int surface ) #
Sets the number of the second UV map texture coordinates for the given mesh surface.Second UV map texture coordinates are specified for triangle vertices.
Arguments
- int num - Number of the second UV map texture coordinates to be set.
- int surface - Mesh surface number.
int GetNumTexCoords1 ( int surface ) #
Returns the number of the second UV map texture coordinates for the given mesh surface.Second UV map texture coordinates are specified for triangle vertices.
Arguments
- int surface - Mesh surface number.
Return value
Number of the second UV map texture coordinates.int GetNumTIndices ( int surface ) #
Returns the number of triangle indices for the given mesh surface.Arguments
- int surface - Mesh surface number.
Return value
Number of triangle indices.int GetNumVertex ( int surface ) #
Returns the number of coordinate vertices for the given mesh surface.Arguments
- int surface - Mesh surface number.
Return value
Number of the surface vertices.string GetSurfaceTargetName ( int surface, int target ) #
Returns the name of the target for the given mesh surface by the target number.Arguments
- int surface - Mesh surface number.
- int target - Number of the surface target.
Return value
Surface target name.void SetSurfaceTransform ( mat4 transform, int surface, int target = -1 ) #
Updates the transformation of the specified mesh surface.Arguments
- mat4 transform - Transformation matrix.
- int surface - Mesh surface number.
- int target - Number of the surface target. The default value is -1 (all targets).
void SetTangent ( int num, quat tangent, int surface, int target = 0 ) #
Sets the new tangent for the given triangle vertex of the given surface target.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of vertex tangent entries of the given surface.
To get the total number of vertex tangent entries for the surface, call the getNumTangents() method.
- quat tangent - Tangent to be set.
- int surface - Mesh surface number.
- int target - Surface target number. The default value is 0.
quat GetTangent ( int num, int surface, int target = 0 ) #
Returns the tangent for the given triangle vertex of the given surface target.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of vertex tangent entries of the given surface.
To get the total number of vertex tangent entries for the surface, call the getNumTangents() method.
- int surface - Mesh surface number.
- int target - Surface target number. The default value is 0.
Return value
Vertex tangent.void SetTexCoord0 ( int num, vec2 texcoord, int surface ) #
Sets first UV map texture coordinates for the given triangle vertex of the given surface.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of first UV map texture coordinate entries of the given surface.
To get the total number of first UV map texture coordinate entries for the surface, call the getNumTexCoords0() method.
- vec2 texcoord - First UV map texture coordinates to be set.
- int surface - Mesh surface number.
vec2 GetTexCoord0 ( int num, int surface ) #
Returns first UV map texture coordinates for the given triangle vertex of the given surface.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of first UV map texture coordinate entries of the given surface.
To get the total number of first UV map texture coordinate entries for the surface, call the getNumTexCoords0() method.
- int surface - Mesh surface number.
Return value
First UV map texture coordinates.void SetTexCoord1 ( int num, vec2 texcoord, int surface ) #
Sets second UV map texture coordinates for the given triangle vertex of the given surface.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of second UV map texture coordinate entries of the given surface.
To get the total number of second UV map texture coordinate entries for the surface, call the getNumTexCoords1() method.
- vec2 texcoord - Second UV map texture coordinates to be set.
- int surface - Mesh surface number.
vec2 GetTexCoord1 ( int num, int surface ) #
Returns second UV map texture coordinates for the given triangle vertex of the given surface.Arguments
- int num - Triangle vertex number in the range from 0 to the total number of second UV map texture coordinate entries of the given surface.
To get the total number of second UV map texture coordinate entries for the surface, call the getNumTexCoords1() method.
- int surface - Mesh surface number.
Return value
Second UV map texture coordinates.void SetTIndex ( int num, int index, int surface ) #
Sets the new triangle index for the given vertex of the given surface.Arguments
- int num - Vertex number in the range from 0 to the total number of triangle indices for the given surface.
- int index - Triangle index to be set in the range from 0 to the total number of triangle vertices for the given surface.
- int surface - Mesh surface number.
int GetTIndex ( int num, int surface ) #
Returns the triangle index for the given surface by using the index number.Arguments
- int num - Vertex number in the range from 0 to the total number of triangle indices for the given surface.
- int surface - Mesh surface number.
Return value
Triangle index.void SetVertex ( int num, vec3 vertex, int surface, int target = 0 ) #
Sets the coordinates of the given coordinate vertex of the given surface target.Arguments
- int num - Coordinate vertex number in the range from 0 to the total number of coordinate vertices for the given surface.
To get the total number of coordinate vertices for the given surface, use the getNumCVertex() method.
- vec3 vertex - Vertex coordinates to be set.
- int surface - Mesh surface number.
- int target - Surface target number. The default value is 0.
vec3 GetVertex ( int num, int surface, int target = 0 ) #
Returns coordinates of the given coordinate vertex of the given surface target.Arguments
- int num - Coordinate vertex number in the range from 0 to the total number of coordinate vertices for the given surface.
To get the total number of coordinate vertices for the given surface, use the getNumCVertex() method.
- int surface - Mesh surface number.
- int target - Surface target number. The default value is 0.
Return value
Vertex coordinates.int AddEmptySurface ( string name, int num_vertex, int num_indices ) #
Appends a new empty surface to the current mesh.Arguments
- string name - The name of the new surface.
- int num_vertex - Number of the new surface vertices.
- int num_indices - Number of the new surface indices.
Return value
Number of the appended surface.int AddMeshSurface ( int dest_surface, ObjectMeshStatic mesh, int surface, int target = -1 ) #
Appends a new mesh surface to the current mesh.Arguments
- int dest_surface - Number of the surface to copy the mesh to.
- ObjectMeshStatic mesh - Source ObjectMeshStatic to copy a surface from.
- int surface - Mesh surface number to copy.
- int target - Mesh target number to copy. The default value is -1 (all targets).
Return value
Number of the last added surface.int AddMeshSurface ( string name, Mesh mesh, int surface, int target = -1 ) #
Appends a new mesh surface to the current mesh.Arguments
- string name - Name of the new surface of the current mesh.
- Mesh mesh - Mesh pointer to copy a surface from.
- int surface - Mesh surface number to copy.
- int target - Mesh target number to copy. The default value is -1 (all targets).
Return value
Number of the last added surface.int AddMeshSurface ( string name, ObjectMeshStatic mesh, int surface, int target = -1 ) #
Appends a new mesh surface to the current mesh.Arguments
- string name - Name of the new surface of the current mesh.
- ObjectMeshStatic mesh - Mesh pointer to copy a surface from.
- int surface - Mesh surface number to copy.
- int target - Mesh target number to copy. The default value is -1 (all targets).
Return value
Number of the last added surface.int AddSurfaceTarget ( int surface, string name = 0 ) #
Adds a new target to the specified surface of the current mesh.Arguments
- int surface - The number of the surface, to which the target will be appended.
- string name - The name of the new target.
Return value
Number of the added target.bool CreateMesh ( string path, bool unique = 0 ) #
Creates the static mesh with the specified parameters.Arguments
- string path - Path to the mesh file.
- bool unique - Unique flag used when you create several objects out of a single .mesh file :
- false (0) - An instance of source mesh geometry is created. If the source geometry is changed at runtime, its instances will be changed as well.
- true (1) - A copy of source mesh geometry is created and changes made to the source geometry do not affect the mesh.
Return value
true if the mesh is created successfully; otherwise - false.int FindSurfaceTarget ( string name, int surface ) #
Searches for the target number by the target name.Arguments
- string name - The name of the target.
- int surface - Mesh surface number.
Return value
Target number if it is exists; otherwise, -1.void FlushMesh ( ) #
Flushes the mesh geometry into the video memory.bool LoadMesh ( string path ) #
Loads the mesh for the current mesh from the .mesh file. This function doesn't change the mesh name.Arguments
- string path - Path to the .mesh file.
Return value
true if the mesh is loaded successfully; otherwise, false.bool SaveMesh ( string path ) #
Saves the mesh to the .mesh format.Before saving the mesh to a file, you should set a name for it via the setMeshName() method.
// setting mesh name from the desired path
UGUID guid = FileSystem.get().getGUID(path);
object_mesh_static.setMeshName(guid.getFileSystemString());
// saving the mesh to the desired path
object_mesh_static.saveMesh(path);
Arguments
- string path - Path to the file, to which the mesh is to be saved.
Return value
true if the mesh is saved successfully; otherwise, false.static int type ( ) #
Returns the type of the node.Return value
Node type identifier.void UpdateSurfaceBounds ( int surface = -1 ) #
Updates mesh bounds. This method is to be called to recalculate bounds after changing a mesh surface (e.g. modifying positions of coordinate vertices).Arguments
- int surface - Surface number (use -1 for all surfaces).
MeshStatic GetMeshStatic ( ) #
Returns a MeshStatic class instance for the object.Return value
MeshStatic class instance for the object.bool IsFlushed ( ) #
Returns a value indicating if vertex data of the mesh was flushed (create/upload operation) to video memory.Return value
true if vertex data of the mesh was flushed (create/upload operation) to video memory; otherwise, false.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 ) #
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 mode - New lightmap mode to be set for the surface with the specified number. One of the LIGHTMAP_MODE values.
- int surface - Mesh surface number.
ObjectMeshStatic.LIGHTMAP_MODE GetLightmapMode ( int surface ) #
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 ) #
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 ) #
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 quality - New lightmap baking quality preset to be used for the surface with the specified number. One of the LIGHTMAP_QUALITY values.
- int surface - Mesh surface number.
ObjectMeshStatic.LIGHTMAP_QUALITY GetLightmapQuality ( int surface ) #
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 SetLightmapTexturePath ( string path, int surface ) #
Sets a new path to the baked lightmap texture 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
- string path - Path to the baked lightmap texture to be used for the surface with the specified number.
- int surface - Mesh surface number.
string GetLightmapTexturePath ( int surface ) #
Returns the path to the baked lightmap texture currently used for the surface with the specified number.Arguments
- int surface - Mesh surface number.
Return value
Path to the baked lightmap texture 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 ) #
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 mode - Custom texture mode to be set for the surface with the specified number. One of the SURFACE_CUSTOM_TEXTURE_MODE_ values.
- int surface - Mesh surface number.
ObjectMeshStatic.SURFACE_CUSTOM_TEXTURE_MODE GetSurfaceCustomTextureMode ( int surface ) #
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 ) #
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 ( string 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
- string path - Path to the custom texture to be assigned to the surface with the specified number.
- int surface - Mesh surface number.
string GetSurfaceCustomTexturePath ( int surface ) #
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 ( 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
- Texture texture - Texture to be set.
- int surface - Mesh surface number.
Texture GetSurfaceCustomTexture ( int surface ) #
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.Last update:
2022-12-14
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)