This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
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
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.

ObjectMeshStatic Class

Inherits:Object

This class is used for handling static meshes.

ObjectMeshStatic Class

Members


static ObjectMeshStatic(variable v, int unique = 0)

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

Arguments

  • variable v - A variable of one of the following types:
    • Mesh mesh - The source mesh.
    • string name - The 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)

Updates an coordinate index.

Arguments

  • int num - The number of the index in the index buffer.
  • int index - The index to be set.
  • int surface - The number of the mesh surface.

int getCIndex(int num, int surface)

Returns the coordinate index.

Arguments

  • int num - The number of the index in the index buffer.
  • int surface - The number of the mesh surface.

Return value

The coordinate index.

void setColor(int num, vec4 color, int surface)

Updates the vertex color.

Arguments

  • int num - Vertex number.
  • vec4 color - Vertex color.
  • int surface - Surface number.

vec4 getColor(int num, int surface)

Returns the vertex color.

Arguments

  • int num - Vertex number.
  • int surface - Surface number.

Return value

Vertex color.

int setMesh(Mesh mesh)

Copies the source mesh into the current mesh.

Arguments

  • Mesh mesh - The source mesh to be copied.

Return value

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

int getMesh(Mesh mesh)

Copies the current mesh into the source mesh.
Source code (UnigineScript)
MeshPtr m = Mesh::create();
objectmeshstatic->getMesh(m);

Arguments

  • Mesh mesh - The source mesh.

Return value

1 if the mesh is copied successfully.

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 - The name of the mesh.
  • 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

The name of the mesh.

int getMeshSurface(Mesh mesh, int surface, int target = -1)

Copies the specified mesh surface into the source mesh.

Arguments

  • Mesh mesh - The mesh to copy the surface into.
  • int surface - The number of the mesh surface to be copied.
  • int target - The number of the surface target to be copied.

Return value

Number of the added mesh surface.

vec3 getNormal(int num, int surface, int target = 0)

Returns a normal vector of a given vertex.

Arguments

  • int num - Number of the vertex in the vertex buffer.
  • int surface - Number of the surface.
  • int target - Number of the surface's morph target.

Return value

Normal vector.

int getNumCIndices(int surface)

Returns the number of coordinate indices for the given mesh surface.

Arguments

  • int surface - The number of the mesh surface.

Return value

The number of coordinate indices.

int getNumColors(int surface)

Returns the number of vertex colors.

Arguments

  • int surface - Surface number.

Return value

Number of vertex colors.

int getNumSurfaceTargets(int surface)

Returns the number of surface targets for the given mesh surface.

Arguments

  • int surface - The number of the mesh surface.

Return value

The number of surface targets.

int getNumTangents(int surface)

Returns the number of tangent vectors of the given mesh surface.

Arguments

  • int surface - Number of the mesh surface.

Return value

Number of the surface vertices.

void setNumTexCoords0(int num, int surface)

Sets the number of the first texture coordinates for the given mesh surface.

Arguments

  • int num - Number of the first texture coordinates to be set.
  • int surface - The number of the mesh surface.

int getNumTexCoords0(int surface)

Returns the number of the first UV map texture coordinates for the given mesh surface.

Arguments

  • int surface - The number of the mesh surface.

Return value

The number of the first UV map texture coordinates.

void setNumTexCoords1(int num, int surface)

Sets the number of the second texture coordinates for the given mesh surface.

Arguments

  • int num - Number of the second texture coordinates to be set.
  • int surface - The number of the mesh surface.

int getNumTexCoords1(int surface)

Returns the number of the second UV map texture coordinates for the given mesh surface.

Arguments

  • int surface - The number of the mesh surface.

Return value

The 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 - The number of the mesh surface.

Return value

The number of triangle indices.

int getNumVertex(int surface)

Returns the number of vertices for the given mesh surface.

Arguments

  • int surface - The number of the mesh surface.

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 - The number of the mesh surface.
  • int target - The number of the surface target.

Return value

The name of the surface target.

void setSurfaceTransform(mat4 transform, int surface, int target = -1)

Transforms the mesh surface.

Arguments

  • mat4 transform - The transformation matrix.
  • int surface - The number of the mesh surface.
  • int target - The number of the surface target.

