This page has been translated automatically.
Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
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

This class is used for handling static meshes.

See Also

ObjectMeshStatic Class

This class inherits from Object

Members


ObjectMeshStatic (variable v, int dynamic = 0)

An ObjectMeshStatic constructor. The new ObjectMeshStatic based on the specified mesh will be created.

Arguments

  • variable v - Variable of one of the following types:
    • Mesh mesh - The source mesh.
    • string name - The path to the .mesh file.
  • int dynamic - The 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.
    Notice
    This argument is available only if the first argument is string.

int addEmptySurface (string name, int num_vertices, int num_indices)

Appends a new empty surface to the current mesh.

Arguments

  • string name - The name of the new surface.
  • int num_vertices - 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 - The number of the source mesh surface to be appended.
  • int target - The number of the source surface target to be appended.

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.

int createMesh (string name, int dynamic = 0)

Creates the static mesh with the specified parameters.

Arguments

  • string name - Mesh name.
  • int dynamic - 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

The number of the target, if exists; otherwise, -1.

void flushMesh ()

Flushes the mesh geometry into the video memory.

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.

string getMeshName ()

Returns the current name of the 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

The number of the added mesh surface.

int getMesh (Mesh mesh)

Copies the current mesh into the source mesh.

Arguments

  • Mesh mesh - The source mesh.

Return value

1 if the mesh is copied successfully.

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 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 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 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 tangent vectors.

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.

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 getNumVertex (int surface)

Returns the number of vertices for the given mesh surface.

Arguments

  • int surface - The number of the mesh surface.

Return value

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

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.

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.

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.

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.

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

Returns vertex coordinates.

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

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

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

Sets the 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.

void setMeshName (string name)

Sets the new name to the mesh.

Arguments

  • string name - The name of the mesh.

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.

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.

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.

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

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.

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.

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.

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.

void updateSurfaceBounds (int surface = -1)

Updates mesh bounds.

Arguments

  • int surface - The number of the mesh surface.
    Notice
    Specify -1 to select all surfaces.
Last update: 2017-07-03
Build: ()