This page has been translated automatically.
Programming
Fundamentials
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
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

ObjectMeshDynamic Class

Interface for object mesh dynamic handling. See also the UnigineScript analog.

To use this class, include the UnigineObjectMeshDynamic.h file.

ObjectMeshDynamic Class

Members


ObjectMeshDynamic (const Ptr<Mesh> & mesh, int flags = 0)

Arguments

  • const Ptr<Mesh> & mesh
  • int flags

ObjectMeshDynamic (int flags = 0)

Arguments

  • int flags

void addVertexArray (const ObjectMeshDynamic::Vertex[] & vertex)

Adds an array of vertices to the dynamic mesh.

Arguments

  • const ObjectMeshDynamic::Vertex[] & vertex

void setIndicesArray (int[] indices)

Updates an array of indices.

Arguments

  • int[] indices

int getIndex (int num)

Returns the index of the vertex by the index number.

Arguments

  • int num - Index number in range from 0 to the total number of indices in the index buffer.

Return value

Vertex index in the index buffer.

int updateIndices ()

Updates indices.

Return value

1 if the indices are updated successfully; otherwise, 0.

void setColor (int num, const Math::vec4 & color)

Updates the color of a given vertex.

Arguments

  • int num - Vertex number in range from 0 to the total number of mesh vertices.
  • const Math::vec4 & color - Color.

void setSurfaceEnd (int end, int surface)

Sets the end index for the specified surface of the dynamic object mesh.

Arguments

  • int end - Index to be set as the end one for the surface.
  • int surface - Number of a target surface in range from 0 to the total number of mesh surfaces.

void clearVertex ()

Clears all of the mesh vertex settings.

void updateSurfaceBegin (int surface)

Synchronizes surface begin index.

Arguments

  • int surface - Number of a target surface in range from 0 to the total number of mesh surfaces.

void flushVertex ()

Flushes the vertex buffer and sends all data to GPU. This method is called automatically, if the length of the vertex buffer changes. If you change the contents of the vertex buffer, you should call this method.

void setMeshName (const char * name)

Sets the mesh name.

Arguments

  • const char * name - Mesh name.

void addVertex (const Math::vec3 & xyz)

Adds a vertex with given coordinates to the mesh.

Arguments

  • const Math::vec3 & xyz - Vertex coordinates in the mesh system of coordinates.

int getNumVertex ()

Returns the number of mesh vertices.

Return value

Number of mesh vertices.

void setVertex (int num, const Math::vec3 & xyz)

Updates coordinates of a given vertex.

Arguments

  • int num - Vertex number.
  • const Math::vec3 & xyz - New vertex coordinates in the mesh system of coordinates.

void allocateIndices (int num)

Allocates a given number of vertex indices in the index buffer. With this function, memory can be allocated once rather than in chunks, making the creation faster.

Arguments

  • int num - Number of vertex indices that will be stored in the buffer.

void addTexCoord (const Math::vec4 & texcoord)

Adds texture coordinates to the last added vertex.

Arguments

  • const Math::vec4 & texcoord - Coordinate pairs for both texture channels.

int getNumIndices ()

Returns the number of vertex indices.

Return value

Number of indices.

int setMesh (const Ptr<Mesh> & mesh)

Allows for reinitialization of the ObjectMeshDynamic: it copies a given mesh into the current dynamic mesh.

Arguments

  • const Ptr<Mesh> & mesh - Smart pointer to the mesh.

Return value

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

Math::vec3 getVertex (int num)

Returns coordinates of a given vertex.

Arguments

  • int num - Vertex number in range from 0 to the total number of mesh vertices.

Return value

Vertex coordinates in the mesh system of coordinates.

void removeSurface (int surface)

Removes the surface with the given index.

Arguments

  • int surface - Surface index.

Math::vec4 getColor (int num)

Returns the color of a given vertex.

Arguments

  • int num - Vertex number in range from 0 to the total number of mesh vertices.

Return value

Color.

void addTriangleQuads (int num_quads)

Adds a given number of quadrilaterals to the mesh. This method does not add vertices, rather it allocates indices, for which vertices should be then created with the addVertex() function. Indices will point to vertices starting from the current last vertex in the vertex buffer.

Arguments

  • int num_quads - Number of quadrilaterals.

void setIndex (int num, int index)

Updates an index in the index buffer (replaces the index with the given number with the specified index of the vertex).

Arguments

  • int num - Index number in range from 0 to the total number of indices in the index buffer.
  • int index - Vertex index in the index buffer to set.

void setVertexArray (const ObjectMeshDynamic::Vertex[] & vertex)

Updates the vertex array of the dynamic mesh.

Arguments

  • const ObjectMeshDynamic::Vertex[] & vertex

int updateTangents ()

Updates tangents.

Return value

1 if the tangents are updated successfully; otherwise, 0.

void addSurface (const char * name)

Adds all the last listed and unsigned vertices and triangles to a new surface with a specified name.

Arguments

  • const char * name - Name of the new surface.

void flushIndices ()

Flushes the index buffer and sends all data to GPU. This method is called automatically, if the length of the index buffer changes. If you change the contents of the index buffers, you should call this method.

int getSurfaceEnd (int surface)

Returns the end index of the specified mesh surface.

Arguments

  • int surface - Number of a target surface in range from 0 to the total number of mesh surfaces.

Return value

Returns the end index of the surface.

void setBoundBox (const BoundBox & bb)

Sets a bounding box of a specified size for a given dynamic mesh surface.

Arguments

  • const BoundBox & bb - Bounding box.

void addTriangleFan (int num_vertex)

Adds a triangle fan to the mesh. This method does not add vertices, rather it allocates indices, for which vertices should be then created with the addVertex() function. Indices will point to vertices starting from the current last vertex in the vertex buffer.

Arguments

  • int num_vertex - Number of vertices of the fan.

void setSurfaceBegin (int begin, int surface)

Sets the begin index for the specified surface of the dynamic object mesh.

Arguments

  • int begin - Index to be set as the begin one for the surface.
  • int surface - Number of a target surface in range from 0 to the total number of mesh surfaces.

void addColor (const Math::vec4 & color)

Adds a color with given coordinates to the last added vertex.

Arguments

  • const Math::vec4 & color - Color.

int getSurfaceBegin (int surface)

Returns the begin index of the specified mesh surface.

Arguments

  • int surface - Number of a target surface in range from 0 to the total number of mesh surfaces.

Return value

Returns the begin index of the surface.

int updateBounds ()

Updates a bounding box and a bounding sphere for the current mesh.

Return value

1 if the bounds are calculated successfully; otherwise, 0.

int saveMesh (const char * name)

Saves the dynamic mesh into a file.

Arguments

  • const char * name - Mesh file name.

Return value

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

void setTangent (int num, const Math::quat & tangent)

Updates the tangent vector coordinates of a given vertex.

Arguments

  • int num - Vertex number in range from 0 to the total number of mesh vertices.
  • const Math::quat & tangent - Tangent vector coordinates.

void setNumVertex (int num)

Sets the number of mesh vertices.

Arguments

  • int num - Number of mesh vertices.

void addTriangleStrip (int num_vertex)

Adds a triangle strip to the mesh. This method does not add vertices, rather it allocates indices, for which vertices should be then created with the addVertex() function. Indices will point to vertices starting from the current last vertex in the vertex buffer.

Arguments

  • int num_vertex - Number of vertices of the strip.

void setNumIndices (int num)

Sets the number of vertex indices.

Arguments

  • int num - Number of indices.

Math::vec3 getNormal (int num)

Returns the normal vector coordinates of a given vertex.

Arguments

  • int num - Vertex number in range from 0 to the total number of mesh vertices.

Return value

Normal vector.

void setBoundBox (const BoundBox & bb, int surface)

Sets a bounding box of a specified size for a given dynamic mesh surface.

