This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
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::ObjectMeshDynamic Class

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

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

Related classes:
Unigine::ObjectMeshDynamic::Vertex

Unigine::ObjectMeshDynamic Class

Members


static Ptr< ObjectMeshDynamic > create (const NodePtr & node)

ObjectMeshDynamic constructor.

Arguments

  • const NodePtr & node - Node smart pointer.

static Ptr< ObjectMeshDynamic > create (const ObjectPtr & object)

ObjectMeshDynamic constructor.

Arguments

  • const ObjectPtr & object - Object smart pointer.

static Ptr< ObjectMeshDynamic > create (int dynamic)

ObjectMeshDynamic constructor.

Arguments

  • int dynamic - Dynamic flag. Set this flag to 1, if the object is going to be changed every frame.

virtual int load (const char * name) const =0

Loads a mesh file.

Arguments

  • const char * name - Mesh file name.

Return value

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

virtual int save (const char * name) const =0

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.

virtual void clearSurfaces () const =0

Clears all the surface settings.

virtual void addSurface (const char * name) const =0

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.

virtual void addMeshSurface (const Ptr< ObjectMeshDynamic > & mesh, int surface) const =0

Adds a mesh surface to the current mesh.

Arguments

  • const Ptr< ObjectMeshDynamic > & mesh - Mesh pointer.
  • int surface - Mesh surface.

virtual void updateSurfaceBegin (int surface) const =0

Synchronizes surface begin index.

Arguments

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

virtual void setSurfaceBegin (int begin, int surface) const =0

Sets the begin index for the specified surface of the dynamic object mesh. It means that the surface will be rendered first.

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.

virtual int getSurfaceBegin (int surface) const =0

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.

virtual void updateSurfaceEnd (int surface) const =0

Synchronizes surface end index.

Arguments

  • int surface - Number of a target surface.

virtual void setSurfaceEnd (int end, int surface) const =0

Sets the end index for the specified surface of the dynamic object mesh. It means that the surface will be rendered the last.

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.

virtual int getSurfaceEnd (int surface) const =0

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.

virtual void clearVertex () const =0

Clears all of the mesh vertex settings.

virtual void allocateVertex (int num) const =0

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.

virtual int getNumVertex () const =0

Returns the number of mesh vertices.

Return value

Number of mesh vertices.

virtual void addVertex (const vec3 & xyz) const =0

Adds a vertex with given coordinates to the mesh.

Arguments

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

virtual void setVertex (int num, const vec3 & xyz) const =0

Updates coordinates of a given vertex.

Arguments

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

virtual void addVertexArray (const Vertex * vertex, int num_vertex) const =0

Adds an array of vertices to the dynamic mesh.

Arguments

  • const Vertex * vertex - Pointer to the array of vertices.
  • int num_vertex - Number of vertices to add.

virtual void setVertexArray (const Vertex * vertex, int num_vertex) const =0

Updates the vertex array of the dynamic mesh.

Arguments

  • const Vertex * vertex - Pointer to the array of vertices.
  • int num_vertex - Number of vertices.

virtual const Vertex * getVertexArray () const =0

Returns an array of vertices of the dynamic mesh.

Return value

Pointer to the array of vertices.

virtual vec3 getVertex (int num) const =0

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.

virtual void addNormal (const vec3 & normal) const =0

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

Arguments

  • const vec3 & normal - Normal vector coordinates.

virtual void setNormal (int num, const vec3 & normal) const =0

Updates the normal vector coordinates of the given vertex.

Arguments

  • int num - Vertex number in range from 0 to the total number of mesh vertices.
  • const vec3 & normal - Normal vector coordinates.

virtual vec3 getNormal (int num) const =0

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

virtual void addTangent (const vec4 & tangent) const =0

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

Arguments

  • const vec4 & tangent - Tangent vector coordinates.

virtual void setTangent (int num, const vec4 & tangent) const =0

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 vec4 & tangent - Tangent vector coordinates.

virtual vec4 getTangent (int num) const =0

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

virtual void addTexCoord (const vec4 & texcoord) const =0

Adds texture coordinates to the last added vertex.

Arguments

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

virtual void setTexCoord (int num, const vec4 & texcoord) const =0

Updates texture coordinates of a given vertex.

Arguments

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

virtual vec4 getTexCoord (int num) const =0

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.

virtual void clearIndices () const =0

Clears all vertex indices in the mesh.

virtual void allocateIndices (int num) const =0

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.

virtual int getNumIndices () const =0

Returns the number of vertex indices.

Return value

Number of indices.

virtual void addIndex (unsigned short index) const =0

Adds an index pointing to a given vertex.

Arguments

  • unsigned short index - Vertex number.

virtual void setIndex (int num, unsigned short index) const =0

Updates an index pointing to the vertex.

Arguments

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

virtual void addIndicesArray (const unsigned short * indices, int num_indices) const =0

Adds an array of indices.

Arguments

  • const unsigned short * indices - Pointer to the array of indices.
  • int num_indices - Number of indices to add.

virtual void setIndicesArray (const unsigned short * indices, int num_indices) const =0

Updates an array of indices.

Arguments

  • const unsigned short * indices - Pointer to the array of indices.
  • int num_indices - Number of indices.

virtual const unsigned short * getIndicesArray () const =0

Returns an array of indices of the dynamic mesh.

Return value

Pointer to the array of indices.

virtual unsigned short getIndex (int num) const =0

Returns a vertex number pointed by a given index.

Arguments

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

Return value

Vertex number.

virtual void addQuads (int num_quads) const =0

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.

virtual void addTriangles (int num_triangles) const =0

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.

virtual void addTriangleFan (int num_vertex) const =0

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.

virtual void addTriangleStrip (int num_vertex) const =0

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.

virtual void setBoundBox (const vec3 & min, const vec3 & max, int surface) const =0

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

Arguments

  • const vec3 & min - Bounding box minimum.
  • const vec3 & max - Bounding box maximum.
  • int surface - Surface number in range from 0 to the total number of dynamic mesh surfaces.

virtual void setBoundBox (const vec3 & min, const vec3 & max) const =0

Sets a bounding box of the specified size for the dynamic object mesh.

Arguments

  • const vec3 & min - Bounding box minimum.
  • const vec3 & max - Bounding box maximum.

virtual void updateBounds () const =0

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

virtual void updateNormals () const =0

Updates normal vectors in vertices of the current mesh.

virtual void updateNormals (float angle) const =0

Updates normal vectors in vertices of the current mesh.

Arguments

  • float angle - Face threshold angle in degrees (set zero for flat normals).

virtual void updateTangents () const =0

Updates tangent vectors in vertices of the current mesh. This function should be called only after texture coordinates and normal vectors are set. For example, after calling the updateNormals() function.

virtual void updateIndices () const =0

Updates mesh indices by removing duplicated vertices. Vertices are merged only if all the following conditions are met:
  • Coordinates of vertices match
  • Normals of vertices match
  • Texture coordinates of vertices match
  • Tangents of vertices match

virtual void flush () const =0

Flushes the buffers and send all data to GPU. This method is called automatically, if the length of either vertex or index buffer changes. If you change the contents of either of the buffers, you should call this method.
Last update: 2017-07-03
Build: ()