void setTangent(int num, quat tangent, int surface, int target = 0)

Sets the new tangent vector for the given vertex.

Arguments

  • int num - Number of the vertex in the vertex buffer.
  • quat tangent - Tangent vector to be set.
  • int surface - Number of the mesh surface.
  • int target - Number of the surface's morph target.

quat getTangent(int num, int surface, int target = 0)

Returns the tangent vector of the given vertex.

Arguments

  • int num - Number of the vertex in the vertex buffer.
  • int surface - Number of the mesh surface.
  • int target - Number of the surface's morph target.

Return value

Tangent vector.

void setTexCoord0(int num, vec2 texcoord, int surface)

Sets new coordinates for the first UV map of the mesh surface.

Arguments

  • int num - The number of the vertex in the vertex buffer.
  • vec2 texcoord - Coordinates of the first UV map to be set.
  • int surface - The number of the mesh surface.

vec2 getTexCoord0(int num, int surface)

Returns the first UV map texture coordinates.

Arguments

  • int num - The number of the vertex in the vertex buffer.
  • int surface - The number of the mesh surface.

Return value

The first UV map texture coordinates.

void setTexCoord1(int num, vec2 texcoord, int surface)

Sets new coordinates for the second UV map of the given mesh surface.

Arguments

  • int num - The number of the vertex in the vertex buffer.
  • vec2 texcoord - Coordinates of the second UV map to be set.
  • int surface - The number of the mesh surface.

vec2 getTexCoord1(int num, int surface)

Returns the second UV map texture coordinates.

Arguments

  • int num - The number of the vertex in the vertex buffer.
  • int surface - The number of the mesh surface.

Return value

The second UV map texture coordinates.

void setTIndex(int num, int index, int surface)

Sets the new triangle index for the given mesh surface.

Arguments

  • int num - The number of the index in the index buffer.
  • int index - The index to be set.
  • int surface - The number of the mesh surface.

int getTIndex(int num, int surface)

Returns the triangle index for the given mesh surface.

Arguments

  • int num - The number of the index in the index buffer.
  • int surface - The number of the mesh surface.

Return value

The triangle index.

void setVertex(int num, vec3 vertex, int surface, int target = 0)

Sets new coordinates for the given vertex.

Arguments

  • int num - The number of the vertex in the vertex buffer.
  • vec3 vertex - Coordinates of the vertex to be set.
  • int surface - The number of the mesh surface.
  • int target - The number of the surface target.

vec3 getVertex(int num, int surface, int target = 0)

Returns coordinate of a given vertex.

Arguments

  • int num - The number of the vertex in the vertex buffer.
  • int surface - The number of the mesh surface.
  • int target - The number of the surface target.

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 - The number of the new surface vertices.
  • int num_indices - The number of the new surface indices.

Return value

The number of the appended surface.

int addMeshSurface(variable v0, variable v1, int surface, int target = -1)

Appends the specified surface of the source mesh to the current mesh. Variables, passed as arguments, can be of the following types:

  • string and Mesh.
  • string and ObjectMeshStatic.
  • int and ObjectMeshStatic.

Arguments

  • variable v0 - Argument of one of the following types:
    • string name - The name of the new surface.
    • int dest_surface - The number of the new surface.
  • variable v1 - Argument of one of the following types:
    • Mesh mesh - The source mesh to copy the surface from.
    • ObjectMeshStatic mesh - The source mesh to copy the surface from.
  • int surface - Mesh surface number to copy.
  • int target - Mesh target number to copy.

Return value

The number of the surface, appended to the current mesh.

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

The number of the added target.

void clearTopology()

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 - Dynamic flag:
    • 0 - If the mesh vertices are changed in run-time, meshes loaded from the same file will be also changed.
    • 1 - If the mesh vertices are changed in run-time, meshes loaded from the same file won't be changed

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 - The number of the mesh surface.

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.

void updateSurfaceBounds(int surface = -1)

Updates mesh bounds.

Arguments

  • int surface - Surface number (use -1 for all surfaces).

void updateTopology()

Bends the mesh geometry if it is a child of GeodeticPivot.
Last update: 2017-07-03
Build: ()