Arguments

  • const BoundBox & bb - Bounding box.
  • int surface - Surface number in range from 0 to the total number of dynamic mesh surfaces.

void removeVertex (int num, int size, int indices)

Removes the specified number of vertices.

Arguments

  • int num - Vertex number.
  • int size - Number of vertices to remove.
  • int indices - Fix the indices buffer.

void setTexCoord (int num, const Math::vec4 & texcoord)

Updates texture coordinates of a given vertex.

Arguments

  • int num - Vertex number in range from 0 to the total number of mesh vertices.
  • const Math::vec4 & texcoord - New coordinate pairs for both texture channels.

int getMesh (const Ptr<Mesh> & mesh)

Copies the current dynamic mesh into the received mesh.

Arguments

  • const Ptr<Mesh> & mesh - Smart pointer to the mesh.

Return value

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

void addTangent (const Math::quat & tangent)

Adds a tangent vector with given coordinates to the last added vertex.

Arguments

  • const Math::quat & tangent - Tangent vector coordinates.

void removeIndices (int num, int size)

Removes the specified number of indices.

Arguments

  • int num - Index number.
  • int size - Number of indices to remove.

void addTriangles (int num_triangles)

Adds a given number of triangles to the mesh. This method does not add vertices, rather it allocates indices, for which vertices should be then created with the addVertex() function. Indices will point to vertices starting from the current last vertex in the vertex buffer.

Arguments

  • int num_triangles - Number of triangles.

int loadMesh (const char * name)

Loads a mesh file.

Arguments

  • const char * name - Mesh file name.

Return value

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

void setSurfaceName (const char * name, int surface)

Sets the name for the specified surface. The name will be set only if the specified surface was added via the addSurface() method.

Arguments

  • const char * name - Surface name.
  • int surface - Number of a target surface in range from 0 to the total number of mesh surfaces.

const ObjectMeshDynamic::Vertex * getVertexArray ()

Returns an array of vertices of the dynamic mesh.

Return value

Pointer to the array of vertices.

void allocateVertex (int num)

Allocates a given number of vertices in the vertex buffer. With this function, memory can be allocated once rather than in chunks, making the creation faster.

Arguments

  • int num - Number of vertices to allocate.

void removeSurfaces (const char * name)

Removes the surfaces with the given name.

Arguments

  • const char * name - Surface name.

const char * getMeshName ()

Gets the mesh name.

Return value

Mesh name.

void clearSurfaces ()

Clears all the surface settings.

void addIndicesArray (int[] indices)

Adds an array of indices.

Arguments

  • int[] indices

Math::quat getTangent (int num)

Returns the tangent vector coordinates of a given vertex.

Arguments

  • int num - Vertex number in range from 0 to the total number of mesh vertices.

Return value

Tangent vector.

Math::vec4 getTexCoord (int num)

Returns texture coordinates of a given vertex.

Arguments

  • int num - Vertex number in range from 0 to the total number of mesh vertices.

Return value

Coordinate pairs for both texture channels.

void clearIndices ()

Clears all vertex indices in the mesh.

void addIndex (int index)

Adds an index to the index buffer.

Arguments

  • int index - Index to add.

void updateSurfaceEnd (int surface)

Synchronizes surface end index.

Arguments

  • int surface - Number of a target surface.

int IMMUTABLE_VERTEX

int IMMUTABLE_INDICES

int IMMUTABLE_ALL

int DYNAMIC_VERTEX

int DYNAMIC_INDICES

int DYNAMIC_ALL

int MODE_POINTS

Description

Mode to render points.

int MODE_LINES

Description

Mode to render lines.

int MODE_TRIANGLES

Description

Mode to render triangles (to create meshes).

int MODE_TRIANGLE_PATCHES

int MODE_QUAD_PATCHES

int TYPE_HALF

int TYPE_FLOAT

int TYPE_DOUBLE

int TYPE_UCHAR

int TYPE_USHORT

Last update: 03.07.2017
Build: ()