ObjectMeshStatic Class
Interface for object mesh static handling. See also the UnigineScript analog.
To use this class, include the UnigineObjectMeshStatic.h file.
ObjectMeshStatic Class
Members
ObjectMeshStatic (const Ptr<Mesh> & mesh)
Arguments
- const Ptr<Mesh> & mesh
ObjectMeshStatic (const char * name, int dynamic = 0)
Arguments
- const char * name
- int dynamic
int addMeshSurface (int dest_surface, const Ptr<ObjectMeshStatic> & mesh, int surface, int target = -1)
Appends a new mesh surface to the current mesh.Arguments
- int dest_surface - Name of the new surface of the current mesh.
- const Ptr<ObjectMeshStatic> & mesh - Mesh pointer to copy a surface from.
- int surface - Mesh surface number to copy.
- int target - Mesh target number to copy.
Return value
Number of the added mesh surface.void setTIndex (int num, int index, int surface)
Updates a triangle index.Arguments
- int num - Index number in the index buffer.
- int index - Triangle index.
- int surface - Surface number.
void setVertex (int num, const Math::vec3 & vertex, int surface, int target = 0)
Updates coordinate of a given vertex.Arguments
- int num - Vertex number.
- const Math::vec3 & vertex - Vertex coordinate.
- int surface - Surface number.
- int target - Target number.
Math::vec3 getVertex (int num, int surface, int target = 0)
Returns coordinate of a given vertex.Arguments
- int num - Vertex number.
- int surface - Surface number.
- int target - Target number.
Return value
Vertex coordinate.const char * getSurfaceTargetName (int surface, int target)
Returns the name of a given surface target.Arguments
- int surface - Surface number.
- int target - Target number.
Return value
Target name.int addSurfaceTarget (int surface, const char * name = 0)
Appends a surface target into the mesh.Arguments
- int surface - Surface number.
- const char * name - New target name.
Return value
Appended target number.int getNumTangents (int surface)
Returns the number of tangents in a given mesh surface.Arguments
- int surface - Surface number.
Return value
Number of the surface vertices.int getNumTexCoords1 (int surface)
Returns the number of second texture coordinates.Arguments
- int surface - Surface number.
Return value
Number of second texture coordinates.int addMeshSurface (const char * name, const Ptr<Mesh> & mesh, int surface, int target = -1)
Appends a new mesh surface to the current mesh.Arguments
- const char * name - Name of the new surface of the current mesh.
- const Ptr<Mesh> & mesh - Mesh pointer to copy a surface from.
- int surface - Mesh surface number to copy.
- int target - Mesh target number to copy.
Return value
Number of the added mesh surface.int getMeshSurface (const Ptr<Mesh> & mesh, int surface, int target = -1)
Gets the mesh surface from the current meshArguments
- const Ptr<Mesh> & mesh - Mesh pointer to copy a surface into.
- int surface - Mesh surface number to copy.
- int target - Mesh target number to copy.
Return value
Number of the added mesh surface.int addMeshSurface (const char * name, const Ptr<ObjectMeshStatic> & mesh, int surface, int target = -1)
Appends a new mesh surface to the current mesh.Arguments
- const char * name - Name of the new surface of the current mesh.
- const Ptr<ObjectMeshStatic> & mesh - Mesh pointer to copy a surface from.
- int surface - Mesh surface number to copy.
- int target - Mesh target number to copy.
Return value
Number of the added mesh surface.void updateSurfaceBounds (int surface = -1)
Updates mesh bounds.Arguments
- int surface - Surface number (use -1 for all surfaces).
void setTexCoord0 (int num, const Math::vec2 & texcoord, int surface)
Updates first texture coordinate.Arguments
- int num - Vertex number.
- const Math::vec2 & texcoord - Second texture coordinate.
- int surface - Surface number.
int findSurfaceTarget (const char * name, int surface)
Searches for an surface target with a given name.Arguments
- const char * name - Target name.
- int surface - Surface number.
Return value
Target number if it is exists; otherwise, -1.void setNumTexCoords0 (int num, int surface)
Sets the number of first texture coordinates.Arguments
- int num - Number of first texture coordinates.
- int surface - Surface number.
void flushMesh ()
Flushes the mesh geometry into the video memory.int getNumColors (int surface)
Returns the number of vertex colors.Arguments
- int surface - Surface number.
Return value
Number of vertex colors.void setColor (int num, const Math::vec4 & color, int surface)
Updates vertex color.Arguments
- int num - Vertex number.
- const Math::vec4 & color - Vertex color.
- int surface - Surface number.
Math::quat getTangent (int num, int surface, int target = 0)
Returns tangent of a given vertex.Arguments
- int num - Vertex number.
- int surface - Surface number.
- int target - Target number.
Return value
Tangent normal.void setNumTexCoords1 (int num, int surface)
Sets the number of second texture coordinates.Arguments
- int num - Number of second texture coordinates.
- int surface - Surface number.
int setMesh (const Ptr<Mesh> & mesh)
Sets a mesh.Arguments
- const Ptr<Mesh> & mesh - The source mesh to be copied.
Return value
1 if the mesh is copied successfully; otherwise, 0.int getNumCIndices (int surface)
Returns the number of coordinate indices.Arguments
- int surface - Surface number.
Return value
Number of coordinate indices.void setTexCoord1 (int num, const Math::vec2 & texcoord, int surface)
Updates second texture coordinate.Arguments
- int num - Vertex number.
- const Math::vec2 & texcoord - Second texture coordinate.
- int surface - Surface number.
int getCIndex (int num, int surface)
Returns an coordinate index.Arguments
- int num - Index number in the index buffer.
- int surface - Surface number.
Return value
Coordinate index.int saveMesh (const char * name)
Saves the mesh into a file.Arguments
- const char * name - Mesh file name.
Return value
Returns 1 if the mesh is saved successfully; otherwise, 0.Math::vec4 getColor (int num, int surface)
Returns vertex color.Arguments
- int num - Vertex number.
- int surface - Surface number.
Return value
Vertex color.void setCIndex (int num, int index, int surface)
Updates an coordinate index.Arguments
- int num - Index number in the index buffer.
- int index - Coordinate index.
- int surface - Surface number.
void setTangent (int num, const Math::quat & tangent, int surface, int target = 0)
Updates tangent of a given vertex.Arguments
- int num - Vertex number.
- const Math::quat & tangent - Vertex tangent.
- int surface - Surface number.
- int target - Target number.
int getNumSurfaceTargets (int surface)
Returns the number of surface targets.Arguments
- int surface - Surface number.
Return value
Number of surface targets.int getNumTexCoords0 (int surface)
Returns the number of first texture coordinates.Arguments
- int surface - Surface number.
Return value
Number of first texture coordinates.Math::vec2 getTexCoord0 (int num, int surface)
Returns first texture coordinate.Arguments
- int num - Vertex number.
- int surface - Surface number.
Return value
Vertex first texture coordinate.Math::vec3 getNormal (int num, int surface, int target = 0)
Returns normal of a given vertex.Arguments
- int num - Vertex number.
- int surface - Surface number.
- int target - Target number.
Return value
Normal vector.int getMesh (const Ptr<Mesh> & mesh)
Returns a mesh.Arguments
- const Ptr<Mesh> & mesh - The source mesh.
Return value
1 if the mesh is copied successfully.int createMesh (const char * name, int dynamic = 0)
Creates a mesh.Arguments
- const char * name - Path to the mesh file.
- int dynamic - Create dynamic mesh.
Return value
Returns 1 if the mesh is loaded successfully; otherwise, 0.int getNumVertex (int surface)
Returns the number of vertices in a given mesh surface.Arguments
- int surface - Surface number.
Return value
Number of the surface vertices.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.Math::vec2 getTexCoord1 (int num, int surface)
Returns second texture coordinate.Arguments
- int num - Vertex number.
- int surface - Surface number.
Return value
Vertex second texture coordinate.int getTIndex (int num, int surface)
Returns a triangle index.Arguments
- int num - Index number in the index buffer.
- int surface - Surface number.
Return value
Triangle index.const char * getMeshName ()
Returns the new mesh name.Return value
The name of the mesh.void setMeshName (const char * name)
Sets the new mesh name.Arguments
- const char * name - The name of the mesh.
void setSurfaceTransform (const Math::mat4 & transform, int surface, int target = -1)
Transforms the mesh surface.Arguments
- const Math::mat4 & transform - Transformation matrix.
- int surface - Surface number.
- int target - Target number.
int getNumTIndices (int surface)
Returns the number of triangle indices.Arguments
- int surface - Surface number.
Return value
Number of triangle indices.int addEmptySurface (const char * name, int num_vertex, int num_indices)
Appends a new surface into the mesh.Arguments
- const char * name - New surface name.
- int num_vertex - Number of surface vertices.
- int num_indices - Number of surface indices.
Return value
Appended surface number.Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)