Unigine::ObjectMesh Class
Interface for object mesh handling. See also the UnigineScript analog.
To use this class, include the UnigineObjectMesh.h file.
Unigine::ObjectMesh Class
Members
static Ptr< ObjectMesh > create (const NodePtr & node)
ObjectMesh constructor.Arguments
- const NodePtr & node - Node smart pointer.
static Ptr< ObjectMesh > create (const ObjectPtr & object)
ObjectMesh constructor.Arguments
- const ObjectPtr & object - Object smart pointer.
static Ptr< ObjectMesh > create (const char * name)
ObjectMesh constructor. Creates a new mesh object from a given file.Arguments
- const char * name - Path to the mesh file.
virtual int save (const char * name) const =0
Saves a mesh into a specified *.mesh file.Arguments
- const char * name - Path to the mesh file.
Return value
Returns 1 if the mesh is saved successfully; otherwise, 0.virtual void setSurfaceTransform (const mat4 & transform, int surface) const =0
Transforms the mesh surface and recalculates its bounds.Arguments
- const mat4 & transform - Transformation matrix.
- int surface - Surface number.
virtual int addMeshSurface (const char * name, Ptr< ObjectMesh > mesh, int surface) const =0
Appends a new mesh surface to the current mesh.Arguments
- const char * name - Name of the new surface of the current mesh.
- Ptr< ObjectMesh > mesh - Mesh pointer to copy a surface from.
- int surface - Mesh surface number to copy.
Return value
Number of the added mesh surface.virtual int addMeshSurface (int dest_surface, Ptr< ObjectMesh > mesh, int surface) const =0
Appends a mesh surface geometry to the existing surface of the current mesh.Arguments
- int dest_surface - Destination surface number.
- Ptr< ObjectMesh > mesh - Mesh pointer to copy a surface geometry from.
- int surface - Mesh surface number to copy geometry from.
Return value
Mesh surface number, to which new geometry is appended.virtual int addEmptySurface (const char * name, int num_vertex, int num_indices) const =0
Appends a new surface to 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.virtual void updateSurfaces () const =0
Updates mesh surfaces.virtual int getNumVertex (int surface) const =0
Returns the total number of vertices in a given mesh surface.Arguments
- int surface - Surface number.
Return value
Number of the surface vertices.virtual void setVertex (int num, const vec3 & xyz, int surface) const =0
Updates coordinates of a given vertex.Arguments
- int num - Vertex number.
- const vec3 & xyz - Vertex position coordinates.
- int surface - Number of the surface to which the vertex belongs.
virtual vec3 getVertex (int num, int surface) const =0
Returns coordinates of a given vertex.Arguments
- int num - Vertex number.
- int surface - Number of the surface to which the vertex belongs.
Return value
Vertex position coordinates.virtual void setNormal (int num, const vec3 & normal, int surface) const =0
Updates a normal vector for a given vertex.Arguments
- int num - Vertex number.
- const vec3 & normal - New normal vector coordinates.
- int surface - Number of the surface to which the vertex belongs.
virtual vec3 getNormal (int num, int surface) const =0
Returns the normal vector for a given vertex.Arguments
- int num - Vertex number.
- int surface - Number of the surface to which the vertex belongs.
Return value
Normal vector coordinates.virtual void setTangent (int num, const vec4 & tangent, int surface) const =0
Updates a tangent vector for a given vertex.Arguments
- int num - Vertex number.
- const vec4 & tangent - New tangent vector coordinates.
- int surface - Surface number to which the vertex belongs.
virtual vec4 getTangent (int num, int surface) const =0
Returns the tangent vector for a given vertex.Arguments
- int num - Vertex number.
- int surface - Surface number to which the vertex belongs.
Return value
Tangent vector coordinates.virtual void setTexCoord (int num, const vec4 & texcoord, int surface) const =0
Updates texture coordinates for a given vertex.Arguments
- int num - Vertex number.
- const vec4 & texcoord - Texture coordinates (for 2 UV sets).
- int surface - Surface number to which the vertex belongs.
virtual vec4 getTexCoord (int num, int surface) const =0
Returns texture coordinates for a given vertex.Arguments
- int num - Vertex number.
- int surface - Surface number to which the vertex belongs.
Return value
Texture coordinates for both texture channels.virtual int getNumIndices (int surface) const =0
Returns the number of vertex indices of a given mesh surface.Arguments
- int surface - Surface number.
Return value
Number of the surface indices.virtual void setIndex (int num, int index, int surface) const =0
Updates an index of a vertex in the index buffer.Arguments
- int num - Index number in the index buffer.
- int index - New index of the vertex in the index buffer.
- int surface - Surface number.
virtual int getIndex (int num, int surface) const =0
Returns an index of a vertex from the index buffer.Arguments
- int num - Index number in the index buffer.
- int surface - Surface number.
Return value
Index of the vertex in the index buffer.Last update: 03.07.2017
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter