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 int type ()
ObjectMeshDynamic type.Return value
ObjectMeshDynamic type identifier.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 (const MeshPtr & mesh, int flags)
ObjectMeshDynamic constructor.Arguments
- const MeshPtr & mesh - Mesh smart pointer.
- int flags - Dynamic flags.
static Ptr< ObjectMeshDynamic > create (int flags)
ObjectMeshDynamic constructor.Arguments
- int flags - Dynamic flags.
virtual int loadMesh (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 saveMesh (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 int setMesh (const MeshPtr & mesh) const =0
Allows for reinitialization of the ObjectMeshDynamic: it copies a given mesh into the current dynamic mesh.Arguments
- const MeshPtr & mesh - Smart pointer to the mesh.
Return value
1 if the mesh is copied successfully; otherwise, 0.virtual int getMesh (const MeshPtr & mesh) const =0
Copies the current dynamic mesh into the received mesh.Arguments
- const MeshPtr & mesh - Smart pointer to the mesh.
Return value
1 if the mesh is copied successfully; otherwise, 0.virtual void setMeshName (const char * name) const =0
Sets the mesh name.Arguments
- const char * name - Mesh name.
virtual const char * getMeshName () const =0
Gets the mesh name.Return value
Mesh name.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 setSurfaceName (const char * name, int surface) const =0
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.
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.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.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 void removeVertex (int num, int size, int indices) const =0
Removes the specified number of vertices.Arguments
- int num - Vertex number.
- int size - Number of vertices to remove.
- int indices - Fix the indices buffer.
virtual void setNumVertex (int num) const =0
Sets the number of mesh vertices.Arguments
- int num - Number of mesh vertices.
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 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 addTangent (const quat & tangent) const =0
Adds a tangent vector with given coordinates to the last added vertex.Arguments
- const quat & tangent - Tangent vector coordinates.
virtual void setTangent (int num, const quat & 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 quat & tangent - Tangent vector coordinates.
virtual quat 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.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.virtual void addColor (const vec4 & color) const =0
Adds a color with given coordinates to the last added vertex.Arguments
- const vec4 & color - Color.
virtual void setColor (int num, const vec4 & color) const =0
Updates the color of a given vertex.Arguments
- int num - Vertex number in range from 0 to the total number of mesh vertices.
- const vec4 & color - Color.
virtual vec4 getColor (int num) const =0
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.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 void removeIndices (int num, int size) const =0
Removes the specified number of indices.Arguments
- int num - Index number.
- int size - Number of indices to remove.
virtual void setNumIndices (int num) const =0
Sets the number of vertex indices.Arguments
- int num - Number of indices.
virtual int getNumIndices () const =0
Returns the number of vertex indices.Return value
Number of indices.virtual void addIndex (int index) const =0
Adds an index to the index buffer.Arguments
- int index - Index to add.
virtual void setIndex (int num, int index) const =0
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.
virtual void addIndicesArray (const int * indices, int num_indices) const =0
Adds an array of indices.Arguments
- const int * indices - Pointer to the array of indices.
- int num_indices - Number of indices to add.
virtual void setIndicesArray (const int * indices, int num_indices) const =0
Updates an array of indices.Arguments
- const int * indices - Pointer to the array of indices.
- int num_indices - Number of indices.
virtual const int * getIndicesArray () const =0
Returns an array of indices of the dynamic mesh.Return value
Pointer to the array of indices.virtual int getIndex (int num) const =0
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.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 addTriangleQuads (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 setBoundBox (const BoundBox & bb, int surface) const =0
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.
virtual void setBoundBox (const BoundBox & bb) const =0
Sets a bounding box of the specified size for the dynamic object mesh.Arguments
- const BoundBox & bb - Bounding box.
virtual void updateBounds () const =0
Updates a bounding box and a bounding sphere for the current mesh.virtual void updateIndices () const =0
Updates indices.virtual void updateTangents () const =0
Updates tangents.virtual void flushVertex () const =0
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.virtual void flushIndices () const =0
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.Unigine::ObjectMeshDynamic::anonymous_84 Enumeration
IMMUTABLE_VERTEX
= 1 << 0
IMMUTABLE_INDICES
= 1 << 1
DYNAMIC_VERTEX
= 1 << 2
DYNAMIC_INDICES
= 1 << 3
IMMUTABLE_ALL
= (IMMUTABLE_VERTEX | IMMUTABLE_INDICES)
DYNAMIC_ALL
= (DYNAMIC_VERTEX | DYNAMIC_INDICES)
Last update: 03.07.2017
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter