Translation of MFNMESH.H usage instructions in Maya

Source: Internet
Author: User

Since I recently modified a deformer script in Maya, I began to learn some knowledge of Openmaya, and of course I had to read a bunch of header files. First of all, MFnMesh.h this file translation, no nonsense, the translation:

First MFNMESH.H is a device about the polygon surface. The following terms, although different in name, have the same meaning:

Mesh,object;

Polygon,face;

Object-relative indices,global/mesh-relative Indices;

Face-relative indices,local Indices;

object-relative Indices represents the index of the point, which ranges between [0, (numvertices ()-1)].

face-relative Indices represents the index of the polygon, in the range [0, (Polygonvertexcount (faceId)-1)].

MFNMESH.H This function provides a way to enter a Multipatch, whose objects include Mfn::kmesh, mfn::kmeshdata, mfn::kmeshgeom. Where the Kmesh object is the geometry shape. The Kmeshgeom object is the raw data for the geometry, and the Kmeshdata object is the data passed through a connection in the dependency graph. If the mesh class is initialized with Kmesh, it must be attached to the geometry.

Mesh Construction by defining a series of vertices (vertex list) and a list of the number of vertices that contain each polygon face (polygon count list) and a list of vertices that make up each polygon face (vertex Connection list) is the way to create a mesh. The mesh controls the data for each edge line and returns it to the caller.

Vertex list:

This list stores all the vertices in the mesh, which are assigned to each polygon in the mesh.

For example: {( -1,-1,-1), (1,-1,-1), (1,-1,1), ( -1,-1,1), ( -1,1,-1), ( -1,1,1), (1,1,1), (1,1,-1)}

Polygon Count List:

This list contains a list of the number of vertices per polygon surface, each of which can contain a list of the number of vertices in the mesh.

For example: {4,4,4,4,4,4}

Vertex connection list:

This is a list of the indexes that contain the vertices for each polygon face, because each polygon can have a different number of vertices, and thepolygon count list determines which polygon faces are displayed through a variety of paragraphs in the list.

For example: {0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 6, 5, 0, 3, 5, 4, 0, 4, 7, 1, 1, 7, 6, 2}

Note that the mesh modifies the current data information when the point of the adjacent polygon in the mesh is sorted inconsistently and there is already a repeating point of the line.

Texture coordinates (UV ' s)

You can choose to define the UV coordinates of the sex. The UV coordinate system is a 2d coordinate system that is used to expand the map on the polygon surface of the mesh. All UV coordinates are stored in one or more uvset. The default mesh UV list stores the UV coordinate system in an array with an index range of [0,Numuvs ()-1]. The UV data will refer to each vertex of each polygon, so a quadrilateral is 4uv ' s.

Normals:
Some of the findings are set by the user, and if the vertex discovery is not set or locked, then the normal data will be computed when the mesh is changed. If set or locked, the discovery maintains a relative relationship with the object unless the user unlocks them.

There are three kinds of normal information in the mesh:

Per-vertex Per-polygon:

The normals of the points that store each polygon face can be obtained through the mfnmesh::getnormals or Mitmeshpolygon::getnormal (index, Normal) method.

Per-polygon normals:

stores the normals for each polygon face, which the user can obtain by Mitmeshpolygon::getnormal (normal) or mfnmesh::getpolygonnormal.

Per-vertex:

Stores the normals of each vertex, and the discovery information is independent of polygon polygons. This object is not stored in the object, but it is calculated by requesting it in Maya, which is calculated by averaging the discovery of a vertex's adjacent polygon. Users can get a list by mfnmesh::getvertexnormal or mitmeshvertex::getnormal.

Maya provides a series of iterators (Mitmeshpolygon,Mitmeshedge,Mitmeshvertex) to provide specific control methods for vertices, edge lines, and polygons, These iterators are useful when working with these components.

The next is a bunch of methods about the class, too long I will not talk nonsense, most people just familiar with the data structure of the class to know how to use. So a little bit, just write a few of their own methods:

BOOL isedgesmooth (int edgeid, mstatus *returnstatus=null) const

Mstatus setedgesmoothing (int edgeid, bool smooth=true)

Mstatus cleanupedgesmoothing ()

Mstatus createinplace (int numvertices, int numpolygons, const Mfloatpointarray &vertexarray,

Const Mintarray &polygoncounts, const mintarray &polygonconnects)

Mobject Generatesmoothmesh (mobject parentorowner, mstatus *returnstatus)

Mfnmesh (const mobject &object, mstatus *ret=null)

Mobject mfnmesh::create (int numvertices,

int Numpolygons,

Const Mfloatpointarray &vertexarray,

Const Mintarray &polygoncounts,

Constmintarray &polygonconnects,

Mobject Prentorowner = Mobeject::knullobj,

Mstatus * ReturnStatus =null)

Maya draws a tree chart in the node editor based on the data provided.

Translation of MFNMESH.H usage instructions in Maya

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.