This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
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
CIGI Client Plugin
Rendering-Related Classes
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.ObjectMeshStatic Class

Inherits:Object

This class is used for handling static meshes.

ObjectMeshStatic Class

Members


static ObjectMeshStatic(Mesh mesh)

ObjectMeshStatic constructor. Creates a new mesh object from a given file.

Arguments

  • Mesh mesh - A mesh smart pointer.

static ObjectMeshStatic(string name, int unique = 0)

ObjectMeshStatic constructor. Creates a new mesh object from a given file.

Arguments

  • string name - Path to the mesh file.
  • int 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 1, so a copy of the mesh geometry will be created and changes won't be applied.

ObjectMeshStatic cast(Object base)

Casts an ObjectMeshStatic out of the Object instance.

Arguments

  • Object base - Object instance.

Return value

ObjectMeshStatic instance.

ObjectMeshStatic cast(Node node)

Casts an ObjectMeshStatic out of the Node instance.

Arguments

  • Node node - Node instance.

Return value

ObjectMeshStatic instance.

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.
    Notice
    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.
    Notice
    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.
    Notice
    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.
    Notice
    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.
    Notice
    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.

int 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:
Source code (C#)
// 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

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

int setMesh(Mesh mesh, int unique = 1)

Copies a given source mesh into the current mesh. For example, you can copy a mesh into another one as follows:
Source code (C#)
// 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.
  • int unique - Unique flag used when you create several objects out of a single Mesh instance :
    • 0 - An instance of source mesh geometry is created. If the source geometry is changed at runtime, its instances will be changed as well.
    • 1 - A copy of source mesh geometry is created and changes made to the source geometry do not affect the mesh.

Return value

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

void setMeshName(string name, int force_load = 0)

Sets the new mesh name and forces creating of the mesh with this name.

Arguments

  • string name - Mesh name.
  • int force_load - Force flag.
    • If 1 is specified, the mesh with the new name will be created immediately with the unique flag set to 0.
    • If 0 is specified, only the mesh name will be updated.

string getMeshName()

Returns the name of the current mesh.

Return value

Mesh name.

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.
    Notice
    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.
Notice
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.
Notice
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.
Notice
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.
Notice
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.
Notice
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.
Notice
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.

int getSplineMesh(Mesh mesh)

Copies a spline collision mesh if it exists to the specified destination mesh.
Notice
This mesh is used for MeshStatic objects generated along the splines (see the WorldSplineGraph class).

Arguments

  • Mesh mesh - Destination mesh.

Return value

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

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.
    Notice
    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.
    Notice
    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.
    Notice
    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.
    Notice
    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.
    Notice
    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.
    Notice
    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.
    Notice
    To get the total number of triangle indices, use the getNumTIndices() method.
  • int index - Triangle index to be set in the range from 0 to the total number of triangle vertices for the given surface.
    Notice
    To get the total number of triangle vertices for the given surface, use the getNumTVertex() method.
  • 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.
    Notice
    To get the total number of triangle indices for the given surface, use the getNumTIndices() method.
  • 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.
    Notice
    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.
    Notice
    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 surface, appended to the current mesh.

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 added mesh 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 added mesh 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.

int createMesh(string name, int unique = 0)

Creates the static mesh with the specified parameters.

Arguments

  • string name - Path to the mesh file.
  • int unique - Unique flag used when you create several objects out of a single .mesh file :
    • 0 - An instance of source mesh geometry is created. If the source geometry is changed at runtime, its instances will be changed as well.
    • 1 - A copy of source mesh geometry is created and changes made to the source geometry do not affect the mesh.

Return value

1 if the mesh is created successfully; otherwise - 0.

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.

int loadMesh(string name)

Loads the mesh for the current mesh from the .mesh file. This function doesn't change the mesh name.

Arguments

  • string name - The path to the .mesh file.

Return value

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

int saveMesh(string name)

Saves the mesh into the .mesh format.

Arguments

  • string name - The path to the file.

Return value

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

static int type()

Returns the type of ObjectMeshStatic.

Return value

ObjectMeshStatic 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).
Last update: 2018-06-04
Build: ()