#include <mnmesh.h>
The MNMesh class is provided for temporary use by plug-ins, to help with complex topology-based modifications to Meshes.
It has certain capabilities, such as the ability to recognize faces with more than 3 sides, that are useful in some applications. It is not suitable for use as a pipeline object. All methods of this class are implemented by the system.
MNMesh has a winged-edge structure and a highly interlinked topology. This is very useful for some modifiers, but requires far more memory and processing time than an equivalent normal mesh. It's convenient for the programmer, but may be sluggish for the user.
Although some methods can be a bit slow, none of them are non-linear in the amount of time they take. Even the tessellation algorithms, which can as much as quadruple the size of the meshes, operate locally, vertex by vertex, so they are order-of-n algorithms.
MNMesh derives from FlagUser and supports the flags listed at MNMesh Flags.
See the topic MNMesh Note on Debugging for information about debugging MNMesh.
Public Member Functions | |
DllExport void | FacePointBary (int ff, Point3 &p, Tab< float > &bary) |
Finds "Generalized Barycentric Coordinates" for the point given. More... | |
DllExport void | FindFaceBaryVector (int face, int vertIndex, Point3 &vector, Tab< float > &tBary) |
Constructors and Destructors | |
MNMesh () | |
Initializes the MNMesh with no components and the default flags. More... | |
MNMesh (const Mesh &from) | |
Constructor. More... | |
MNMesh (const MNMesh &from) | |
Copy constructor. More... | |
DllExport | ~MNMesh () |
Destructor. More... | |
Allocation and Initialization Methods | |
void | DefaultFlags () |
Clears all flags. More... | |
DllExport void | Init () |
The data members are initialized as follows: More... | |
DllExport void | VAlloc (int num, bool keep=TRUE) |
Allocates and inits the specified number of MNVerts. More... | |
DllExport void | VShrink (int num=-1) |
Shrinks the nv_alloc size of the MNVert array to the specified size. More... | |
DllExport void | freeVEdge () |
Deallocates any MNEdges in the vedg table and sets the vedg pointer to NULL. More... | |
DllExport void | VEdgeAlloc () |
Allocates the vedg array. More... | |
DllExport void | freeVFace () |
Deallocates the vfac array. More... | |
DllExport void | VFaceAlloc () |
Allocates the vfac array. More... | |
DllExport void | EAlloc (int num, bool keep=TRUE) |
Allocates the MNEdge data array e with the specified size. More... | |
DllExport void | EShrink (int num=-1) |
Reduces the ne_alloc size of the MNEdge data array e to the specified number of elements. More... | |
DllExport void | FAlloc (int num, bool keep=TRUE) |
Allocates the MNFace array f with the specified size. More... | |
DllExport void | FShrink (int num=-1) |
Reduces the nf_alloc size of the MNFace data array f to the specified number of elements. More... | |
DllExport void | MAlloc (int num, bool keep=TRUE) |
Allocates the MNMap array m with the specified size. More... | |
DllExport void | MShrink (int num=-1) |
Reduces the nm_alloc size of the MNMap data array m to the specified number of elements. More... | |
Component Access Functions | |
int | VNum () const |
Returns the number of vertices. More... | |
MNVert * | V (int i) const |
Returns a pointer to the i'th MNVert. More... | |
Point3 & | P (int i) const |
Returns the point in the i'th MNVert. More... | |
int | ENum () const |
Returns the number of edges. More... | |
MNEdge * | E (int i) const |
Returns a pointer to the i'th MNEdge. More... | |
int | FNum () const |
Returns the number of faces. More... | |
MNFace * | F (int i) const |
Returns a pointer to the i'th MNFace. More... | |
int | MNum () const |
Internal. More... | |
DllExport int | TriNum () const |
Number of triangles. More... | |
Mapping Methods | |
DllExport MNMap * | M (int mapChannel) const |
This accessor accepts a value in the range -NUM_HIDDENMAPS to MNum(). More... | |
DllExport void | SetMapNum (int mpnum) |
Allocates and initializes the specified number of MNMap elements in the m array. More... | |
DllExport void | InitMap (int mapChannel) |
Allocates and initializes basic planar map, or a white map for the vertex color channel. More... | |
DllExport void | ClearMap (int mapChannel) |
Clears and frees the specified map channel, setting the MN_DEAD flag. More... | |
DllExport UVVert | MV (int mapChannel, int i) const |
Returns the specified UVVert from the specified mapping channel. More... | |
DllExport MNMapFace * | MF (int mapChannel, int i) const |
Returns a pointer to the specified MNMapFace from the specified mapping channel. More... | |
DllExport UVVert | ExtrapolateMapValue (int face, int edge, Point3 &pt, int mapChannel) |
Returns the total number of triangles; this is a sum of the number of triangles in each face that does not have the MN_DEAD flag set. More... | |
DllExport bool | SeparateMapVerticesInFaceCluster (MNFaceClusters &fclust, int clusterID) |
Detaches the texture vertices on the border edges of the fclust. More... | |
DllExport bool | IsEdgeMapSeam (int mapChannel, int edge) |
Returns whether an edge is a seam or not. More... | |
DllExport void | FindEdgeListMapVerts (const Tab< int > &lp, Tab< int > &mv, int mapChannel) |
Returns map verts for both ends of each edge (from f1's perspective) (Very useful for creating new faces at borders.) mv[j*2] is the map vertex corresponding to edge j's v1. More... | |
Per-Vertex Data | |
DllExport void | setNumVData (int ct, BOOL keep=FALSE) |
Sets the specified number of vertex data elements. More... | |
int | VDNum () const |
Returns the number of vertex data channels maintained by this MNMesh. More... | |
DllExport BOOL | vDataSupport (int vdChannel) const |
Returns TRUE if the specified channel of vertex data is available for this MNMesh; otherwise FALSE. More... | |
DllExport void | setVDataSupport (int vdChannel, BOOL support=TRUE) |
Sets if the specified channel of vertex data is supported by this MNMesh. More... | |
void * | vertexData (int vdChannel) const |
Returns a pointer to the vertex data for the specified channel or NULL if the channel is not supported. More... | |
float * | vertexFloat (int vdChannel) const |
Returns a pointer to the floating point vertex data for the specified channel of this mesh or NULL if the channel is not supported. More... | |
DllExport void | freeVData (int vdChannel) |
Deletes (deallocates) the vertex data for the specified channel. More... | |
DllExport void | freeAllVData () |
Deallocates the vertex data from all channels and sets the number of supported channels to 0. More... | |
Vertex Weight Methods | |
float * | getVertexWeights () |
Returns a pointer to the floating point vertex weight data. More... | |
void | SupportVertexWeights () |
Sets the channel support for the vertex weights channel (VDATA_WEIGHT). More... | |
void | freeVertexWeights () |
Frees (deallocates) the vertex weight channel data. More... | |
float * | getVSelectionWeights () |
Returns a pointer to the floating point vertex selection weight data. More... | |
void | SupportVSelectionWeights () |
Sets the channel support for the vertex weights channel (VDATA_SELECT). More... | |
void | freeVSelectionWeights () |
Frees (deallocates) the vertex selection weight channel data. More... | |
Per-Edge Data | |
DllExport void | setNumEData (int ct, BOOL keep=FALSE) |
Sets the specified number of edge data elements. More... | |
int | EDNum () const |
Returns the number of edge data channels maintained by this MNMesh. More... | |
DllExport BOOL | eDataSupport (int edChannel) const |
Returns TRUE if the specified channel of edge data is available for this MNMesh; otherwise FALSE. More... | |
DllExport void | setEDataSupport (int edChannel, BOOL support=TRUE) |
Sets if the specified channel of edge data is supported by this MNMesh. More... | |
void * | edgeData (int edChannel) const |
Returns a pointer to the edge data for the specified channel or NULL if the channel is not supported. More... | |
float * | edgeFloat (int edChannel) const |
Returns a pointer to the floating point edge data for the specified channel of this MNMesh or NULL if the channel is not supported. More... | |
DllExport void | freeEData (int edChannel) |
Deletes (deallocates) the edge data for the specified channel. More... | |
DllExport void | freeAllEData () |
Deallocates the edge data from all channels and sets the number of supported channels to 0. More... | |
Edge Knot Methods | |
float * | getEdgeKnots () |
Returns a pointer to the floating point edge knot data. More... | |
void | SupportEdgeKnots () |
Sets the channel support for the edge knot channel (EDATA_KNOT). More... | |
void | freeEdgeKnots () |
Frees (deallocates) the edge knot channel data. More... | |
Vertex Face and Edge Methods | |
DllExport void | VClear (int vv) |
Clears and frees the flags and face/edge lists for the specified vertex. More... | |
DllExport void | VInit (int vv) |
Initializes the specified MNVert, clearing its flags and emptying its face & edge lists (if vfac & edg are allocated). More... | |
DllExport int | VFaceIndex (int vv, int ff, int ee=-1) |
Returns the index of face ff in the vfac[vv] table. More... | |
DllExport int | VEdgeIndex (int vv, int ee) |
This method is available in release 3.0 and later only. More... | |
void | VDeleteEdge (int vv, int ee) |
This method is available in release 3.0 and later only. More... | |
DllExport void | VDeleteFace (int vv, int ff) |
This method is available in release 3.0 and later only. More... | |
DllExport void | VReplaceEdge (int vv, int oe, int ne) |
This method is available in release 3.0 and later only. More... | |
DllExport void | VReplaceFace (int vv, int of, int nf) |
This method is available in release 3.0 and later only. More... | |
DllExport void | CopyVert (int nv, int ov) |
This method is available in release 3.0 and later only. More... | |
DllExport void | MNVDebugPrint (int vv) |
This method is available in release 3.0 and later only. More... | |
Mesh Building Functions | |
DllExport int | NewTri (int a, int b, int c, DWORD smG=0, MtlID mt=0) |
Creates a new tri-face. More... | |
DllExport int | NewTri (int *vv, DWORD smG=0, MtlID mt=0) |
Creates a new face of degree 3. More... | |
DllExport int | NewQuad (int a, int b, int c, int d, DWORD smG=0, MtlID mt=0) |
This method will create a new quad. More... | |
DllExport int | NewQuad (int *vv, DWORD smG=0, MtlID mt=0) |
This method will create a new quad. More... | |
DllExport int | NewFace (int initFace, int degg=0, int *vv=NULL, bool *vis=NULL, bool *sel=NULL) |
This method creates a (single) new face with the characteristics given. More... | |
DllExport int | CreateFace (int degg, int *vv) |
Creates a new face, using the vertices given. More... | |
DllExport int | AppendNewFaces (int nfnum) |
Appends the specified number of MNFaces to f. More... | |
DllExport void | setNumFaces (int nfnum) |
Sets the specified number of MNFaces allocated in f. More... | |
DllExport int | RegisterEdge (int v1, int v2, int leftFace, int fpos) |
Edge creation tool. More... | |
DllExport int | SimpleNewEdge (int v1, int v2) |
Edge creation tool. More... | |
DllExport int | NewEdge (int v1, int v2, int leftFace, int fpos) |
Edge creation tool. More... | |
DllExport int | AppendNewEdges (int nenum) |
Appends the specified number of edges. More... | |
DllExport void | setNumEdges (int nenum) |
Sets the number of MNEdges allocated in e. More... | |
DllExport int | NewVert (Point3 &p) |
Creates a new vertex (increasing numv) and sets it to the specified point. More... | |
DllExport int | NewVert (Point3 &p, int vid) |
This method is available in release 3.0 and later only. More... | |
DllExport int | NewVert (int vid) |
Creates a new vertex and initializes it to location, flags and other characteristics of vertex vid. More... | |
DllExport int | NewVert (int v1, int v2, float prop) |
Creates a new vertex which is a linear combination of two existing vertices. More... | |
DllExport int | AppendNewVerts (int nvnum) |
Appends the specified number of MNVerts. More... | |
DllExport void | setNumVerts (int nvnum) |
Sets the number of verts, allocating if needed. More... | |
DllExport int | InsertSpur (int face, int vertIndex, Tab< int > *ptMapVertArray=NULL) |
Creates a spur on the face at vertexIndex. More... | |
Component Removal Routines | |
To delete a component set the appropriate MN_XXX_DEAD flags (e.g. MN_EDGE_DEAD) and use following routines. These all have O(N) complexity. | |
DllExport void | CollapseDeadVerts () |
Removes all MNVerts with the MN_DEAD flag from the list of vertices. More... | |
DllExport void | CollapseDeadEdges () |
Removes all MNEdges with the MN_DEAD flag from the list of edges. More... | |
DllExport void | CollapseDeadFaces () |
Removes all MNFaces with the MN_DEAD flag from the list of faces. More... | |
DllExport void | CollapseDeadStructs () |
Performs all 5 of the above collapse functions, safely removing all unused components from this mesh. More... | |
DllExport void | Clear () |
Reinitializes all verts, faces, and edges, freeing the data members of these components, but not freeing the vertex, edge, and face arrays themselves. More... | |
DllExport void | ClearAndFree () |
Deletes everything and frees all relevant memory. More... | |
DllExport void | freeVerts () |
Deletes the MNVert array and frees any corresponding vertex data. More... | |
DllExport void | freeEdges () |
Deletes the MNEdge array and frees and corresponding edge data. More... | |
DllExport void | freeFaces () |
Deletes the MNFace array. More... | |
DllExport void | freeMap (int mapChannel) |
Deletes the MNMap on the specified map channel. More... | |
DllExport void | freeMaps () |
Deletes and frees all the MNMaps. More... | |
DllExport bool | RemoveVertex (int vertex) |
DllExport bool | RemoveSpur (int spur) |
DllExport void | DeleteFlaggedFaces (DWORD deathflags, DWORD nvCopyFlags=0x0) |
Deletes faces with any of the death flags set, as well as delete vertices and edges surrounded by faces with death flags, and correct the mesh components remaining. More... | |
DllExport void | RemoveEdge (int edge) |
Kills the edge and joins the faces on either side. More... | |
DllExport void | EliminateCollinearVerts () |
This routine scans through a mesh from which invisible edges have been removed, looking for vertices that essentially seem to lie in the middle of edges. More... | |
DllExport void | EliminateCoincidentVerts (float thresh=MNEPS) |
This merges vertices that lie extremely close together, similar to what's done in Edit Mesh's Weld function, but it only affects vertices that are joined by an edge. More... | |
Bulk Flag Clearing and Setting Functions | |
void | ClearVFlags (DWORD fl) |
Clears all specified flag bits in all MNVerts. More... | |
void | ClearEFlags (DWORD fl) |
Clears all specified flag bits in all MNEdges. More... | |
void | ClearFFlags (DWORD fl) |
Clears all specified flag bits in all MNFaces. More... | |
DllExport void | PaintFaceFlag (int ff, DWORD fl, DWORD fenceflags=0x0) |
Recursively sets flag on given face and all faces connected to it. More... | |
DllExport int | PropegateComponentFlags (int slTo, DWORD flTo, int slFrom, DWORD flFrom, bool ampersand=FALSE, bool set=TRUE) |
This allows the developer to set flags in one type of component based on what the nearby flags of another type of component are. More... | |
DllExport void | UpdateBackfacing (GraphicsWindow *gw, bool force) |
Updates the MN_BACKFACING flag in all components based on the specified view. More... | |
Selection Methods | |
DllExport void | VertexSelect (const BitArray &vsel) |
Selects or deselects the vertices as specified by on bits in the given bit array. More... | |
DllExport void | EdgeSelect (const BitArray &esel) |
Selects or deselects the edges as specified by on bits in the given bit array. More... | |
DllExport void | FaceSelect (const BitArray &fsel) |
Selects or deselects the faces as specified by on bits in the given bit array. More... | |
bool | getVertexSel (BitArray &vsel) |
Fills the given bit array with the current vertex selection state. More... | |
bool | getEdgeSel (BitArray &esel) |
Fills the given bit array with the current edge selection state. More... | |
bool | getFaceSel (BitArray &fsel) |
Fills the given bit array with the current face selection state. More... | |
DllExport void | SelectEdgeLoop (BitArray &edgeSel) |
Using the current edge selection this returns the original selection and the edge loop defined by those selections. More... | |
DllExport void | SelectEdgeRing (BitArray &edgeSel) |
Using the current edge selection this returns the original selection and the ring loop defined by those selections. More... | |
DllExport BitArray | VertexTempSel (DWORD fmask=MN_DEAD|MN_SEL, DWORD fset=MN_SEL) |
Gets the current vertex selection, based on the current selection level. More... | |
Getting Components by Flag | |
DllExport bool | getVerticesByFlag (BitArray &vset, DWORD flags, DWORD fmask=0x0) |
Creates a BitArray of all vertices using the specified flags. More... | |
DllExport bool | getEdgesByFlag (BitArray &eset, DWORD flags, DWORD fmask=0x0) |
Creates a BitArray of all edges using the specified flags. More... | |
DllExport bool | getFacesByFlag (BitArray &fset, DWORD flags, DWORD fmask=0x0) |
Creates a BitArray of all faces using the specified flags. More... | |
DllExport void | ElementFromFace (int ff, BitArray &fset) |
Sets bits for all faces in the same "element", or connected component, with face ff. More... | |
DllExport void | BorderFromEdge (int ee, BitArray &eset) |
Takes a one-sided edge and sets the bits representing this edge's "border". More... | |
Edge Visibility and Selection Methods | |
DllExport void | SetEdgeVis (int ee, BOOL vis=TRUE) |
This not only sets the edge's MN_EDGE_INVIS flag, it also sets the visedg state of the faces on either side. More... | |
DllExport void | SetEdgeSel (int ee, BOOL sel=TRUE) |
This not only sets the edge's MN_SEL flag, it also sets the edgsel state of the faces on either side. More... | |
Mesh Compatibility Functions | |
void | SetFromTri (const Mesh &from) |
Clears out all current information, and copies in new faces and vertices from the from argument. More... | |
DllExport void | AddTri (const Mesh &from) |
Adds vertices and faces in "from" to current MNMesh. More... | |
DllExport void | OutToTri (Mesh &tmesh) |
Outputs current MNMesh into the mesh given. More... | |
Mesh Computation Functions | |
DllExport void | FillInMesh () |
If this mesh does not have the MN_MESH_FILLED_IN flag, this method completely recomputes all combinatorial information. More... | |
DllExport void | FillInFaceEdges () |
Fills in the faces' edge arrays based on the edge list. More... | |
DllExport void | FillInVertEdgesFaces () |
Fills in the vertex edge and face lists based on the edge list. More... | |
DllExport bool | EliminateBadVerts (DWORD flag=0) |
A "bad" vertex in this context is one which is shared between two distinct boundaries for this mesh. More... | |
DllExport void | OrderVerts () |
This routine organizes the face and edge lists of each vertex such that going counterclockwise around the vertex (with the surface normal pointing up), you'll encounter edg[0], fac[0], edg[1], fac[1], etc, ending in either the last face if the vertex is not on a boundary or the last edge if the vertex is on a boundary. More... | |
DllExport void | OrderVert (int vid) |
This routine organizes the face and edge lists of the specified vertex such that going counterclockwise around the vertex (with the surface normal pointing towards you), you'll encounter edg[0], fac[0], edg[1], fac[1], etc, ending in either the last face if the vertex is not on a boundary or the last edge if the vertex is on a boundary. More... | |
Mesh Triangulation Routines | |
DllExport void | Triangulate () |
Converts a MN_MESH_NONTRI mesh, with polygon faces and possibly hidden vertices, into a completely triangulated mesh, wherein all faces have degree 3. More... | |
DllExport void | TriangulateFace (int ff) |
Triangulates the specified face, splitting it into as many faces as are needed (deg-2+hdeg*2) to represent all the triangles. More... | |
DllExport int | DivideFace (int ff, Tab< float > &bary) |
Divides a face by creating a point in the face's interior and creating an edge from that point to each of the face's vertices. More... | |
DllExport int | DivideFace_2015 (int ff, Tab< float > &bary) |
Identical to DivideFace but should only be used to load parametric divides for file 2015 and lower. More... | |
Bounding Box Methods | |
DllExport void | FaceBBox (int ff, Box3 &bbox) |
Finds the bounding box of all vertices and hidden vertices used by face ff. More... | |
DllExport void | BBox (Box3 &bbox, bool targonly=FALSE) |
Calculates the bounding box of the vertices & hidden vertices of this mesh. More... | |
DllExport Box3 | getBoundingBox (Matrix3 *tm=NULL, bool targonly=FALSE) |
Retrieves a bounding box for the MNMesh. More... | |
Targeting Methods | |
DllExport int | TargetVertsBySelection (int iSelLevel) |
Sets vertex MN_TARG flags based on the existing MN_SEL flags. More... | |
DllExport int | TargetEdgesBySelection (int iSelLevel) |
Sets edge MN_TARG flags based on the existing MN_SEL flags. More... | |
DllExport int | TargetFacesBySelection (int iSelLevel) |
Sets face MN_TARG flags based on the existing MN_SEL flags. More... | |
DllExport void | DetargetVertsBySharpness (float sharpval) |
Clears the MN_TARG flag on vertices representing relatively flat areas, keeping the flag on vertices at sharper corners. More... | |
Face-Center methods | |
DllExport void | ComputeCenters (Point3 *ctr, bool targonly=FALSE) |
Finds the centers of all the faces, using repeated calls to ComputeCenter. More... | |
DllExport void | ComputeCenter (int ff, Point3 &ctr) |
Finds the center of face ff by finding the average of all its vertices. More... | |
DllExport void | ComputeNormal (int ff, Point3 &normal, Point3 *ctr=NULL) |
Computes a "balanced" normal, in that the normal takes the contribution of all vertices equally. More... | |
DllExport void | ComputeSafeCenters (Point3 *ctr, bool targonly=FALSE, bool detarg=FALSE) |
Finds the "safe" centers of all the faces, using repeated calls to ComputeSafeCenter. More... | |
DllExport bool | ComputeSafeCenter (int ff, Point3 &ctr) |
Finds the "safe" center of face ff, if possible. More... | |
Triangulation-of-polygon Methods | |
DllExport void | RetriangulateFace (int ff) |
Throws out the current triangulation for face ff and computes a new one. More... | |
DllExport void | FindDiagonals (int ff, int *diag) |
Finds a diagonal of face ff that does not include any hidden vertices. More... | |
DllExport void | FindDiagonals (int deg, int *vv, int *diag) |
This method finds diagonals for this sequence of vertices, creating a triangulation for the polygon they form. More... | |
DllExport void | BestConvexDiagonals (int ff, int *diag=NULL) |
If the given face is convex, this will often produce a better diagonals than RetriangulateFace would. More... | |
DllExport void | BestConvexDiagonals (int deg, int *vv, int *diag) |
Uses a triangulation scheme optimized for convex polygons to find a set of diagonals for this sequence of vertices, creating a triangulation for the polygon they form. More... | |
DllExport bool | SetDiagonal (int ff, int d1, int d2) |
Unification Methods | |
These methods turn triangle meshes into polygon meshes | |
DllExport void | MakePolyMesh (int maxdeg=0, BOOL elimCollin=TRUE) |
Unifies triangles into polygons across invisible edges. More... | |
DllExport void | MakeConvexPolyMesh (int maxdeg=0) |
Turns a mesh with triangle faces into a mesh with (fewer) convex polygon faces by removing all hidden edges that aren't necessary to maintain convexity. More... | |
Normal methods | |
DllExport int | FindEdgeFromVertToVert (int vrt1, int vrt2) |
Some of these methods do not make use of user-specified normals or smoothing groups. More... | |
DllExport void | GetVertexSpace (int vrt, Matrix3 &tm) |
Chooses a suitable "local space", and sets tm's rotation to match that space. More... | |
DllExport Point3 | GetVertexNormal (int vrt) |
Returns the surface normal at the vertex vrt. More... | |
DllExport Point3 | GetEdgeNormal (int edgeIndex) |
Returns the surface normal at the edge edgeIndex. More... | |
DllExport Point3 | GetFaceNormal (int fc, bool nrmlz=FALSE) |
Returns the surface normal of face fc. More... | |
Point3 | GetEdgeNormal (int vrt1, int vrt2) |
This merely combines GetEdgeNormal (int ed) with FindEdge (int vrt1, int vrt2). More... | |
DllExport float | EdgeAngle (int edgeIndex) |
Computes the angle at the given edge. More... | |
DllExport void | FlipNormal (int faceIndex) |
Flips the normal of the specified face, as well as the corresponding map faces in active maps. More... | |
DllExport void | checkNormals (BOOL illum) |
This method can be used to build the normals and allocate RVert space only if necessary. More... | |
DllExport void | buildNormals () |
This method resolves the normals on the RVertex array. More... | |
DllExport void | buildRenderNormals () |
This method is similar to buildNormals() above, but ignores the material index (mtlIndex). More... | |
DllExport bool | FlipElementNormals (DWORD flag=MN_SEL) |
Flips the normals of the specified elements in the mesh. More... | |
DllExport bool | FlipFaceNormals (DWORD faceFlag) |
This flips the face normals of the tagged faces and also reverses the face winding. More... | |
Smoothing Group Handling | |
DllExport void | Resmooth (bool smooth=TRUE, bool targonly=FALSE, DWORD targmask=~0x0) |
Applies new smoothing (or removes smoothing groups) from selected areas of the MNMesh. More... | |
DllExport DWORD | CommonSmoothing (bool targonly=FALSE) |
Finds what smoothing groups, if any, are common to all faces in this MNMesh. More... | |
DllExport DWORD | GetNewSmGroup (bool targonly=FALSE) |
Produces a single smoothing group that is not currently used in the MNMesh. More... | |
DllExport MtlID | GetNewMtlID (bool targonly=FALSE) |
Produces the lowest material ID not used in any faces in the MNMesh. More... | |
DllExport DWORD | GetOldSmGroup (bool targonly=FALSE) |
Returns a smoothing group that is currently used somewhere in the mesh, or returns zero if all faces have no smoothing. More... | |
DllExport DWORD | GetAllSmGroups (bool targonly=FALSE) |
Find all smoothing groups used in this mesh. More... | |
DllExport DWORD | FindReplacementSmGroup (int ff, DWORD os) |
Finds available smoothing groups you can use to replace the given smoothing group without messing up the mesh's shading. More... | |
DllExport void | PaintNewSmGroup (int ff, DWORD os, DWORD ns) |
Recursively replaces the old smoothing group with the new smoothing group. More... | |
DllExport bool | SeparateSmGroups (int v1, int v2) |
Changes the smoothing groups on faces using v2 so that they are distinct from any smoothing groups on faces using v1. More... | |
DllExport void | AutoSmooth (float angle, BOOL useSel, BOOL preventIndirectSmoothing) |
Applies new smoothing groups to the whole mesh or to selected faces based on angles between faces. More... | |
DllExport DWORD | FindAvailableSmoothingGroups (int faceIndex, DWORD excludeSmoothing=0) |
Return a DWORD of smoothing groups that a face can use without smoothing to any adjacent face (either across shared edges or shared vertices). More... | |
DllExport DWORD | FindAvailableSmoothingGroupFromFaceList (IntTab faceList, DWORD excludeSmoothing=0) |
Return a DWORD containing the lowest-order smoothing group that a list of faces can use without smoothing to any adjacent face (either across shared edges or shared vertices). More... | |
DllExport bool | OptimizeSmoothingGroups (BitArray optimizeFaces) |
Process the specified faces and eliminate any redundant smoothing group usage. More... | |
Fence Methods | |
DllExport void | FenceMaterials () |
These methods make fences for the MNMesh::SabinDoo() algorithm. More... | |
DllExport void | FenceSmGroups () |
Sets the MN_EDGE_NOCROSS flag on all edges that lie between faces with exclusive smoothing groups. More... | |
DllExport void | FenceFaceSel () |
Sets the MN_EDGE_NOCROSS flag on all edges that lie between selected & non-selected faces. More... | |
DllExport void | FenceOneSidedEdges () |
Sets the MN_EDGE_NOCROSS flag on all edges that are on the boundary. More... | |
DllExport void | FenceNonPlanarEdges (float thresh=.9999f, bool makevis=FALSE) |
Sets MN_EDGE_NOCROSS flags on edges between faces that aren't in the same plane. More... | |
DllExport void | SetMapSeamFlags () |
Sets the MN_EDGE_MAP_SEAM on all edges that are "seams" for any active map(s). More... | |
DllExport void | SetMapSeamFlags (int mapChannel) |
Sets the MN_EDGE_MAP_SEAM on all edges that are "seams" for the specified map(s). More... | |
Face Point Functions | |
These functions are for querying details about a point on a face. | |
DllExport int | FindFacePointTri (int ff, Point3 &pt, double *bary, int *tri) |
Finds the sub-triangle and (optionally) barycentric coordinates within that triangle of a point that lies on this face. More... | |
DllExport UVVert | FindFacePointMapValue (int ff, Point3 &pt, int mapChannel) |
This method is available in release 3.0 and later only. More... | |
Hole Fixing Functions | |
DllExport void | GetBorder (MNMeshBorder &brd, int selLevelType=MNM_SL_OBJECT, DWORD targetFlag=MN_SEL) |
Finds border loops composed of all one-sided edges. More... | |
DllExport void | FillInBorders (MNMeshBorder *b=NULL) |
Fills in all the borders of a mesh. More... | |
DllExport void | FindOpenRegions () |
Scans mesh to determine what parts of it are open or closed. More... | |
Doubled Mapping Vertex Functions | |
Double mapped vertexes are individual map vertices that are used to correspond to different regular vertices. For example, the standard map on the box object uses the same mapping vertices on the top as on the bottom. This can be a problem if the user wants to change the map in one region, but not the other. It also causes problems in NURMS MeshSmooth, where the user can change weights in one region but not in the other. So the following methods detect and fix such vertices. | |
DllExport BOOL | CheckForDoubledMappingVerts () |
This method is a debugging tool. More... | |
DllExport void | EliminateDoubledMappingVerts () |
Eliminates double mapped vertices in linear time. More... | |
Isolated Mapping Vertex Functions | |
Isolated mapping vertices are vertexes that aren't used by any mapping faces. | |
DllExport void | EliminateIsoMapVerts () |
Deletes isolated mapping vertices. More... | |
DllExport void | EliminateIsoMapVerts (int mapChannel) |
Deletes isolated mapping vertices on a specific channel. More... | |
Operators | |
DllExport MNMesh & | operator= (const MNMesh &from) |
Assignment operator. More... | |
DllExport MNMesh & | operator+= (const MNMesh &from) |
Union operator. More... | |
Debugging Functions | |
Uses DebugPrint to print out the entire MNMesh to the Debug Results window in DevStudio. This can be useful for tracking down bugs. Be careful not to leave MNDebugPrint calls in your final build; they will slow down your effect to no purpose.
| |
DllExport void | MNDebugPrint (bool triprint=FALSE) |
DllExport void | MNDebugPrintVertexNeighborhood (int vv, bool triprint=FALSE) |
Uses DebugPrint to print out information about all the edges, faces, and vertices in the immediate vicinity of vertex vv. More... | |
DllExport bool | CheckAllData () |
Thoroughly checks a MNMesh to make sure that no components refer to dead components; that when one component refers to another, the other refers back to the first; and that orientation is correctly matched between faces and edges. More... | |
Splitting and Subdividing Method | |
DllExport int | SplitTriEdge (int ee, float prop=.5f, float thresh=MNEPS, bool neVis=TRUE, bool neSel=FALSE) |
Creates a new vertex in the middle of an edge, splitting the edge into two edges. More... | |
DllExport int | SplitTriFace (int ff, double *bary=NULL, float thresh=MNEPS, bool neVis=TRUE, bool neSel=FALSE) |
Adds a vertex somewhere in a triangle face, and also adds edges from that vertex to each of the corners, splitting the face into 3 smaller triangle faces. More... | |
DllExport void | SplitTri6 (int ff, double *bary=NULL, int *nv=NULL) |
This is another way to subdivide a face on a triangular mesh into sub-triangles. More... | |
DllExport int | SplitEdge (int ee, float prop=.5f) |
Creates a new vertex somewhere in the middle of an edge, splitting the edge into two edges. More... | |
DllExport int | SplitEdge (int ee, float prop, Tab< int > *newTVerts) |
This new SplitEdge variant allows you to recover information about the new map vertices created at the point where the edge is split. More... | |
DllExport int | SplitEdge (int ff, int edgeIndex, float prop, bool right, int *nf=NULL, int *ne=NULL, bool neVis=FALSE, bool neSel=FALSE, bool allconvex=FALSE) |
Splits an edge that is specified from the face level, and splits off triangles from the adjacent faces. More... | |
DllExport int | IndentFace (int ff, int ei, int nv, int *ne=NULL, bool nevis=TRUE, bool nesel=FALSE) |
Uses a new vertex to "indent" one of the sides of the face. More... | |
DllExport void | SeparateFace (int ff, int a, int b, int &nf, int &ne, bool neVis=FALSE, bool neSel=FALSE) |
This routine takes a larger face and divides it into two smaller faces, creating a new edge in the process. More... | |
DllExport bool | Slice (Point3 &N, float off, float thresh, bool split, bool remove, bool flaggedFacesOnly=false, DWORD faceFlags=MN_SEL) |
Slices the MNMesh along a specified plane, splitting edges and faces as needed to divide faces into those above and those below the plane. More... | |
DllExport bool | SplitFlaggedVertices (DWORD flag=MN_SEL) |
Splits the flagged vertices into a clone for each face using the vertex. More... | |
DllExport bool | SplitFlaggedEdges (DWORD flag=MN_SEL) |
"Splits" edges by breaking vertices on two or more flagged edges into as many copies as needed. More... | |
DllExport bool | SplitFacesUsingBothSidesOfEdge (DWORD edgeFlag=0x0) |
DllExport void | MultiDivideEdge (int edge, int segments) |
Splits an edge into multiple edges. More... | |
DllExport void | MakeConvex () |
Calls MakeFaceConvex() on all (non-dead) faces, producing a mesh with 100% convex faces. More... | |
DllExport void | MakeFaceConvex (int ff) |
Makes face ff convex, essentially by chopping off corners. More... | |
DllExport void | RestrictPolySize (int maxdeg) |
Subdivides polygons as needed so that no polygon has degree larger than maxdeg. More... | |
DllExport void | MakePlanar (float planarThresh) |
Makes all faces planar, within the angle threshold given, by subdividing them as necessary. More... | |
DllExport void | MakeFacePlanar (int ff, float planarThresh) |
Makes the specified face planar by subdividing if necessary. More... | |
Welding Functions | |
DllExport bool | WeldVerts (int a, int b) |
Welds vertices a and b, correcting the mesh topology to match. More... | |
DllExport bool | WeldEdge (int ee) |
Welds the endpoints of edge ee, correcting the mesh topology to match. More... | |
DllExport bool | WeldBorderVerts (int v1, int v2, Point3 *destination) |
Welds vertices v1 and v2 together. More... | |
DllExport bool | WeldBorderEdges (int e1, int e2) |
Welds the specified border edges together. More... | |
DllExport bool | WeldBorderVerts (float thresh, DWORD flag=MN_SEL) |
Welds the specified border vertices together. More... | |
DllExport bool | WeldOpposingEdges (DWORD edgeFlag) |
Welds pairs of one-sided edges between the same two vertices. More... | |
Tessellation Methods | |
DllExport void | TessellateByEdges (float bulge, MeshOpProgress *mop=NULL) |
This is a tessellation routine similar to AndersonDo(). More... | |
DllExport bool | AndersonDo (float interp, int iSelLevel, MeshOpProgress *mop=NULL, DWORD subdivFlags=0) |
It breaks every MNFace into deg new faces with four sides. More... | |
DllExport void | TessellateByCenters (MeshOpProgress *mop=NULL) |
Note that this algorithm roughly triples the size of the MNMesh. More... | |
DllExport void | SabinDoo (float interp, int iSelLevel, MeshOpProgress *mop=NULL, Tab< Point3 > *offsets=NULL) |
Note that this algorithm roughly triples the size of the MNMesh. More... | |
DllExport void | SabinDooVert (int vid, float interp, int iSelLevel, Point3 *ctr, Tab< Point3 > *offsets=NULL) |
This applies the Sabin-Doo tessellation technique to a single vertex. More... | |
DllExport void | CubicNURMS (MeshOpProgress *mop=NULL, Tab< Point3 > *offsets=NULL, DWORD subdivFlags=0) |
Non-uniform rational mesh smooth. More... | |
Boolean Methods | |
DllExport void | PrepForBoolean () |
Prepares a MNMesh for a Boolean operation. More... | |
DllExport bool | BooleanCut (MNMesh &m2, int cutType, int fstart=0, MeshOpProgress *mop=NULL) |
BooleanCut uses the same techniques as MakeBoolean to cut the faces of this with the faces of m2. More... | |
DllExport bool | MakeBoolean (MNMesh &m1, MNMesh &m2, int type, MeshOpProgress *mop=NULL) |
Makes this MNMesh into a Boolean result of the given MNMeshes. More... | |
Connection Methods | |
DllExport void | Connect (MNMeshBorder &borderList, int segs, float tension, bool sm_bridge, bool sm_ends, Tab< int > *vsep=NULL) |
Connect automatically figures out which loops in the given MNMeshBorder would make good candidates for connecting, and calls ConnectLoop on them all to connect them. More... | |
DllExport void | ConnectLoops (Tab< int > &loop1, Tab< int > &loop2, int segs, float tension, DWORD smGroup, MtlID mat, bool sm_ends) |
Connects two border loops by filling in new geometry between them, as is done in the Connect compound object. More... | |
DllExport bool | ConnectEdges (DWORD edgeFlag, int segments=2) |
Connect the marked edges of a polygon if they are opposing. More... | |
DllExport bool | ConnectVertices (DWORD vertexFlag) |
Connects tagged vertices across a polygon. More... | |
Face and Vertex Cloning Operations | |
DllExport void | CloneVerts (DWORD cloneFlag=MN_SEL, bool clear_orig=TRUE) |
Clones flagged vertices, creating new vertices that aren't used by any faces. More... | |
DllExport void | CloneFaces (DWORD cloneFlag=MN_SEL, bool clear_orig=TRUE) |
Clones the flagged faces, as well as all the vertices and edges that are used by the faces. More... | |
DllExport void | CopyBasics (const MNMesh &from, bool copyEdges=false) |
Copies bare geometry only - no per-vertex data, maps, or normals. More... | |
Plane Methods | |
DllExport bool | MakeFlaggedPlanar (int selLev, DWORD flag=MN_SEL, Point3 *delta=NULL) |
Moves the flagged components into their "average plane". More... | |
DllExport bool | MoveVertsToPlane (Point3 &norm, float offset, DWORD flag=MN_SEL, Point3 *delta=NULL) |
Projects the flagged vertices into the specified plane, or produces an array of offsets which would do so. More... | |
Detach Operations | |
DllExport bool | DetachFaces (DWORD flag=MN_SEL) |
Detaches specified faces to a separate element, cloning vertices and edges as necessary on the boundary between flagged and unflagged faces. More... | |
DllExport bool | DetachElementToObject (MNMesh &nmesh, DWORD fflags=MN_SEL, bool delDetached=true) |
Detaches specified faces (and related vertices and edges) to a new MNMesh. More... | |
Extrusion Methods | |
DllExport bool | ExtrudeFaceClusters (MNFaceClusters &fclust) |
Performs the topological component of an extrusion on all face clusters. More... | |
DllExport bool | ExtrudeFaceCluster (MNFaceClusters &fclust, int cl) |
Performs the topological component of an extrusion on the specified face cluster. More... | |
DllExport bool | ExtrudeFaces (DWORD flag=MN_SEL) |
Performs the topological component of an extrusion on each flagged face individually. More... | |
DllExport void | GetExtrudeDirection (MNChamferData *mcd, DWORD faceFlag) |
DllExport void | GetExtrudeDirection (MNChamferData *mcd, MNFaceClusters *fclust=NULL, Point3 *clustNormals=NULL) |
Finds the direction vectors for the geometric component of an extrusion after the topological component has been completed. More... | |
DllExport bool | ExtrudeVertices (DWORD vertexFlag, MNChamferData *pMCD, Tab< Point3 > &tUpDir) |
This computes the new extruded vertices from the selected vertices using the using the current vertex selection. More... | |
DllExport bool | ExtrudeEdges (DWORD edgeFlag, MNChamferData *pMCD, Tab< Point3 > &tUpDir) |
Same as ExtrudeVertices() but is applied to the edges. More... | |
DllExport bool | ExtrudeFaceClusterAlongPath (Tab< Matrix3 > tFrenets, MNFaceClusters &fclust, int clusterID, bool align) |
Extrudes a group of faces along a path defined by tFrenets. More... | |
Coloring Methods | |
DllExport bool | SetVertColor (UVVert clr, int mapChannel, DWORD flag=MN_SEL) |
Sets vertex colors for the specified vertices. More... | |
DllExport bool | SetFaceColor (UVVert clr, int mapChannel, DWORD flag=MN_SEL) |
Sets vertex colors for the specified faces. More... | |
Chamfer Operations | |
DllExport bool | ChamferVertices (DWORD flag=MN_SEL, MNChamferData *mcd=NULL) |
Performs the topological component of a vertex chamfer on the flagged vertices, and provides the data needed to do the geometric component. More... | |
DllExport bool | ChamferEdges (DWORD flag=MN_SEL, MNChamferData *mcd=NULL) |
Performs the topological component of an edge chamfer on the flagged edges, and provides the data needed to do the geometric component. More... | |
DllExport bool | QuadChamfer (float amount, int segments, float tension, MN_QCHAM_TYPE resultType, DWORD flag=MN_SEL) |
Performs a Quad Chamfer operation on the flagged edges using the original Max 2015 options and Max 2015 version of the Quad Chamfer algorithm. More... | |
DllExport bool | QuadChamfer (float amount, int segments, float tension, DWORD optionFlags, MN_QCHAM_TYPE resultType, DWORD flag=MN_SEL, int version=QCHAM_VERSION_LATEST) |
Performs a Quad Chamfer operation on the flagged edges with options and versioning. More... | |
Pipeline Object Functions | |
DllExport void | ApplyMapper (UVWMapper &mapChannel, int channel=0, BOOL useSel=FALSE) |
Applies UVW Mapper to create the desired mapping in the specified channel. More... | |
DllExport void | InvalidateGeomCache () |
Invalidates information, like bounding box and face normals, that's dependent on Geometry. More... | |
DllExport void | InvalidateTopoCache (bool in_clearCacheFlags=true) |
Clears out topology-dependent cache information. More... | |
DllExport void | UpdateDisplayVertexColors () |
This method is used to manage the display of vertex colors from any channel (or those that are passed in by some calling routine). More... | |
DllExport void | SetDisplayVertexColors (int chan) |
This method is used to manage the display of vertex colors from any channel (or those that are passed in by some calling routine). More... | |
DllExport void | SetDisplayVertexColors (UVVert *mv, MNMapFace *mf) |
If you have cached your own vertex color information that isn't in any of the map channels provided, you can use this method to set the internal pointers to use your data. More... | |
DllExport void | PrepForPipeline () |
This method reconciles flags with arrays, checks and modifies data, ensures that the caches are consistent, and prepares the MNMesh pipeline. More... | |
DllExport void | allocRVerts () |
Allocates the "render vertices" used to optimize display routines. More... | |
DllExport void | updateRVerts (GraphicsWindow *gw) |
Fills in the render vertices with display coordinates based on the specified view. More... | |
DllExport void | freeRVerts () |
Frees the "render vertices" used to optimize display routines. More... | |
Display Flag Methods | |
See MNMesh Display Flags for a list of supported display flags. | |
void | SetDispFlag (DWORD vflags) |
This method allows you to set the display flags. More... | |
DWORD | GetDispFlag (DWORD vflags) |
This method returns the displFlags & f. More... | |
void | ClearDispFlag (DWORD vflags) |
This method allows you to clear the specified display flags. More... | |
Render Methods | |
DllExport void | render (GraphicsWindow *gw, Material *ma, RECT *rp, int compFlags, int numMat=1, InterfaceServer *is=NULL) |
Causes the MNMesh to display itself in the indicated GraphicsWindow. More... | |
DllExport void | renderFace (GraphicsWindow *gw, int ff) |
Displays the indicated face in the GraphicsWindow. More... | |
DllExport void | render3DFace (GraphicsWindow *gw, int ff) |
Displays the indicated face in the GraphicsWindow using hardware acceleration for texture and lighting if available. More... | |
DllExport void | render3DDiagonals (GraphicsWindow *gw, DWORD compFlags) |
Displays all face diagonals in the GraphicsWindow using hardware acceleration for texture and lighting if available. More... | |
DllExport void | renderDiagonals (GraphicsWindow *gw, DWORD compFlags) |
Displays all face diagonals in the GraphicsWindow. More... | |
DllExport void | renderDiagonal (GraphicsWindow *gw, int ff, bool useSegments=false, bool *lastColorSubSel=NULL) |
Displays diagonals for the specified face in the GraphicsWindow. More... | |
DllExport void | render3DEdges (GraphicsWindow *gw, DWORD compFlags) |
Displays all edges in the GraphicsWindow using hardware acceleration for texture and lighting if available. More... | |
DllExport void | renderEdges (GraphicsWindow *gw, DWORD compFlags) |
Displays all edges in the GraphicsWindow. More... | |
DllExport void | renderEdge (GraphicsWindow *gw, int ee, bool useSegments=false, bool *lastColorSubSel=NULL) |
Displays an edge in a GraphicsWindow. More... | |
Object Overrides | |
DllExport void | ShallowCopy (MNMesh *amesh, ChannelMask channels) |
DllExport void | NewAndCopyChannels (ChannelMask channels) |
DllExport void | FreeChannels (ChannelMask channels, BOOL zeroOthers=1) |
IO Functions | |
| |
DllExport IOResult | Save (ISave *isave) |
DllExport IOResult | Load (ILoad *iload) |
FlagUser Overrides | |
DllExport void | ClearFlag (DWORD fl) |
InterfaceServer Overrides | |
DllExport BaseInterface * | GetInterface (Interface_ID id) |
Cache and Optimization Methods | |
DllExport void | ReduceDisplayCaches () |
Forces all the derived data used to display the mesh to be deleted. More... | |
DllExport bool | NeedGWCacheRebuilt (GraphicsWindow *gw, Material *ma, int numMat) |
This returns whether the Graphics Cache for this object needs to be rebuilt. More... | |
DllExport void | BuildGWCache (GraphicsWindow *gw, Material *ma, int numMat, BOOL threaded) |
Builds the graphics window cached mesh. More... | |
DllExport void | InvalidateHardwareMesh (DWORD keepFlags=0) |
This method can be used to invalidate any display-technology-specific caches of the MNMesh. More... | |
DllExport void | SetStaticMesh (bool staticMesh) |
Set the mesh or as static or not. More... | |
Specified Normal Methods | |
DllExport MNNormalSpec * | GetSpecifiedNormals () |
Returns a pointer to the user-specified normal interface, if present. More... | |
DllExport MNNormalSpec * | GetSpecifiedNormalsForDisplay () |
Returns a non-NULL MNNormalSpec interface pointer only if the interface is present, and is prepared for use in display - otherwise, it returns NULL, and we fall back on the smoothing groups. More... | |
DllExport void | ClearSpecifiedNormals () |
Clears out the specified normal interface, if present. More... | |
DllExport void | SpecifyNormals () |
Creates the user-specified normal interface in this mesh. More... | |
Miscellaneous Methods | |
DllExport void | Transform (Matrix3 &xfm) |
Transforms all vertices & hidden vertices by the Matrix xfm. More... | |
bool | IsClosed () |
Figures out if this mesh is completely closed. More... | |
DllExport void | Relax (float relaxval, bool targonly=TRUE) |
Similar to the 3ds Max "Relax" modifier: this modifier moves each MNVert towards the average of all vertices to which it is connected (by MNEdges). More... | |
DllExport bool | LiftFaceClusterFromEdge (int liftEdge, float liftAngle, int segments, MNFaceClusters &fclust, int clusterID) |
Detaches the face cluster and rotates its around the hinge edge and fills in the gap. More... | |
DllExport void | SmoothByCreases (DWORD creaseFlag) |
This is an auto-smooth algorithm that allows the developer to specify exactly which edges should be creases and which should be smoothed across. More... | |
DllExport void | GenerateRenderItems (MaxSDK::Graphics::IRenderItemContainer &renderItems, const MaxSDK::Graphics::GenerateMeshRenderItemsContext &generateRenderItemsContext) |
Generate a set of render items according to the given render-item-generate context. More... | |
DllExport void | GenerateDeferredRenderItems (MaxSDK::Graphics::IRenderItemContainer &renderItems, const MaxSDK::Graphics::GenerateMeshRenderItemsContext &generateRenderItemsContext) |
Generate a set of render items according to the given render-item-generate context. More... | |
Topology Utilities | |
DllExport void | FaceFindEdgeAdjacentFaces (int faceIndex, BitArray &adjacentFaces, IntTab &adjacentFaceIndexes, bool includeFaceIndex=false) |
Create a map and list of faces adjacent to a given face's edges. More... | |
DllExport void | FaceFindAdjacentFaces (int faceIndex, BitArray &adjacentFaces, IntTab &adjacentFaceIndexes, bool includeFaceIndex=false) |
Create a map and list of faces adjacent to a given face. More... | |
DllExport void | VertexFindAdjacentFaces (int vertexIndex, BitArray &adjacentFaces, IntTab &adjacentFaceIndexes) |
Create a map and list of faces adjacent to a vertex. More... | |
Public Member Functions inherited from FlagUser | |
FlagUser () | |
void | SetFlag (DWORD fl, bool val=TRUE) |
void | ClearFlag (DWORD fl) |
bool | GetFlag (DWORD fl) const |
void | ClearAllFlags () |
void | CopyFlags (DWORD fl) |
void | CopyFlags (const FlagUser &fu) |
void | CopyFlags (const FlagUser *fu) |
void | CopyFlags (DWORD fl, DWORD mask) |
void | CopyFlags (const FlagUser &fu, DWORD mask) |
void | CopyFlags (const FlagUser *fu, DWORD mask) |
void | OrFlags (const FlagUser &fu) |
void | OrFlags (const FlagUser *fu) |
void | AndFlags (const FlagUser &fu) |
void | AndFlags (const FlagUser *fu) |
bool | FlagMatch (DWORD fmask, DWORD fl) const |
bool | FlagMatch (DWORD fmask, const FlagUser &fu) const |
bool | FlagMatch (DWORD fmask, const FlagUser *fu) const |
DWORD | ExportFlags () const |
void | ImportFlags (DWORD fl) |
IOResult | WriteFlags (ISave *isave, ULONG *nb) const |
IOResult | ReadFlags (ILoad *iload, ULONG *nb) |
Public Member Functions inherited from BaseInterfaceServer | |
virtual UtilExport int | NumInterfaces () const |
virtual UtilExport BaseInterface * | GetInterfaceAt (int i) const |
virtual UtilExport | ~BaseInterfaceServer () |
Public Member Functions inherited from InterfaceServer | |
virtual UtilExport | ~InterfaceServer () |
Destructor. More... | |
Public Attributes | |
MNVert * | v |
The array of vertices. More... | |
MNEdge * | e |
The array of edges. More... | |
MNFace * | f |
The array of faces;. More... | |
int | numv |
Number of MNVert elements in v. More... | |
int | nume |
Number of MNEdge elements in e. More... | |
int | numf |
Number of MNFace elements in f. More... | |
int | numm |
PerData * | vd |
The array of PerData objects which maintain and provide access to the floating point vertex data. More... | |
BitArray | vdSupport |
This bit array indicates if a particular vertex data channel is supported in this MNMesh. More... | |
PerData * | ed |
The array of PerData objects which maintain and provide access to the floating point edge data. More... | |
BitArray | edSupport |
This bit array indicates if a particular edge data channel is supported in this MNMesh. More... | |
int | selLevel |
The current MNMesh selection level. More... | |
DWORD | dispFlags |
Display flags. More... | |
Tab< int > * | vedg |
This is an array of int Tabs that records which edges use each vertex. More... | |
Tab< int > * | vfac |
This is an array of int Tabs that records which faces touch each vertex. More... | |
Friends | |
class | HardwareMNMesh |
class | MNNormalSpec |
class | MNMeshUtilites8Impl |
class | MNMeshUtilities10Impl |
class | MNMeshFGBGObject |
class | MaxSDK::Graphics::EditablePolyMeshNormalChannel |
void | gfxCleanup (void *data) |
Cutting Methods | |
static const DWORD | mCutVersion |
This is the current version used for Cut and CutEdge and should be upped and documented when the cut code changes so edit poly can load the correct cut on older files to prevent them from breaking due to vertex reorder 1 : 2015 and older 2 : fixes a bug MAXX-19584 which was when a vertex and edge hit the same spot the edge would be picked causing a duplicate vertex, now the vertex is picked. More... | |
DllExport int | CutFace (int f1, Point3 &p1, Point3 &p2, Point3 &Z, bool split) |
Implements the Editable Poly Cut algorithm from the face level - cuts from a point on one face to a point on another face. More... | |
DllExport int | CutEdge (int e1, float prop1, int e2, float prop2, Point3 &Z, bool split) |
Implements the Editable Poly Cut algorithm from the edge level - cuts from a point on one edge to a point on another edge. More... | |
DllExport int | CutEdge_Versioned (int e1, float prop1, int e2, float prop2, Point3 &Z, bool split, DWORD ver) |
Only call this method when you need to go back to a previous version of the code to load older files to maintain procedurality. More... | |
DllExport int | Cut (int startv, Point3 &end, Point3 &Z, bool split) |
Implements the Editable Poly Cut algorithm from the vertex level - cuts from one vertex to another. More... | |
DllExport int | Cut_Versioned (int startv, Point3 &end, Point3 &Z, bool split, DWORD ver) |
Only call this method when you need to go back to a previous version of the code to load older files to maintain procedurality. More... | |
Space Accelerating Data Structure | |
These functions and member variable handle the space accelerating data structure used internally by Max system. 3ds Max 2017 release introduced the space accelerating data structure and algorithm to speed up the methods related to space looking-up. The space accelerating data can significantly improve the space looking-up algorithm, however the system may take some time to build the space accelerating data.It is recommended to use the following functions in the scenario of updating once then looking up multiple times. | |
bool | checkFaceSel (int face_i, Mesh_SelParams ¶ms) |
Invoke these methods to check the Sub-Objects associated with the face indexed by face_i is in the hit region. More... | |
bool | checkFaceEdgesSel (int face_i, Mesh_SelParams ¶ms) |
bool | checkFaceDiagonalSel (int face_i, Mesh_SelParams ¶ms) |
bool | checkVertSel (int vert_i, Mesh_SelParams ¶ms) |
bool | checkFaceBackFacing (int face_i, Mesh_SelParams ¶ms) |
DllExport bool | IsAccelDataDirty () |
Checks if the space accelerating data is up-to-date. More... | |
DllExport void | DirtyAccelData () |
Update the space accelerating data. More... | |
DllExport BOOL | select (GraphicsWindow *gw, Material *ma, HitRegion *hr, int abortOnHit=FALSE, int numMat=1) |
Checks the given HitRegion to see if it intersects this Mesh object. More... | |
DllExport BOOL | SubObjectHitTest (GraphicsWindow *gw, Material *ma, HitRegion *hr, DWORD flags, SubObjHitList &hitList, int numMat=1) |
This method may be called to perform sub-object hit testing on this mesh. More... | |
DllExport int | IntersectRay (Ray &ray, float &at, Point3 &norm) |
Provides the intersection point and normal for the ray with this mesh. More... | |
DllExport int | IntersectRay (Ray &ray, float &at, Point3 &norm, int &fi, Tab< float > &bary) |
Provides the intersection point and normal for the ray with this mesh. More... | |
DllExport const float * | IntersectRay (Ray &ray, float &at, Point3 &norm, int &fi) |
Similiar to above overrided function with the difference of having the barycentric coordinates as the function returned result. More... | |
DllExport Point3 | ComputeRenderNormal (int face_i, int corner) |
This function computes the render normal for the specified face and corner. More... | |
DllExport Point3 | ComputeInterpolatedRenderNormal (int face_i, const float *bary) |
This function computes the interpolated normals regarding the barycentric coordinates. More... | |
DllExport void * | GetSpaceAccelHandle () |
Additional Inherited Members | |
Static Public Member Functions inherited from MaxHeapOperators | |
static UtilExport void * | operator new (size_t size) |
Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e) |
Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new (size_t size, const char *filename, int line) |
New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, int block_type, const char *filename, int line) |
New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e, const char *filename, int line) |
New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new (size_t size, unsigned long flags) |
New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e, unsigned long flags) |
New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new[] (size_t size) |
New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e) |
New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new[] (size_t size, const char *filename, int line) |
New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new[] (size_t size, int block_type, const char *filename, int line) |
New operator used to allocate arrays of objects. More... | |
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line) |
New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new[] (size_t size, unsigned long flags) |
New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e, unsigned long flags) |
New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void | operator delete (void *ptr) |
Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e) |
Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete (void *ptr, const char *filename, int line) |
Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete (void *ptr, int block_type, const char *filename, int line) |
Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line) |
Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete (void *ptr, unsigned long flags) |
Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags) |
Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete[] (void *ptr) |
Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e) |
Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete[] (void *ptr, const char *filename, int line) |
Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete[] (void *ptr, int block_type, const char *filename, int line) |
Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line) |
Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete[] (void *ptr, unsigned long flags) |
Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags) |
Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, void *placement_ptr) |
Placement new operator. More... | |
static UtilExport void | operator delete (void *ptr, void *placement_ptr) |
Placement delete operator. More... | |
Protected Attributes inherited from BaseInterfaceServer | |
Tab< BaseInterface * > | interfaces |
Constructor.
Initializes the MNMesh with the mesh "from", and fills in the topology completely (using FillInMesh).
Copy constructor.
|
inline |
Clears all flags.
Allocates and inits the specified number of MNVerts.
Shrinks the nv_alloc size of the MNVert array to the specified size.
Deallocates any MNEdges in the vedg table and sets the vedg pointer to NULL.
Allocates the MNEdge data array e with the specified size.
Reduces the ne_alloc size of the MNEdge data array e to the specified number of elements.
Allocates the MNFace array f with the specified size.
Reduces the nf_alloc size of the MNFace data array f to the specified number of elements.
Reduces the nm_alloc size of the MNMap data array m to the specified number of elements.
|
inline |
Returns the number of vertices.
|
inline |
Returns the number of edges.
|
inline |
Returns the number of faces.
|
inline |
Internal.
This accessor accepts a value in the range -NUM_HIDDENMAPS to MNum().
Allocates and initializes the specified number of MNMap elements in the m array.
Initializing sets the number of verts and faces in the map to zero and sets the MN_DEAD flag.
Allocates and initializes basic planar map, or a white map for the vertex color channel.
Clears and frees the specified map channel, setting the MN_DEAD flag.
Returns the specified UVVert from the specified mapping channel.
Returns a pointer to the specified MNMapFace from the specified mapping channel.
Returns the total number of triangles; this is a sum of the number of triangles in each face that does not have the MN_DEAD flag set.
Extrapolate map information about a point near a face. Given a point near a given edge of a given face, but near to it, this method will extrapolate what that point's mapping coordinates would be in the mapping scheme used by the face.
DllExport bool SeparateMapVerticesInFaceCluster | ( | MNFaceClusters & | fclust, |
int | clusterID | ||
) |
Detaches the texture vertices on the border edges of the fclust.
Similar to the Detach() function but instead of being applied to the geometry vertices it is applied to the texture vertices. The border edges texture vertices of the cluster will not be shared with any other faces outside the cluster after this operation
fclust | A set of face clusters. |
clusterID | The ID of the cluster to operate on. |
Returns whether an edge is a seam or not.
Am edge is a seam if that edge only has 1 texture face connected to it, in other words it is an open texture edge
mapChannel | The map channel to look at the texture of.. |
edge | The edge number. |
Returns map verts for both ends of each edge (from f1's perspective) (Very useful for creating new faces at borders.) mv[j*2] is the map vertex corresponding to edge j's v1.
Sets the specified number of vertex data elements.
|
inline |
Returns the number of vertex data channels maintained by this MNMesh.
Returns TRUE if the specified channel of vertex data is available for this MNMesh; otherwise FALSE.
Sets if the specified channel of vertex data is supported by this MNMesh.
Returns a pointer to the vertex data for the specified channel or NULL if the channel is not supported.
|
inline |
Returns a pointer to the floating point vertex data for the specified channel of this mesh or NULL if the channel is not supported.
Deletes (deallocates) the vertex data for the specified channel.
Deallocates the vertex data from all channels and sets the number of supported channels to 0.
|
inline |
Returns a pointer to the floating point vertex weight data.
|
inline |
Sets the channel support for the vertex weights channel (VDATA_WEIGHT).
|
inline |
Frees (deallocates) the vertex weight channel data.
|
inline |
Returns a pointer to the floating point vertex selection weight data.
|
inline |
Sets the channel support for the vertex weights channel (VDATA_SELECT).
|
inline |
Frees (deallocates) the vertex selection weight channel data.
Sets the specified number of edge data elements.
|
inline |
Returns the number of edge data channels maintained by this MNMesh.
Returns TRUE if the specified channel of edge data is available for this MNMesh; otherwise FALSE.
Sets if the specified channel of edge data is supported by this MNMesh.
Returns a pointer to the edge data for the specified channel or NULL if the channel is not supported.
|
inline |
Returns a pointer to the floating point edge data for the specified channel of this MNMesh or NULL if the channel is not supported.
Deletes (deallocates) the edge data for the specified channel.
Deallocates the edge data from all channels and sets the number of supported channels to 0.
|
inline |
Returns a pointer to the floating point edge knot data.
|
inline |
Sets the channel support for the edge knot channel (EDATA_KNOT).
|
inline |
Frees (deallocates) the edge knot channel data.
Clears and frees the flags and face/edge lists for the specified vertex.
vv | The vertex to clear. |
Initializes the specified MNVert, clearing its flags and emptying its face & edge lists (if vfac & edg are allocated).
Returns the index of face ff in the vfac[vv] table.
NOTE that if this face cannot be found, or if it cannot be found accompanied by edge ee>-1, it will cause an assertion failure.
This method is available in release 3.0 and later only.
It replaces the old MNVert::EdgeIndex method.
Finds the position of edge ee in this MNVert's vedg table. Unlike VFaceIndex (and MNFace's VertIndex and EdgeIndex), each vertex can only touch an edge once, so there's no need for an additional parameter. (There's no such thing as an edge with both ends at the same vertex.)
This method is available in release 3.0 and later only.
It replaces the old MNVert::DeleteEdge method.
Finds edge ee in the vedg[vv] table and removes it.
This method is available in release 3.0 and later only.
It replaces the old MNVert::DeleteFace method.
Finds face ff in the vfac[vv] table and removes it. NOTE that this method causes an assertion failure if face ff is not in the vfac table. If ff occurs more than once, which is possible on some valid NONTRI meshes, only the first ff is removed.
This method is available in release 3.0 and later only.
It replaces the old MNVert::ReplaceEdge method.
Finds edge oe in the vedg[vv] table and replaces it with ne. NOTE that this method causes an assertion failure if edge oe is not in the vedg table.
This method is available in release 3.0 and later only.
It replaces the old MNVert::ReplaceFace method.
Finds face of in the vfac[vv] table and replaces it with nf. NOTE that this method causes an assertion failure if face of is not in the vfac table. If of occurs more than once, which is possible on some valid NONTRI meshes, only the first of is replaced.
This method is available in release 3.0 and later only.
It replaces the old MNVert::operator= by allowing the developer to copy face and edge adjacency information as well as vertex location and flags.
Copies the MNVert data from ov to nv. The face and edge data is copied too if appropriate (ie if MN_MESH_FILLED_IN is set and vfac and vedg are allocated).
This method is available in release 3.0 and later only.
It replaces the old MNVert::MNDebugPrint method.
Uses DebugPrint to print out vertex information to the Debug Results window in DevStudio. The information consists of the position, edge list, and face list. It is generally a good idea to put in a DebugPrint immediately before this with the index of the vertex, so you know which vertex is being printed out:
DebugPrint(_M("Vertex %d: "), vid);
MNVDebugPrint(vid);
Creates a new tri-face.
Note that no mapping coords or vertex colors can be specified.
Creates a new face of degree 3.
Edge selection and visibility flags are set to the default: all visible and not selected.
This method will create a new quad.
Previous to 4.0 this method used two tri-faces that shared and invisible edge.
This method will create a new quad.
Previous to 4.0 this method used two tri-faces that shared and invisible edge.
DllExport int NewFace | ( | int | initFace, |
int | degg = 0 , |
||
int * | vv = NULL , |
||
bool * | vis = NULL , |
||
bool * | sel = NULL |
||
) |
This method creates a (single) new face with the characteristics given.
The default triangulation for a face of this degree is used; if the face is not convex, this triangulation may be inappropriate. If this is the case, call RetriangulateFace() on this face after it's created.
Creates a new face, using the vertices given.
Note that this method, unlike the similar NewFace() method, maintains all topological links. If there's an edge between vv[0] and vv[1] which is already used by some other face (on the other side), that edge is modified to use this face on its "f2" side. If there's an edge between two sequential vertices with faces on both sides, the creation fails, because it would create an illegal condition.
This method also creates map faces in any active map channels to maintain the validity of the mesh. These map faces use the map vertices that other faces use for the vertices passed in, or if there are no corresponding map vertices yet, use newly created map vertices with the value (1,1,1).
Appends the specified number of MNFaces to f.
Sets the specified number of MNFaces allocated in f.
Edge creation tool.
If there is no edge currently joining vertices v1 and v2, it creates such an edge. If there is an edge starting at v2 and ending on v1, it registers face f as being on the "other side" of the edge.
Edge creation tool.
Simply makes a new edge from v1 to v2, without worrying about whether such an edge may already exist, or what faces may be on either side. Since edges are required to have at least one valid face on them, using this method obligates the developer to assign f1 on the new edge themselves.
Edge creation tool.
Requires the developer to previously ascertain that there is no edge from v1 to v2 or from v2 to v1.
Appends the specified number of edges.
Sets the number of MNEdges allocated in e.
Creates a new vertex (increasing numv) and sets it to the specified point.
This method is available in release 3.0 and later only.
It replaces the old MNMesh::NewVert (Point3 &p, MNVert *mv=NULL) method.
Creates a new vertex (increasing numv) and initializes it to the point p and the flags and other characteristics of vertex vid.
Creates a new vertex which is a linear combination of two existing vertices.
The new vertex has the MN_SEL and MN_TARG flags of whichever vertex it's closest to. The location and PerData info is interpolated.
Appends the specified number of MNVerts.
Sets the number of verts, allocating if needed.
Creates a spur on the face at vertexIndex.
This creates a new vertex, and an edge to it at the specified corner of the face. The new vertex is collocated at the old and the edge between the two is referenced twice.
Removes all MNVerts with the MN_DEAD flag from the list of vertices.
Also, it re-indexes all the faces' and edges' vertex references to maintain mesh integrity.
Removes all MNEdges with the MN_DEAD flag from the list of edges.
Also, re-indexes all the faces' and vertices' edge references to maintain mesh integrity.
Removes all MNFaces with the MN_DEAD flag from the list of faces.
Also, re-indexes all the edges' and vertices' face references to maintain mesh integrity.
Performs all 5 of the above collapse functions, safely removing all unused components from this mesh.
Reinitializes all verts, faces, and edges, freeing the data members of these components, but not freeing the vertex, edge, and face arrays themselves.
This option is suitable if you need to clear a MNMesh you will be reusing. numv, etc, are set to 0.
Deletes everything and frees all relevant memory.
Leaves you with an empty MNMesh with the default flags.
Deletes faces with any of the death flags set, as well as delete vertices and edges surrounded by faces with death flags, and correct the mesh components remaining.
Kills the edge and joins the faces on either side.
Does not work with one-sided edges. Re-indexes triangulation in the resulting face to maintain MN_MESH_FILLED_IN integrity. This routine also checks the resulting face for "dangling" edges: if two faces share a common boundary of 3 edges, and the middle edge is removed, the other two edges will actually have the same face on both sides. This is silly, so such edges are also removed & killed, reducing the degree of the face and adding a hidden vertex.
This routine scans through a mesh from which invisible edges have been removed, looking for vertices that essentially seem to lie in the middle of edges.
Such "collinear vertices" actually lie between two edges that are parallel, with the same faces on either side, and with no other edges incident on them. These are easily removed, and if not removed, they can cause unpleasant artifacts in some tessellation algorithms.
The removal of these vertices consists of deleting them, merging the parallel edges into one (longer) edge, and correcting the faces on either side to have one less vertex and edge.
Note that this is essentially the opposite of the method SplitEdge.
This merges vertices that lie extremely close together, similar to what's done in Edit Mesh's Weld function, but it only affects vertices that are joined by an edge.
Another way of looking at it is that it uses weld to remove extremely small edges.
|
inline |
Clears all specified flag bits in all MNVerts.
|
inline |
Clears all specified flag bits in all MNEdges.
|
inline |
Clears all specified flag bits in all MNFaces.
Recursively sets flag on given face and all faces connected to it.
DllExport int PropegateComponentFlags | ( | int | slTo, |
DWORD | flTo, | ||
int | slFrom, | ||
DWORD | flFrom, | ||
bool | ampersand = FALSE , |
||
bool | set = TRUE |
||
) |
This allows the developer to set flags in one type of component based on what the nearby flags of another type of component are.
For instance, you might want to set MN_TARG on all vertices that are used by faces with the MN_SEL flag set; that would be PropegateComponentFlags (MESH_VERTEX, MN_TARG, MESH_FACE, MN_SEL);
Another example:
PropegateComponentFlags (MNM_SL_OBJECT, MN_MESH_FILLED_IN, MNM_SL_EDGE, MN_DEAD, FALSE, FALSE);
This would clear the MN_MESH_FILLED_IN flag from the MNMesh if any of its MNEdges were dead.
DllExport void UpdateBackfacing | ( | GraphicsWindow * | gw, |
bool | force | ||
) |
Updates the MN_BACKFACING flag in all components based on the specified view.
Selects or deselects the vertices as specified by on bits in the given bit array.
If the bit array size is smaller than the number of vertices then only those vertices in the bit array are modified.
Selects or deselects the edges as specified by on bits in the given bit array.
If the bit array size is smaller than the number of edges then only those edges in the bit array are modified.
Selects or deselects the faces as specified by on bits in the given bit array.
If the bit array size is smaller than the number of faces then only those faces in the bit array are modified.
|
inline |
Fills the given bit array with the current vertex selection state.
|
inline |
Fills the given bit array with the current edge selection state.
|
inline |
Fills the given bit array with the current face selection state.
Using the current edge selection this returns the original selection and the edge loop defined by those selections.
If you have 4 ordered edges connected to a vertex the edge loop is the opposing edge to the selected edge.
edgeSel | An argument of type BitArray &. |
Using the current edge selection this returns the original selection and the ring loop defined by those selections.
Ring loop is defined as the opposing edge from the selected edge on a quad face.
edgeSel | An argument of type BitArray &. |
Gets the current vertex selection, based on the current selection level.
That is, if the current selection level is MNM_SL_VERTEX and the parameters are at their defaults, it'll return the current vertex selection, but if the selection level is MNM_SL_FACE, for instance, it'll return the vertices used by currently selected faces.
This method is used, e.g. in PolyObject::Deform to determine which vertices to affect by pipeline modifiers.
Creates a BitArray of all vertices using the specified flags.
Creates a BitArray of all edges using the specified flags.
Creates a BitArray of all faces using the specified flags.
Sets bits for all faces in the same "element", or connected component, with face ff.
Faces already selected in fset will be considered "walls" for this processing and will not be evaluated. That is, if ff is not selected, but there's a ring of faces around it that is, the algorithm will stop at that ring.
Takes a one-sided edge and sets the bits representing this edge's "border".
(All one-sided edges in MNMeshes can be grouped into chains, end to end, that represent boundaries of the mesh. For instance, in a box with one side deleted, all the one-sided edges are part of the chain that goes around the hole.
This not only sets the edge's MN_EDGE_INVIS flag, it also sets the visedg state of the faces on either side.
This is the proper way to set edge visibility permanently, as the MNEdge flag will be lost if the edge list needs to be reconstructed.
This not only sets the edge's MN_SEL flag, it also sets the edgsel state of the faces on either side.
This is the proper way to set edge selection permanently, as the MNEdge flag will be lost if the edge list needs to be reconstructed.
Clears out all current information, and copies in new faces and vertices from the from
argument.
Adds vertices and faces in "from" to current MNMesh.
This algorithm has O(N) complexity.
If this mesh does not have the MN_MESH_FILLED_IN flag, this method completely recomputes all combinatorial information.
It re-creates all MNEdges and MNFace::edg, MNVert::edg, and MNVert::fac lists based on the information in the MNFace::vtx lists.
Since this routine completely reconstructs the combinatorics, it clears the MN_MESH_VERTS_ORDERED flag. Complexity of O(N).
Fills in the faces' edge arrays based on the edge list.
Complexity of O(N).
Fills in the vertex edge and face lists based on the edge list.
Complexity of O(N).
DllExport bool EliminateBadVerts | ( | DWORD | flag = 0 | ) |
A "bad" vertex in this context is one which is shared between two distinct boundaries for this mesh.
As an example, imagine a union between two circles, converted to meshes, that touch at a single vertex. This causes a vertex to exist which is on two faces, but four edges. Since most vertices are on equal numbers of faces and edges (if they're not on a boundary) or on one more edge than face (if they are on a boundary), these types of vertices can mess up some forms of processing. This method eliminates such vertices by duplicating them, assigning one vertex to each boundary. A MNMesh that has gone through this method will have the MN_MESH_NO_BAD_VERTS flag set until a method (such as NewFace) is called that could conceivably create bad vertices.
EliminateBadVerts requires a filled in mesh, and will call FillInMesh if the MN_MESH_FILLED_IN flag is not set.
This routine organizes the face and edge lists of each vertex such that going counterclockwise around the vertex (with the surface normal pointing up), you'll encounter edg[0], fac[0], edg[1], fac[1], etc, ending in either the last face if the vertex is not on a boundary or the last edge if the vertex is on a boundary.
(If the vertex is on a boundary, the first & last edges are part of that boundary.)
OrderVerts requires a filled-in mesh with no bad vertices, so it will call FillInMesh and/or EliminateBadVerts as needed.
This routine organizes the face and edge lists of the specified vertex such that going counterclockwise around the vertex (with the surface normal pointing towards you), you'll encounter edg[0], fac[0], edg[1], fac[1], etc, ending in either the last face if the vertex is not on a boundary or the last edge if the vertex is on a boundary.
(If the vertex is on a boundary, the first & last edges are part of that boundary.)
NOTE: OrderVert requires a filled-in mesh with no "bad" vertices. Failing to adequately prepare your mesh may result in a crash. (See the methods FillInMesh and EliminateBadVerts for details.)
Converts a MN_MESH_NONTRI mesh, with polygon faces and possibly hidden vertices, into a completely triangulated mesh, wherein all faces have degree 3.
This routine is called from OutToTri if the MN_MESH_NONTRI flag is set. Has complexity O(N)
Triangulates the specified face, splitting it into as many faces as are needed (deg-2+hdeg*2) to represent all the triangles.
Has complexity of O(N) where N is the number of triangles.
Divides a face by creating a point in the face's interior and creating an edge from that point to each of the face's vertices.
An n-gon becomes n triangles by this method.
Identical to DivideFace but should only be used to load parametric divides for file 2015 and lower.
Finds the bounding box of all vertices and hidden vertices used by face ff.
Calculates the bounding box of the vertices & hidden vertices of this mesh.
Retrieves a bounding box for the MNMesh.
Sets vertex MN_TARG flags based on the existing MN_SEL flags.
Sets edge MN_TARG flags based on the existing MN_SEL flags.
Sets face MN_TARG flags based on the existing MN_SEL flags.
Clears the MN_TARG flag on vertices representing relatively flat areas, keeping the flag on vertices at sharper corners.
The purpose of this method is to avoid working on smooth areas of the mesh in, for instance, tessellation algorithms which are designed to smooth an area. An example of this is the sharpness option in 3ds Max's MeshSmooth modifier, although the parameter there is 1.0 - this value.
Note that this method requires filled in geometry and ordered vertices, and will call FillInMesh and OrderVerts as needed. This algorithm has complexity O(N*deg).
Finds the center of face ff by finding the average of all its vertices.
Computes a "balanced" normal, in that the normal takes the contribution of all vertices equally.
(This is significant in the case of nonplanar polygons.)
Finds the "safe" centers of all the faces, using repeated calls to ComputeSafeCenter.
Finds the "safe" center of face ff, if possible.
For non-convex faces, the average point found in ComputeCenter is unsuitable for some applications because it can lie outside the face completely, or in a region where it cannot "see" all the faces' vertices. (I.e., line segments from the center to the corner pass outside of the face.)
This routine provides a better solution in some cases by finding the center of the convex hull of the face. The convex hull is defined as the region in a face with a clear line-of-sight to all the corners. Some faces, such as the top face in an extruded letter M, have an empty convex hull, in which case this routine fails and merely provides the regular center given by ComputeCenter. This algorithm has complexity of O(deg^2).
Throws out the current triangulation for face ff and computes a new one.
Note that hidden vertices that actually fall outside of the region of the face will be thrown out during this routine, since they cannot be incorporated into any triangulation and don't make sense anyway.
Finds a diagonal of face ff that does not include any hidden vertices.
This can be used with the method FindFacePointTri to get a sub-triangle and barycentric coordinates for a hidden vertex, so that vertex can be kept in the face when the non-hidden vertices are moved in some way.
This method finds diagonals for this sequence of vertices, creating a triangulation for the polygon they form.
If the given face is convex, this will often produce a better diagonals than RetriangulateFace would.
The diagonals are less likely to overuse any single vertex. The face is not checked for convexity, but if it is not convex the diagonals produced will probably be self-overlapping.
Uses a triangulation scheme optimized for convex polygons to find a set of diagonals for this sequence of vertices, creating a triangulation for the polygon they form.
Unifies triangles into polygons across invisible edges.
Turns a mesh with triangle faces into a mesh with (fewer) polygon faces by removing all hidden edges. This method can take unusually long if there are faces of ridiculously high degree, such as the top of a cylinder with 200 sides but only 1 cap segment. (It can be up to an n-squared routine where n is the number of invisible edges removed to make a given face.)
This routine is essentially a bunch of calls to RemoveEdge(), followed by a call to EliminateCollinearVerts().
Turns a mesh with triangle faces into a mesh with (fewer) convex polygon faces by removing all hidden edges that aren't necessary to maintain convexity.
As of the 2.5 release this method has not been thoroughly tested to ensure that the result is indeed always convex and that it doesn't leave edges that should ideally be removed. Therefore a call to MakeConvex is recommended after use. What we can say about it is that it will not produce any hidden vertices, as MakePolyMesh does, and that if you're going to use MakeConvex anyway, MakeConvexPolyMesh and MakeConvex are more efficient than MakePolyMesh and MakeConvex are.
MakeConvex essentially undoes a lot of the work done by MakePolyMesh. MakeConvexPolyMesh gives it much less (if anything) to undo.
Some of these methods do not make use of user-specified normals or smoothing groups.
Finds an edge connecting these two vertices, if one exists. This algorithm is relatively fast, since it just checks the edges in V(vrt1)'s edge list. However, it requires that the MNMesh be filled in, and it WILL call the much slower FillInMesh routine if the MN_MESH_FILLED_IN flag is not set.
Chooses a suitable "local space", and sets tm's rotation to match that space.
Does not set tm's translation component. (This is easily done by setting tm.SetRow (3, v[vrt].p).)
The purpose of this method is to support a consistent definition of "local
space" around a given vertex. As usual, Z comes from the local normal; the X direction is chosen to be a particular edge, but then this direction is modified to balance the contribution of the other edges. (Thus it points roughly in the direction of one edge, but moving other edges' far endpoints will rotate which way is considered "X" just as much as moving that edge will.)
Returns the surface normal at the vertex vrt.
It computes the normal by taking the average of the face normals from faces that V(vrt) is on, weighted by the angles of the vrt corners of each of those faces. That is, if vrt is at a very acute angle on one face, but a very obtuse angle on the next, the face with the obtuse vrt corner will count much more heavily. The return value has a length of 1.
This normal is not related to the normals used in rendering.
Returns the surface normal at the edge edgeIndex.
This is just the average of the face normals on either side, or, if this is an edge with only one face, it's just that face's normal. The return value has a length of 1.
This normal is not related to the normals used in rendering.
Returns the surface normal of face fc.
If this face has degree 3, this is the same as the regular 3ds Max normal for this face. However, if the face is more complex, the normal may not be the same as the ones for the component triangles.
This merely combines GetEdgeNormal (int ed) with FindEdge (int vrt1, int vrt2).
It returns the normal of the edge connecting vrt1 to vrt2, if such an edge can be found. (If there is no such edge, it returns Point3(0.0f, 0.0f, 0.0f).)
Computes the angle at the given edge.
(In other words, the angle between the planes of the faces on either side.) Note that in the case of nonplanar polygons, these planes are the "average" planes for the polygon, not the plane of the triangle nearest the edge.
Flips the normal of the specified face, as well as the corresponding map faces in active maps.
Note that doing this on an isolated face with neighbors will cause an illegal condition. Use the FlipElementNormals method to safely and completely flip the normals of entire elements to avoid this problem.
This method uses the MNFace and MNMapFace methods "Flip", which changes the order of the vertices from (0,1,2...,deg-1) to (0, deg-1, deg-2,...1) and rearrange the edge and diagonal information accordingly.
This method can be used to build the normals and allocate RVert space only if necessary.
This is a very inexpensive call if the normals are already calculated. When illum is FALSE, only the RVerts allocation is checked (since normals aren't needed for non-illum rendering). When illum is TRUE, normals will also be built, if they aren't already. So, to make sure normals are built, call this with illum=TRUE.
This method resolves the normals on the RVertex array.
If the MNMesh already has normals prescribed on each vertex, the normal is just moved to the RVertex array. See Class RVertex and Class RNormal.
If you are creating or modifying a MNMesh, after you are done specifying all the vertices and faces, this method should be called. This allocates the RVertex and RNormal database for the MNMesh. This will allow you to query the MNMesh and ask about normals on the vertices.
This method also builds the face normals for the mesh if needed.
This method is similar to buildNormals() above, but ignores the material index (mtlIndex).
In other words, the difference between this and buildNormals() is that it doesn't look at the mtlIndex of the faces: normals of faces with the same smoothing group are averaged regardless.
Flips the normals of the specified elements in the mesh.
DllExport bool FlipFaceNormals | ( | DWORD | faceFlag | ) |
This flips the face normals of the tagged faces and also reverses the face winding.
Applies new smoothing (or removes smoothing groups) from selected areas of the MNMesh.
With the default parameters, it smooths all faces with the same group.
DllExport DWORD CommonSmoothing | ( | bool | targonly = FALSE | ) |
Finds what smoothing groups, if any, are common to all faces in this MNMesh.
DllExport DWORD GetNewSmGroup | ( | bool | targonly = FALSE | ) |
Produces a single smoothing group that is not currently used in the MNMesh.
If this is impossible because all smoothing groups are used (a rare condition), it produces the least commonly used group.
DllExport DWORD GetOldSmGroup | ( | bool | targonly = FALSE | ) |
Returns a smoothing group that is currently used somewhere in the mesh, or returns zero if all faces have no smoothing.
DllExport DWORD GetAllSmGroups | ( | bool | targonly = FALSE | ) |
Find all smoothing groups used in this mesh.
Finds available smoothing groups you can use to replace the given smoothing group without messing up the mesh's shading.
This method recursively looks at the entire region of faces sharing this smoother with this face, and it finds all smoothing groups used by neighboring faces. Then it returns the bits which are not used by any of them.
This is useful if, for instance, you want to attach two separate mesh components, but you don't want smooth shading across the join. It's used internally by SeparateSmGroups.
Recursively replaces the old smoothing group with the new smoothing group.
The recursion traverses all faces with the old smoother that share an edge or a vertex.
Changes the smoothing groups on faces using v2 so that they are distinct from any smoothing groups on faces using v1.
This is used, for instance, in joining the seam between the operands MakeBoolean. Before welding each pair of vertices, this method is called to prevent smoothing across the boolean seam.
Applies new smoothing groups to the whole mesh or to selected faces based on angles between faces.
Return a DWORD of smoothing groups that a face can use without smoothing to any adjacent face (either across shared edges or shared vertices).
faceIndex | The index of the face to check |
excludeSmoothing | A bit mask with a bit set for each smoothing group to exclude from the returned smoothing groups. |
DllExport DWORD FindAvailableSmoothingGroupFromFaceList | ( | IntTab | faceList, |
DWORD | excludeSmoothing = 0 |
||
) |
Return a DWORD containing the lowest-order smoothing group that a list of faces can use without smoothing to any adjacent face (either across shared edges or shared vertices).
faceList | An IntTab of face indexes to check |
excludeSmoothing | A bit mask with a bit set for each smoothing group to exclude from the returned smoothing groups. |
These methods make fences for the MNMesh::SabinDoo() algorithm.
They set NOCROSS flags and deleting INVIS flags. Sets the MN_EDGE_NOCROSS flag on all edges that lie between faces with different material IDs.
Sets the MN_EDGE_NOCROSS flag on all edges that lie between faces with exclusive smoothing groups.
Sets the MN_EDGE_NOCROSS flag on all edges that lie between selected & non-selected faces.
(This checks the MN_SEL, not the MN_TARG, flags on the faces.)
Sets the MN_EDGE_NOCROSS flag on all edges that are on the boundary.
Sets MN_EDGE_NOCROSS flags on edges between faces that aren't in the same plane.
Sets the MN_EDGE_MAP_SEAM on all edges that are "seams" for any active map(s).
A map seam is an edge where the faces on either side use different mapping vertices for at least one end.
Sets the MN_EDGE_MAP_SEAM on all edges that are "seams" for the specified map(s).
A map seam is an edge where the faces on either side use different mapping vertices for at least one end.
Finds the sub-triangle and (optionally) barycentric coordinates within that triangle of a point that lies on this face.
For faces that are not themselves triangles, this helps in particular to create mapping coordinates or vertex colors for new points on this face. To use this method, you must now call MNFace::GetTriangles to get a triangle table, then pass the contents of that table to this method. Note that the optional size of the triangulation array was removed; this is assumed to be (f[ff].deg-2)*3.
This method is available in release 3.0 and later only.
It's the generalized version of the old FindFacePointCV and FindFacePointTV.
Uses FindFacePointTri and the mapping coordinates of the endpoints of the relevant triangle to compute a map vertex corresponding to the point pt. If the point is not on face ff, UVVert (0,0,0) is returned.
This method is useful e.g. for getting map coordinates to match a new vertex when dividing up a face.
DllExport void GetBorder | ( | MNMeshBorder & | brd, |
int | selLevelType = MNM_SL_OBJECT , |
||
DWORD | targetFlag = MN_SEL |
||
) |
Finds border loops composed of all one-sided edges.
(One-sided edges on a mesh must necessarily be organizable into closed loops along the borders of the mesh.)
DllExport void FillInBorders | ( | MNMeshBorder * | b = NULL | ) |
Fills in all the borders of a mesh.
This is what the 3ds Max CapHoles modifier does. It creates new faces on the other side of each of the loops.
Scans mesh to determine what parts of it are open or closed.
Consider a "submesh" to be one connected components of faces and edges. Each submesh is open if it has any holes, i.e. if there's at least one edge which has only one face. (The hole is on the other side.) A submesh is closed if it doesn't have any. This method sets the MN_FACE_OPEN_REGION flag on all faces in open submeshes, and sets the MN_MESH_HAS_VOLUME flag if at least one submesh is closed.
DllExport BOOL CheckForDoubledMappingVerts | ( | ) |
This method is a debugging tool.
All doubled mapped vertexes are DebugPrinted. Return value is TRUE if there is at least one doubled mapping vertex (on at least one map channel). FALSE if the mesh is clean. Note that this method is not significantly faster than EliminateDoubledMappingVerts, so you should not use it to determine if EliminateDoubledMappingVerts
Deletes isolated mapping vertices on a specific channel.
Assignment operator.
Allocates space & copies over all data from "from".
Union operator.
Adds all data from "from" to this MNMesh. Flags MN_MESH_NONTRI and MN_MESH_RATSNEST are or'd together, while flags MN_MESH_FILLED_IN, MN_MESH_NO_BAD_VERTS, and MN_MESH_VERTS_ORDERED are and'd together. (Uniting a rat's nest with a non-rat's nest makes a rat's nest, but uniting a mesh with mapping coordinates and one without makes one without.)
Uses DebugPrint to print out information about all the edges, faces, and vertices in the immediate vicinity of vertex vv.
DllExport bool CheckAllData | ( | ) |
Thoroughly checks a MNMesh to make sure that no components refer to dead components; that when one component refers to another, the other refers back to the first; and that orientation is correctly matched between faces and edges.
If everything checks out, TRUE is returned. If any errors are detected, DebugPrint is used to send a message to the DevStudio Debug Results window and FALSE is returned. Be careful not to leave CheckAllData calls in your final build; they will slow down your effect to no purpose.
Here is the sort of debug output you can expect. CheckAllData always outputs one of the following messages:
Checking all data in filled-in MNMesh: (if the mesh has the MN_MESH_FILLED_IN flag set)
Checking all data in MNMesh: (if the mesh does not)
These errors will be detected for any mesh:
Face d has an out-of-range vertex: d
Face d has an out-of-range tvert: d
Face d has an out-of-range cvert: d
Face d refs dead edge d.
Face d has bad triangulation index: d
These errors will be detected only for filled-in meshes:
Face d has an out-of-range edge: d
Face d uses dead edge d.
Face d refs edge d, but edge doesn't ref face.
Face d refs edge d from vert d to vert d, but edge doesn't go there.
Orientation mismatch between face d and edge d.
Face d refs vertex d, but vertex doesn't ref face.
Edge d refs dead vertex d.
Edge d refs vertex d, but vertex doesn't ref edge.
Edge d has no face-1
Edge d refs dead face d.
Edge d refs face d, but face doesn't ref edge.
Vertex d refs dead edge d.
Vertex d refs edge d, but edge doesn't ref vertex.
Vertex d references more faces than edges.
Vertex d refs dead face d.
Vertex d refs face d, but face doesn't ref vertex.
DllExport int SplitTriEdge | ( | int | ee, |
float | prop = .5f , |
||
float | thresh = MNEPS , |
||
bool | neVis = TRUE , |
||
bool | neSel = FALSE |
||
) |
Creates a new vertex in the middle of an edge, splitting the edge into two edges.
Unlike SplitEdge, this routine requires a triangle face on each side. Since it has this, it also creates new edges connecting the new vertex with the point opposite the split edge on each face. This in turn splits the faces. So two triangles sharing this single edge become four triangles with four shared edges meeting at a single new vertex.
This method requires that MN_MESH_FILLED_IN be set (otherwise it will cause an assertion failure), and maintains the combinatorics completely.
DllExport int SplitTriFace | ( | int | ff, |
double * | bary = NULL , |
||
float | thresh = MNEPS , |
||
bool | neVis = TRUE , |
||
bool | neSel = FALSE |
||
) |
Adds a vertex somewhere in a triangle face, and also adds edges from that vertex to each of the corners, splitting the face into 3 smaller triangle faces.
The triangle face used here can have hidden vertices, as long as it is of degree 3. However, if the threshold parameter comes into play and this routine calls SplitTriEdge, both this face and the one across the relevant edge will need to have both degree 3. (Otherwise there's an assertion failure.)
This method requires that MN_MESH_FILLED_IN be set (otherwise it will cause an assertion failure), and maintains the combinatorics completely.
This is another way to subdivide a face on a triangular mesh into sub-triangles.
In this case, 4 new vertices are produced, and this face becomes 6 new faces. MN_MESH_FILLED_IN is required and preserved, and MN_MESH_NONTRI cannot be true when this method is called.
The subdivision technique is as follows: a new point is added at the barycentric coordinates given on the face given. New points are also added in each edge of the original face, such that a line from each of these three new edge points to the opposite original vertex passes through the new center point. These three edge points have edges drawn between them, and have edges to the new center point, dividing the face into 3 large outer triangles and 3 smaller inner triangles. Neighboring faces are split into 2 triangles, since the common edge is divided. This is a useful subdivision technique when you know you're going to want to add a lot of detail to a specific region of a face.
Creates a new vertex somewhere in the middle of an edge, splitting the edge into two edges.
Incident faces are updated in their vertex, edge, mapping coordinate, and vertex color lists, as well as in their triangulation. This method requires that MN_MESH_FILLED_IN be set (otherwise it will cause an assertion failure), and maintains the combinatorics completely.
This new SplitEdge variant allows you to recover information about the new map vertices created at the point where the edge is split.
Everything else is the same as the existing SplitEdge (int ee, float prop=.5f) method.
DllExport int SplitEdge | ( | int | ff, |
int | edgeIndex, | ||
float | prop, | ||
bool | right, | ||
int * | nf = NULL , |
||
int * | ne = NULL , |
||
bool | neVis = FALSE , |
||
bool | neSel = FALSE , |
||
bool | allconvex = FALSE |
||
) |
Splits an edge that is specified from the face level, and splits off triangles from the adjacent faces.
This method is often preferable in convex meshes, when it's important that no nonconvex faces are introduced. The other SplitEdge methods leave faces with three vertices in a line, which is not strongly convex. This version makes a triangle out of half of the split edge, the next face edge, and a diagonal.
Note: This method absolutely requires that the faces on either side of the edge being split are Convex. Use MakeFaceConvex if needed.
DllExport int IndentFace | ( | int | ff, |
int | ei, | ||
int | nv, | ||
int * | ne = NULL , |
||
bool | nevis = TRUE , |
||
bool | nesel = FALSE |
||
) |
Uses a new vertex to "indent" one of the sides of the face.
The indentation triangle is split off as a new face, which is returned.
DllExport void SeparateFace | ( | int | ff, |
int | a, | ||
int | b, | ||
int & | nf, | ||
int & | ne, | ||
bool | neVis = FALSE , |
||
bool | neSel = FALSE |
||
) |
This routine takes a larger face and divides it into two smaller faces, creating a new edge in the process.
It is crucial that the face given to SeparateFace has a valid triangulation.
DllExport bool Slice | ( | Point3 & | N, |
float | off, | ||
float | thresh, | ||
bool | split, | ||
bool | remove, | ||
bool | flaggedFacesOnly = false , |
||
DWORD | faceFlags = MN_SEL |
||
) |
Slices the MNMesh along a specified plane, splitting edges and faces as needed to divide faces into those above and those below the plane.
Equivalent to the Slice modifier.
Splits the flagged vertices into a clone for each face using the vertex.
For example, if used on the front top left corner of a standard 3ds Max box, it splits the vertex into 3, one for the front face, one for the top face, and one for the left face.
"Splits" edges by breaking vertices on two or more flagged edges into as many copies as needed.
In this way, any path of flagged edges becomes an two open seams.
DllExport bool SplitFacesUsingBothSidesOfEdge | ( | DWORD | edgeFlag = 0x0 | ) |
Splits an edge into multiple edges.
edge | An argument of type int. |
segments | The number of new segments to create out of the original edge. |
Calls MakeFaceConvex() on all (non-dead) faces, producing a mesh with 100% convex faces.
Makes face ff convex, essentially by chopping off corners.
The corners themselves become new faces. This routine is actually recursive: if this face is already convex, it returns without affecting it. If not, it finds a suitable line (between outside vertices) to divide the face along, and then calls MakeFaceConvex() again on both of the smaller faces. It is crucial that the face given to MakeFaceConvex has a valid triangulation.
Subdivides polygons as needed so that no polygon has degree larger than maxdeg.
(For instance, if maxdeg was 4, an octagon would have edges added until it was composed of 3 quads, or some combination of quads and tris.)
Makes all faces planar, within the angle threshold given, by subdividing them as necessary.
(See MakeFacePlanar.)
Makes the specified face planar by subdividing if necessary.
planarThresh represents an angle in radians. If the angle across any of the face's diagonals is larger than this amount, the face is divided on that diagonal.
Welds vertices a and b, correcting the mesh topology to match.
All references to b are moved to a, and b is killed. If there is a topological problem preventing the weld from occurring, the method does nothing and returns FALSE. If there is no such problem, the weld goes ahead and returns TRUE. Note that if a and b are joined by an edge, this method just calls WeldEdge on that edge.
Welds the endpoints of edge ee, correcting the mesh topology to match.
All references to E(ee)->v2 are moved to E(ee)->v1, and both ee and E(ee)->v2 are killed. If there is a topological problem preventing the weld from occurring, the method does nothing and returns FALSE. If there is no such problem, the weld goes ahead and returns TRUE.
Welds vertices v1 and v2 together.
Both vertices must be on borders, and they cannot share an edge. If destination isn't NULL, it indicates where the welded vertex should be located. (If it is NULL, the welded vertex is placed at the midpoint of the inputs.)
Welds the specified border edges together.
Welds the specified border vertices together.
DllExport bool WeldOpposingEdges | ( | DWORD | edgeFlag | ) |
Welds pairs of one-sided edges between the same two vertices.
DllExport void TessellateByEdges | ( | float | bulge, |
MeshOpProgress * | mop = NULL |
||
) |
This is a tessellation routine similar to AndersonDo().
It produces the same topology, but bulges new vertices outward to maintain even curvature instead of bringing the original vertices inward. For a demonstration of the effect this algorithm has on meshes, apply 3ds Max's Tessellate modifier with the "Edge" and "Operate On: Polygons" options selected. Note that this algorithm roughly quadruples the size of the MNMesh.
DllExport bool AndersonDo | ( | float | interp, |
int | iSelLevel, | ||
MeshOpProgress * | mop = NULL , |
||
DWORD | subdivFlags = 0 |
||
) |
It breaks every MNFace into deg new faces with four sides.
The four vertices of each of these new quads come from the center point of the original face, one corner of the original face, and the middles of the two edges on either side of that corner. For a demonstration of the effect this algorithm has on meshes, apply 3ds Max's MeshSmooth modifier with the "Quad Output" box checked. Note that this algorithm roughly quadruples the size of the MNMesh.
DllExport void TessellateByCenters | ( | MeshOpProgress * | mop = NULL | ) |
Note that this algorithm roughly triples the size of the MNMesh.
For an example of how it works, apply 3ds Max's Tessellate modifier with the "Face" and "Operate On: Polygons" options selected. This algorithm splits each face into deg triangles, where each triangle contains the center of the face and one edge from the perimeter.
DllExport void SabinDoo | ( | float | interp, |
int | iSelLevel, | ||
MeshOpProgress * | mop = NULL , |
||
Tab< Point3 > * | offsets = NULL |
||
) |
Note that this algorithm roughly triples the size of the MNMesh.
For an example of how it works, apply 3ds Max's MeshSmooth modifier with "classic" MeshSmooth Type.
This technique for tessellation is based on a paper, "A Subdivision Algorithm
for Smoothing Down Irregularly Shaped Polygons", published by D. W. H. Doo of Brunel University, Middlesex, England, in IEEE in 1978. It essentially creates a new face for every vertex, face, and edge of the original mesh. The new vertices this technique requires are made by creating one vertex for each corner of each original face. These vertices are located on a line from the original face corner to its center. All the faces around a given (targeted) vertex will create such a point; these points form the corners of the face created from this vertex. The original faces become smaller, as they use the new points instead of their old corners. And the four new points created on the faces on either side of an edge, for the endpoints of that edge, become the four corners of the new face representing the edge. Apply a MeshSmooth with default values to a 3ds Max box to see how this plays out.
DllExport void SabinDooVert | ( | int | vid, |
float | interp, | ||
int | iSelLevel, | ||
Point3 * | ctr, | ||
Tab< Point3 > * | offsets = NULL |
||
) |
This applies the Sabin-Doo tessellation technique to a single vertex.
The vertex is split into as many new vertices as there are faces using this vertex. The incident faces are shrunk back to make use of these new vertices, and a new face is created from them representing the vertex. Incident edges are split into triangles using their other end and the appropriate edge from the new vertex-face. To see the result of this algorithm, apply MeshSmooth (with default parameters) to an EditableMesh with a single vertex selected.
DllExport void CubicNURMS | ( | MeshOpProgress * | mop = NULL , |
Tab< Point3 > * | offsets = NULL , |
||
DWORD | subdivFlags = 0 |
||
) |
Non-uniform rational mesh smooth.
This is a tessellation routine. Note that this algorithm roughly quadruples the size of the MNMesh. For an example of how it works, apply 3ds Max's MeshSmooth modifier with "NURMS" MeshSmooth Type.
This technique for tessellation is based loosely on a 1998 SIGGraph paper, "Non-Uniform Recursive Subdivision Surfaces", by Sederberg, Zheng, Sewell, and Sabin, with additional work by Autodesk staff. Topologically, it's quite simple, as it creates a vertex in the center of every edge and face and connects these vertices with quads. However, the geometry is a non-uniform rational extension of the old Catmull-Clark standard cubic subdivision.
To set the vertex and edge weights used by the algorithm, use the EdgeKnots and VertexWeights methods of MNMesh. Like other subdivision routines, this routine only subdivides areas of the MNMesh indicated by the MN_TARG flag on vertices, and uses the MNEdge::Uncrossable method to determine where the regional boundaries should be.
BooleanCut uses the same techniques as MakeBoolean to cut the faces of this with the faces of m2.
As with Boolean, both this and m2 should be prepared with the PrepForBoolean method.
Makes this MNMesh into a Boolean result of the given MNMeshes.
The operands are not modified during this process. The Boolean algorithm is identical to the one used in the Boolean 2 compound object. Notice that there are no transform arguments, as there are in the previously used CalcBoolOp - transforms should be applied to the operands beforehand using the MNMesh::Transform method.
DllExport void Connect | ( | MNMeshBorder & | borderList, |
int | segs, | ||
float | tension, | ||
bool | sm_bridge, | ||
bool | sm_ends, | ||
Tab< int > * | vsep = NULL |
||
) |
Connect automatically figures out which loops in the given MNMeshBorder would make good candidates for connecting, and calls ConnectLoop on them all to connect them.
Good candidates are pairs of loops that face each other. Centers and normals of each of the "holes" are compared to find the best matches.
DllExport void ConnectLoops | ( | Tab< int > & | loop1, |
Tab< int > & | loop2, | ||
int | segs, | ||
float | tension, | ||
DWORD | smGroup, | ||
MtlID | mat, | ||
bool | sm_ends | ||
) |
Connects two border loops by filling in new geometry between them, as is done in the Connect compound object.
Connect the marked edges of a polygon if they are opposing.
Returns true is successful. This is the same as calling IMeshUtilities8::ConnectEdges()
edgeFlag | Identifies the kinds of edges to connect. For example for selected edges set use MN_SEL. |
segments | Segments is the number of times to segments to split the original edge into. |
DllExport bool ConnectVertices | ( | DWORD | vertexFlag | ) |
Connects tagged vertices across a polygon.
vertexFlag | Indicates the type of vertices to connect. Set to MN_SEL to operate on selected edges. |
Finds "Generalized Barycentric Coordinates" for the point given.
Generalized barycentric coordinates are not uniquely determined for polygons of degree greater than 3, but this algorithm should find a reasonable balance, where for instance a point in the center of a polygon would have a significant contribution from all vertices.
Generalized barycentric coordinates are a set of floats, one per vertex in the polygon, such that the sum of all the floats is 1, and the sum of all the floats times the corresponding vertices comes out to the point given.
DllExport void FindFaceBaryVector | ( | int | face, |
int | vertIndex, | ||
Point3 & | vector, | ||
Tab< float > & | tBary | ||
) |
Clones flagged vertices, creating new vertices that aren't used by any faces.
Clones the flagged faces, as well as all the vertices and edges that are used by the faces.
Copies bare geometry only - no per-vertex data, maps, or normals.
Useful for keeping low-memory local caches of a mesh where map, vertex data, edge data, normals, and other interfaces are not required.
Moves the flagged components into their "average plane".
(Plane computed using average component positions and normals.)
DllExport bool MoveVertsToPlane | ( | Point3 & | norm, |
float | offset, | ||
DWORD | flag = MN_SEL , |
||
Point3 * | delta = NULL |
||
) |
Projects the flagged vertices into the specified plane, or produces an array of offsets which would do so.
Detaches specified faces to a separate element, cloning vertices and edges as necessary on the boundary between flagged and unflagged faces.
DllExport bool DetachElementToObject | ( | MNMesh & | nmesh, |
DWORD | fflags = MN_SEL , |
||
bool | delDetached = true |
||
) |
Detaches specified faces (and related vertices and edges) to a new MNMesh.
As indicated by the name, the specified region should be a single element; crashes will occur if faces that are flagged share vertices or edges with nonflagged faces.
DllExport bool ExtrudeFaceClusters | ( | MNFaceClusters & | fclust | ) |
Performs the topological component of an extrusion on all face clusters.
Each cluster is "extruded", which means that vertices and edges on the boundary of the cluster are cloned and new faces and edges are created to connect the clones to the originals. (Note that nothing is moved in this process - movement is handled separately. See GetExtrudeDirection for details.)
DllExport bool ExtrudeFaceCluster | ( | MNFaceClusters & | fclust, |
int | cl | ||
) |
Performs the topological component of an extrusion on the specified face cluster.
This means that vertices and edges on the boundary of the cluster are cloned and new faces and edges are created to connect the clones to the originals. (Note that nothing is moved in this process - movement is handled separately. See GetExtrudeDirection for details.)
Performs the topological component of an extrusion on each flagged face individually.
(This differs from ExtrudeFaceClusters in that each face is treated like its own cluster.) Extrusion means that the vertices and edges used by each flagged face are cloned, and new faces and edges are created on the "sides" to connect the clones to their originals. (Note that nothing is moved in this process - movement is handled separately. See GetExtrudeDirection for details.)
DllExport void GetExtrudeDirection | ( | MNChamferData * | mcd, |
DWORD | faceFlag | ||
) |
DllExport void GetExtrudeDirection | ( | MNChamferData * | mcd, |
MNFaceClusters * | fclust = NULL , |
||
Point3 * | clustNormals = NULL |
||
) |
Finds the direction vectors for the geometric component of an extrusion after the topological component has been completed.
(See methods ExtrudeFaceClusters, ExtrudeFaceCluster, and ExtrudeFaces for details on the topological component.)
DllExport bool ExtrudeVertices | ( | DWORD | vertexFlag, |
MNChamferData * | pMCD, | ||
Tab< Point3 > & | tUpDir | ||
) |
This computes the new extruded vertices from the selected vertices using the using the current vertex selection.
vertexFlag | Determines what vertices to extrude. To work on the selected edges set this to MN_SEL. |
pMCD | The chamfer information which can be obtained from MNTempData. |
tUpDir | The offset vector for the extrusion for each vertex. |
DllExport bool ExtrudeEdges | ( | DWORD | edgeFlag, |
MNChamferData * | pMCD, | ||
Tab< Point3 > & | tUpDir | ||
) |
Same as ExtrudeVertices() but is applied to the edges.
Computes the new extruded edges from the selected edges using the using the current edge selection.
\param edgeFlag Determines what edges to extrude. To work on the selected edges set this to MN_SEL. \param pMCD The chamfer information which can be obtained from MNTempData. \param tUpDir The offset vector for the extrusion for each vertex. \return Returns true is the extrude operation is completed successfully.
DllExport bool ExtrudeFaceClusterAlongPath | ( | Tab< Matrix3 > | tFrenets, |
MNFaceClusters & | fclust, | ||
int | clusterID, | ||
bool | align | ||
) |
Extrudes a group of faces along a path defined by tFrenets.
tFrenets | A spline that has been sampled down and at each sample a transform is computed. |
fclust | A set of face clusters. |
clusterID | The ID of the cluster to operate on. |
align | Determines whether to align the extrusion to the cluster normal or the spline. |
Sets vertex colors for the specified vertices.
This is done by finding all map vertices in the specified vertex color channel that correspond to each flagged vertex and setting them to the color given.
Sets vertex colors for the specified faces.
This is done by finding all map vertices used by flagged faces and setting them to the color given. In cases where a map vertex is used by both a flagged and an unflagged face, the map vertex is split so that the unflagged faces' colors are unaffected by this change.
DllExport bool ChamferVertices | ( | DWORD | flag = MN_SEL , |
MNChamferData * | mcd = NULL |
||
) |
Performs the topological component of a vertex chamfer on the flagged vertices, and provides the data needed to do the geometric component.
That is to say, this method clones the flagged vertices and creates the new edges and faces needed in a chamfer operation. It also determines the direction each vertex and mapping vertex will go as the user drags out the chamfer - but it doesn't actually move any vertices.
DllExport bool ChamferEdges | ( | DWORD | flag = MN_SEL , |
MNChamferData * | mcd = NULL |
||
) |
Performs the topological component of an edge chamfer on the flagged edges, and provides the data needed to do the geometric component.
That is to say, this method clones the flagged edges and creates the new vertices and faces needed in the edge chamfer operation. It also determines the direction each vertex and mapping vertex will go as the user drags out the chamfer - but it doesn't actually move anything.
DllExport bool QuadChamfer | ( | float | amount, |
int | segments, | ||
float | tension, | ||
MN_QCHAM_TYPE | resultType, | ||
DWORD | flag = MN_SEL |
||
) |
Performs a Quad Chamfer operation on the flagged edges using the original Max 2015 options and Max 2015 version of the Quad Chamfer algorithm.
To use a specific version of the Quad Chamfer algorithm (for backwards compatibility, for example), use the alternate method, below, which includes an optional 'version' parameter (see QCHAM_VERSION_XXX, above).
amount | - Indicates how much distance to chamfer |
segments | - Indicates how many segments to create on the chamfered edges (>0 for quads) |
tension | - Indicates how much tension to apply to chamfer (0.0 - 1.0) |
resultType | - Indicates what result is desired. QCHAM_CHAMFEREDOBJECT=chamfered object, QCHAM_NOCHAMFERS=object with chamfered edges removed, QCHAM_CHAMFERSONLY=object with chamfered edges only |
flag | - Indicates which vertices to chamfer. |
DllExport bool QuadChamfer | ( | float | amount, |
int | segments, | ||
float | tension, | ||
DWORD | optionFlags, | ||
MN_QCHAM_TYPE | resultType, | ||
DWORD | flag = MN_SEL , |
||
int | version = QCHAM_VERSION_LATEST |
||
) |
Performs a Quad Chamfer operation on the flagged edges with options and versioning.
amount | - Indicates how much distance to chamfer |
segments | - Indicates how many segments to create on the chamfered edges (>0 for quads) |
tension | - Indicates how much tension to apply to chamfer (0.0 - 1.0) |
optionFlags | - Supplies chamfering options (see QCHAM_OPTION_XXX above). |
resultType | - Indicates what result is desired. QCHAM_CHAMFEREDOBJECT=chamfered object, QCHAM_NOCHAMFERS=object with chamfered edges removed, QCHAM_CHAMFERSONLY=object with chamfered edges only |
flag | - Indicates which vertices to chamfer. |
version | - Indicates the version to use (see QCHAM_VERSION_XXX above). Optional; defaults to QCHAM_VERSION_LATEST (latest version) |
Implements the Editable Poly Cut algorithm from the face level - cuts from a point on one face to a point on another face.
Implements the Editable Poly Cut algorithm from the edge level - cuts from a point on one edge to a point on another edge.
DllExport int CutEdge_Versioned | ( | int | e1, |
float | prop1, | ||
int | e2, | ||
float | prop2, | ||
Point3 & | Z, | ||
bool | split, | ||
DWORD | ver | ||
) |
Only call this method when you need to go back to a previous version of the code to load older files to maintain procedurality.
Implements the Editable Poly Cut algorithm from the vertex level - cuts from one vertex to another.
Only call this method when you need to go back to a previous version of the code to load older files to maintain procedurality.
Applies UVW Mapper to create the desired mapping in the specified channel.
Invalidates information, like bounding box and face normals, that's dependent on Geometry.
Call after changing the geometry.
Clears out topology-dependent cache information.
Note that this method clears topology-dependent flags such as MN_MESH_FILLED_IN, and thus invalidates the edge list. If you have taken pains to preserve the integrity of your edge list, you should set the MN_MESH_FILLED_IN flag immediately after calling InvalidateTopoCache().
This method is used to manage the display of vertex colors from any channel (or those that are passed in by some calling routine).
For instance, to set the mesh to display the Illumination channel as the current vertex colors, you would call SetDisplayVertexColors (MAP_SHADING). (Normally, it shows the standard vertex color channel, channel 0.) UpdateDisplayVertexColors() is used to refresh the vertex color pointers just before the MNMesh displays itself.
This method is used to manage the display of vertex colors from any channel (or those that are passed in by some calling routine).
For instance, to set the mesh to display the Illumination channel as the current vertex colors, you would call SetDisplayVertexColors (MAP_SHADING). (Normally, it shows the standard vertex color channel, channel 0.) UpdateDisplayVertexColors() is used to refresh the vertex color pointers just before the MNMesh displays itself.
If you have cached your own vertex color information that isn't in any of the map channels provided, you can use this method to set the internal pointers to use your data.
This method reconciles flags with arrays, checks and modifies data, ensures that the caches are consistent, and prepares the MNMesh pipeline.
For instance, if the MN_MESH_FILLED_IN flag is absent but there is still an edge array, this will free the edge array. This method is important to call if a MNMesh has been subjected to topology changing operations and should be called at the end of any operation on an MNMesh. Prepares MNMesh for pipeline. This just does a few basic checks and modifies data caches to be consistent. In particular it throws away the edge list if the MN_MESH_FILLED_IN flag is not set, and it frees any data in MN_DEAD map channels. This is a good method to call at the end of any operation on an MNMesh.
Allocates the "render vertices" used to optimize display routines.
Called by the system as needed.
DllExport void updateRVerts | ( | GraphicsWindow * | gw | ) |
Fills in the render vertices with display coordinates based on the specified view.
|
inline |
|
inline |
|
inline |
DllExport void render | ( | GraphicsWindow * | gw, |
Material * | ma, | ||
RECT * | rp, | ||
int | compFlags, | ||
int | numMat = 1 , |
||
InterfaceServer * | is = NULL |
||
) |
Causes the MNMesh to display itself in the indicated GraphicsWindow.
DllExport void renderFace | ( | GraphicsWindow * | gw, |
int | ff | ||
) |
Displays the indicated face in the GraphicsWindow.
This method is usually called only by MNMesh::render().
DllExport void render3DFace | ( | GraphicsWindow * | gw, |
int | ff | ||
) |
Displays the indicated face in the GraphicsWindow using hardware acceleration for texture and lighting if available.
This method is usually called only by MNMesh::render().
DllExport void render3DDiagonals | ( | GraphicsWindow * | gw, |
DWORD | compFlags | ||
) |
Displays all face diagonals in the GraphicsWindow using hardware acceleration for texture and lighting if available.
See the render method for a description of the parameters. This method is usually called only by MNMesh::render().
DllExport void renderDiagonals | ( | GraphicsWindow * | gw, |
DWORD | compFlags | ||
) |
Displays all face diagonals in the GraphicsWindow.
See the render method for a description of the parameters. This method is usually called only by MNMesh::render().
DllExport void renderDiagonal | ( | GraphicsWindow * | gw, |
int | ff, | ||
bool | useSegments = false , |
||
bool * | lastColorSubSel = NULL |
||
) |
Displays diagonals for the specified face in the GraphicsWindow.
This method is usually called only by MNMesh::render().
DllExport void render3DEdges | ( | GraphicsWindow * | gw, |
DWORD | compFlags | ||
) |
Displays all edges in the GraphicsWindow using hardware acceleration for texture and lighting if available.
See the render method for a description of the parameters. This method is usually called only by MNMesh::render().
DllExport void renderEdges | ( | GraphicsWindow * | gw, |
DWORD | compFlags | ||
) |
Displays all edges in the GraphicsWindow.
See the render method for a description of the parameters. This method is usually called only by MNMesh::render().
DllExport void renderEdge | ( | GraphicsWindow * | gw, |
int | ee, | ||
bool | useSegments = false , |
||
bool * | lastColorSubSel = NULL |
||
) |
Displays an edge in a GraphicsWindow.
This method is usually called only by MNMesh::render().
DllExport void ShallowCopy | ( | MNMesh * | amesh, |
ChannelMask | channels | ||
) |
DllExport void NewAndCopyChannels | ( | ChannelMask | channels | ) |
DllExport void FreeChannels | ( | ChannelMask | channels, |
BOOL | zeroOthers = 1 |
||
) |
|
virtual |
Reimplemented from BaseInterfaceServer.
Forces all the derived data used to display the mesh to be deleted.
This data can be things like the gfx normals, the direct x mesh cache, tri stripping data etc.
DllExport bool NeedGWCacheRebuilt | ( | GraphicsWindow * | gw, |
Material * | ma, | ||
int | numMat | ||
) |
This returns whether the Graphics Cache for this object needs to be rebuilt.
DllExport void BuildGWCache | ( | GraphicsWindow * | gw, |
Material * | ma, | ||
int | numMat, | ||
BOOL | threaded | ||
) |
Builds the graphics window cached mesh.
This method can be used to invalidate any display-technology-specific caches of the MNMesh.
In particular, it's currently used to invalidate the DirectX cache of the mesh. This is important to call, for example, after changing Vertex Colors or Texture coordinates, if you don't already call InvalidateGeomCache (). "DWORD keepFlags" should be zero. We may someday add flags indicating that some parts of the hardware mesh cache should be kept, but for now, the whole cache is invalidated. (An example usage is in maxsdk/samples/mesh/EditablePoly\PolyEdOps.cpp.)
Set the mesh or as static or not.
As static mesh has no animated channels. This allows certain display optimization since we know the mesh is not changing.
[in] | staticMesh | Whether the mesh is to tagged static or not. |
DllExport MNNormalSpec* GetSpecifiedNormals | ( | ) |
Returns a pointer to the user-specified normal interface, if present.
DllExport MNNormalSpec* GetSpecifiedNormalsForDisplay | ( | ) |
Returns a non-NULL MNNormalSpec interface pointer only if the interface
is present, and is prepared for use in display - otherwise, it returns
NULL, and we fall back on the smoothing groups.
A MNNormalSpec is considered "prepared for display" only if the
MNNORMAL_NORMALS_BUILT and MNNORMAL_NORMALS_COMPUTED flags are set.
(See the MNNormalSpec methods BuildNormals and ComputeNormals.)
Clears out the specified normal interface, if present.
Removes it
completely, so it won't flow up the stack, etc.
Creates the user-specified normal interface in this mesh.
Initializes
the MNNormalSpec's "Parent" to this mesh, but does not allocate normal faces
or otherwise prepare the normals. Note that this interface will flow
up the pipeline, in the GEOM_CHANNEL and TOPO_CHANNEL channels.
Transforms all vertices & hidden vertices by the Matrix xfm.
|
inline |
Figures out if this mesh is completely closed.
Meshes with the MN_MESH_RATSNEST flags are automatically considered open. Otherwise, each edge is checked to see if it has a face on both sides. If so, the mesh is closed. Otherwise, it's open.
Similar to the 3ds Max "Relax" modifier: this modifier moves each MNVert towards the average of all vertices to which it is connected (by MNEdges).
This is useful for tessellation algorithms.
DllExport bool LiftFaceClusterFromEdge | ( | int | liftEdge, |
float | liftAngle, | ||
int | segments, | ||
MNFaceClusters & | fclust, | ||
int | clusterID | ||
) |
Detaches the face cluster and rotates its around the hinge edge and fills in the gap.
Similar to MNMeshUtilities::HingeFromEdge() but requires a edge index instead of a point.
liftEdge | The index of the edge that the face cluster is going to be hinged around. |
liftAngle | An argument of type float. |
segments | The number of segments for the sides of the extrusion. |
fclust | A face cluster set. |
clusterID | The specific face cluster to operate on. |
This is an auto-smooth algorithm that allows the developer to specify exactly which edges should be creases and which should be smoothed across.
All face smoothing groups are rewritten by this algorithm. This algorithm is used, for example, in MeshSmooth, NURMS style, when the user turns on "smooth result" and applies crease values to some edges.
DllExport void GenerateRenderItems | ( | MaxSDK::Graphics::IRenderItemContainer & | renderItems, |
const MaxSDK::Graphics::GenerateMeshRenderItemsContext & | generateRenderItemsContext | ||
) |
Generate a set of render items according to the given render-item-generate context.
renderItems | the container that accept newly generated render items. |
generateRenderItemsContext | contains all the information that is used to generate all the required render items. |
DllExport void GenerateDeferredRenderItems | ( | MaxSDK::Graphics::IRenderItemContainer & | renderItems, |
const MaxSDK::Graphics::GenerateMeshRenderItemsContext & | generateRenderItemsContext | ||
) |
Generate a set of render items according to the given render-item-generate context.
The mesh will be built in realize render item callback. So only use this function if the mesh is stable in current frame. It has better performance, because it only generates necessary data. For example, in wireframe mode, no normal data will be generated.
renderItems | the container that accept newly generated render items. |
generateRenderItemsContext | contains all the information that is used to generate all the required render items. |
DllExport void FaceFindEdgeAdjacentFaces | ( | int | faceIndex, |
BitArray & | adjacentFaces, | ||
IntTab & | adjacentFaceIndexes, | ||
bool | includeFaceIndex = false |
||
) |
Create a map and list of faces adjacent to a given face's edges.
Given a face index, set bits in the provided BitArray corresponding to the faces that are adjacent to that face, sharing edges. Also append indexes of those faces to the provided IntTab.
faceIndex | The index of the face to find adjacent faces for. |
adjacentFaces | BitArray of faces, where bits will be set to indicate those faces which are adjacent. This BitArray should be initialized with the number of bits set to the number of faces in the mesh prior to calling the method, and the bits should be cleared, if desired. This method does NOT clear the bits itself, allowing the caller to call this method several times with different face indexes, building up an array and list of faces for later processing. If sequential calls to this method are made using different faceIndex parameters but reusing the adjacentFaces and adjacentFaceIndexes objects, DO NOT clear or alter the adjacentFaces BitArray between calls or the adjacentFaceIndexes list can contain duplicates. |
adjacentFaceIndexes | IntTab that will have adjacent face indexes appended to it as they are found. This list is not sorted, and there will only be one entry per adjacent face (no duplicates). |
includeFaceIndex | When true, include 'faceIndex' face in adjacentFaceIndexes list. Defaults to false (doesn't include it). |
DllExport void FaceFindAdjacentFaces | ( | int | faceIndex, |
BitArray & | adjacentFaces, | ||
IntTab & | adjacentFaceIndexes, | ||
bool | includeFaceIndex = false |
||
) |
Create a map and list of faces adjacent to a given face.
Given a face index, set bits in the provided BitArray corresponding to the faces that are adjacent to that face, sharing either edges or vertices. Also append indexes of those faces to the provided IntTab.
faceIndex | The index of the face to find adjacent faces for. |
adjacentFaces | BitArray of faces, where bits will be set to indicate those faces which are adjacent. This BitArray should be initialized with the number of bits set to the number of faces in the mesh prior to calling the method, and the bits should be cleared, if desired. This method does NOT clear the bits itself, allowing the caller to call this method several times with different face indexes, building up an array and list of faces for later processing. If sequential calls to this method are made using different faceIndex parameters but reusing the adjacentFaces and adjacentFaceIndexes objects, DO NOT clear or alter the adjacentFaces BitArray between calls or the adjacentFaceIndexes list can contain duplicates. |
adjacentFaceIndexes | IntTab that will have adjacent face indexes appended to it as they are found. This list is not sorted, and there will only be one entry per adjacent face (no duplicates). |
includeFaceIndex | When true, include 'faceIndex' face in adjacentFaceIndexes list. Defaults to false (doesn't include it). |
DllExport void VertexFindAdjacentFaces | ( | int | vertexIndex, |
BitArray & | adjacentFaces, | ||
IntTab & | adjacentFaceIndexes | ||
) |
Create a map and list of faces adjacent to a vertex.
Given a vertex index, set bits in the provided BitArray corresponding to the faces that use that vertex. Also append indexes of those faces to the provided IntTab.
vertexIndex | The index of the vertex to find adjacent faces for. |
adjacentFaces | BitArray of faces, where bits will be set to indicate those faces which are adjacent. This BitArray should be initialized with the number of bits set to the number of faces in the mesh prior to calling the method, and the bits should be cleared, if desired. This method does NOT clear the bits itself, allowing the caller to call this method several times with different vertex indexes, building up an array and list of faces for later processing. If sequential calls to this method are made using different vertexIndex parameters but reusing the adjacentFaces and adjacentFaceIndexes objects, DO NOT clear or alter the adjacentFaces BitArray between calls or the adjacentFaceIndexes list can contain duplicates. |
adjacentFaceIndexes | IntTab that will have adjacent face indexes appended to it as they are found. This list is not sorted, and there will only be one entry per adjacent face (no duplicates). |
bool checkFaceSel | ( | int | face_i, |
Mesh_SelParams & | params | ||
) |
Invoke these methods to check the Sub-Objects associated with the face indexed by face_i is in the hit region.
The detailed parameters are in SelectionCheckParams structure. Currently these methods are not exposed in SDK.
bool checkFaceEdgesSel | ( | int | face_i, |
Mesh_SelParams & | params | ||
) |
bool checkFaceDiagonalSel | ( | int | face_i, |
Mesh_SelParams & | params | ||
) |
bool checkVertSel | ( | int | vert_i, |
Mesh_SelParams & | params | ||
) |
bool checkFaceBackFacing | ( | int | face_i, |
Mesh_SelParams & | params | ||
) |
DllExport bool IsAccelDataDirty | ( | ) |
Checks if the space accelerating data is up-to-date.
Update the space accelerating data.
DllExport BOOL select | ( | GraphicsWindow * | gw, |
Material * | ma, | ||
HitRegion * | hr, | ||
int | abortOnHit = FALSE , |
||
int | numMat = 1 |
||
) |
Checks the given HitRegion to see if it intersects this Mesh object.
DllExport BOOL SubObjectHitTest | ( | GraphicsWindow * | gw, |
Material * | ma, | ||
HitRegion * | hr, | ||
DWORD | flags, | ||
SubObjHitList & | hitList, | ||
int | numMat = 1 |
||
) |
This method may be called to perform sub-object hit testing on this mesh.
Provides the intersection point and normal for the ray with this mesh.
Provides the intersection point and normal for the ray with this mesh.
Similiar to above overrided function with the difference of having the barycentric coordinates as the function returned result.
In case of no hit it will return nullptr. This function guarantees the returned array has enough space that matches the degree of the face. It is suggested to use this function because it does not require intermediate memory allocation. This function is implemented to be thread safe.
This function computes the render normal for the specified face and corner.
Unlike the method of buildNormals() and buildRenderNormals(), this function does not rely on whole RVertex array to achieve normal computation, which means it is lightweight and it quite efficent to do the normal computation for a given face and corner index. The only limitation is that this function will update the space accelerating structure if it is needed.
face_i | The index to the face. |
corner | The corner index within the face(must between 0 and 2 inclusively) |
This function computes the interpolated normals regarding the barycentric coordinates.
face_i | The index to the face. |
bary | The input barycentric coordinates to compute the interpolated normal. It must point to an array of float that have large size than face degree. |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
MNVert* v |
The array of vertices.
MNEdge* e |
The array of edges.
MNFace* f |
The array of faces;.
int numm |
PerData* vd |
BitArray vdSupport |
This bit array indicates if a particular vertex data channel is supported in this MNMesh.
If the bit is set the channel is supported.
PerData* ed |
BitArray edSupport |
This bit array indicates if a particular edge data channel is supported in this MNMesh.
If the bit is set the channel is supported.
DWORD dispFlags |
Display flags.
This is an array of int Tabs that records which edges use each vertex.
For instance, if edges 3, 5, and 6 have an endpoint at vertex 0, vedg[0] would include 3, 5, and 6, though not in any particular order. Note that this information is only valid if the MN_MESH_FILLED_IN flag is set.
This is an array of int Tabs that records which faces touch each vertex.
For instance, if faces 0, 1, 3, 8, and 9 use vertex 0 as one of their corners, vfac[0] would include 0, 1, 3, 8, and 9, though not in any particular order. Note that this information is only valid if the MN_MESH_FILLED_IN flag is set.
|
static |
This is the current version used for Cut and CutEdge and should be upped and documented when the cut code changes so edit poly can load the correct cut on older files to prevent them from breaking due to vertex reorder 1 : 2015 and older 2 : fixes a bug MAXX-19584 which was when a vertex and edge hit the same spot the edge would be picked causing a duplicate vertex, now the vertex is picked.