#include "maxheap.h"
#include "export.h"
#include "baseinterface.h"
#include "mncommon.h"
#include "hitdata.h"
#include "point3.h"
#include "bitarray.h"
#include "matrix3.h"
#include "box3.h"
#include "TabTypes.h"
#include "GraphicsConstants.h"
#include "channels.h"
#include "mesh.h"
This file contains a number of utility classes for manipulating triangle or generalized polygon meshes.
The following files contains important grouping of constants and flags:
Classes | |
class | MNVert |
The vertex class used with the MNMesh mesh. More... | |
class | MNEdge |
An edge used with the MNMesh mesh. More... | |
class | MNMapFace |
Used to store map vertex information for a given face and map channel. More... | |
class | MNFace |
The face structure used with the MNMesh mesh. More... | |
class | MNMap |
Holds the mapping information for a particular map channel of the MNMesh. More... | |
class | MNDiagonalHitData |
This class is used for hit-testing diagonals of polygons in Editable Poly and Edit Poly. More... | |
class | MNMesh |
The MNMesh class is provided for temporary use by plug-ins, to help with complex topology-based modifications to Meshes. More... | |
class | MNMeshBorder |
Hold boundary information for an MNMesh mesh. More... | |
class | MNFaceElement |
Used to assist in the process of sorting MNMesh faces into separate elements. More... | |
class | MNFaceClusters |
Used for grouping faces in an MNMesh into clusters for applying transformations. More... | |
class | MNEdgeClusters |
Represents a list of edge "clusters" for a given MNMesh. More... | |
class | MNChamferData |
Contains all the data needed to move points (and map vertices) as the user drags a chamfer or extrude. More... | |
class | MNTempData |
Used for caching face and edge clusters, vertex normals, and other derived data about an MNMesh. More... | |
class | IMNTempData10 |
Interface for changes made to MNTempData in version 9.5. More... | |
class | BasisFinder |
Computes two components of a basis vector given a single input component. More... | |
class | MNMeshSelectionConverter |
When a Mesh object or modifier (such as Editable Mesh, Edit Mesh, or Mesh Select) handles viewport subobject selection, the flow is basically as follows from Editable Mesh. More... | |
class | MNMeshUtilities |
Provides a number of utility functions for working with MNMesh. More... | |
class | MNMapPreserveData |
This class is used to "preserve" mapping coordinates while moving vertices. More... | |
class | IMNMeshUtilities8 |
IMNMeshUtilities8 extends the MNMeshUtilities class, adding new functionality applied on a MNMesh. More... | |
class | IMNMeshUtilities10 |
Extends the MNMeshUtilities class, adding new functionality applied on a MNMesh. More... | |
class | IMNMeshUtilities13 |
Extends the MNMeshUtilities class, adding new functionality applied on a MNMesh. More... | |
Namespaces | |
MaxSDK | |
These classes let you define skin weighting using a voxel or height map based algorithm. | |
MaxSDK::Graphics | |
Macros | |
#define | REALLOC_SIZE 10 |
#define | MNMESH_FACEDATA_IMPL |
Enables Face Data in PolyObjects: More... | |
#define | MNM_SELCONV_REQUIRE_ALL 0x02 |
#define | MN_MESH_NONTRI (1<<0) |
At least 2 triangles have been joined. More... | |
#define | MN_MESH_FILLED_IN (1<<1) |
If set, all topological links, such as the list of edges, are complete. More... | |
#define | MN_MESH_RATSNEST (1<<2) |
Some regular Meshes have more than two faces referencing the same edge, or more than one referencing it in the same direction. More... | |
#define | MN_MESH_NO_BAD_VERTS (1<<3) |
This indicates that the mesh has had its vertices checked and "bad" ones eliminated by EliminateBadVerts. More... | |
#define | MN_MESH_VERTS_ORDERED (1<<4) |
Set if face and edge tables in each vertex are ordered by the methods MNMesh::OrderVerts(). More... | |
#define | MN_MESH_FACE_NORMALS_INVALID (1<<6) |
Set if any of the face normals (fnorm) have become invalid. More... | |
#define | MN_MESH_HAS_VOLUME (1<<7) |
This mesh has at least one connected component which contains volume, i.e. More... | |
#define | MN_MESH_HITTEST_REQUIRE_ALL (1<<8) |
#define | MN_MESH_PARTIALCACHEINVALID (1<<16) |
Indicates that the MNMesh has only set some of the vertices as invalid and not to reprocess the entire mesh just the vertices that changed. More... | |
#define | MN_MESH_CACHE_FLAGS (MN_MESH_FILLED_IN|MN_MESH_NO_BAD_VERTS|MN_MESH_VERTS_ORDERED) |
#define | MNDISP_VERTTICKS 0x01 |
Display vertex tick marks. More... | |
#define | MNDISP_SELVERTS 0x02 |
Display selected vertices. More... | |
#define | MNDISP_SELFACES 0x04 |
Display selected faces. More... | |
#define | MNDISP_SELEDGES 0x08 |
Display selected edges. More... | |
#define | MNDISP_NORMALS 0x10 |
Display face normals. More... | |
#define | MNDISP_SMOOTH_SUBSEL 0x20 |
Analogous to the Mesh display flag MESH_SMOOTH_SUBSEL, this indicates whether we should display smooth faces with selection-color outlines (TRUE) or transparent shaded faces (FALSE) More... | |
#define | MNDISP_BEEN_DISP 0x40 |
Set when the MNMesh has been displayed (at the end of the render method.) More... | |
#define | MNDISP_DIAGONALS 0x80 |
Set when diagonals should be displayed. More... | |
#define | MNDISP_HIDE_SUBDIVISION_INTERIORS 0x100 |
#define | MNDISP_USE_VERTEX_COLORS 0x200 |
Set when vertex color data (VDATA_COLOR, if present) should be used to draw edges (used by OpenSubdiv) More... | |
#define | MNDISP_USE_EDGE_COLORS 0x400 |
Set when edge color data (EDATA_COLOR, if present) should be used to draw vertices (used by OpenSubdiv) More... | |
#define | IMNMESHUTILITIES10_INTERFACE_ID Interface_ID(0x7b1acb31, 0x763982d5) |
#define | IMNMESHUTILITIES13_INTERFACE_ID Interface_ID(0x4dfa07c3, 0x637941b0) |
General MNMesh Component Flags | |
For MNVerts, MNEdges, and MNFaces, bits 0-7 are used for common characteristics of all components. Bits 8-15 are used for component-specific flags. Bits 16-23 are reserved for temporary use in MNMesh algorithms. Bits 24-31 are reserved for MNMath.lib users. | |
#define | MN_SEL (1<<0) |
Indicates that a component is selected. More... | |
#define | MN_DEAD (1<<1) |
Indicates that a component is not used and should be ignored. More... | |
#define | MN_TARG (1<<2) |
Indicates that a component is targeted. More... | |
#define | MN_BACKFACING (1<<3) |
Indicates that the vertex faces "backwards" in the current viewport. More... | |
#define | MN_HIDDEN (1<<4) |
#define | MN_CACHEINVALID (1<<5) |
#define | MN_INFOREGROUND (1<<7) |
Tags a face as not renderable but can be hit-test. More... | |
#define | MN_WHATEVER (1<<16) |
#define | MN_LOCAL_SEL (1<<17) |
Alternate selections (not passed up the pipe). More... | |
#define | MN_HITTEST_CULLED (1<<18) |
Used to indicate culled components (neither selected nor not selected) in window-region hit testing. More... | |
#define | MN_USER (1<<24) |
Any value above this can be used by applications. More... | |
Vertex Flags | |
#define | MN_VERT_DONE (1<<8) |
Set in algorithms that may accidentally revisit the same vertex (MNVertext twice, to keep them from processing it the second time. More... | |
#define | MN_VERT_WELDED (1<<9) |
Used by MNMesh::WeldBorderVerts() More... | |
#define | MN_VERT_SUBDIVISION_CORNER (1<<10) |
Track which vertices are direct "descendants" of the original cage vertices in subdivision. More... | |
Edge flags | |
#define | MN_EDGE_INVIS (1<<8) |
Both faces using this edge consider it invisible. More... | |
#define | MN_EDGE_NOCROSS (1<<9) |
This edge should not be crossed in algorithms like MNMesh::SabinDoo that can mix faces across edges. More... | |
#define | MN_EDGE_MAP_SEAM (1<<10) |
Track which edges are direct descendants of the original cage edges in subdivision. More... | |
#define | MN_EDGE_SUBDIVISION_BOUNDARY (1<<11) |
Track unwanted edges created by Cut, so they might be removed later. More... | |
#define | MN_EDGE_CUT_EXTRA (1<<12) |
Used with MNMesh::CutPrepare() and MNMEsh::CutCleanUp() More... | |
#define | MN_EDGE_WAS_PROCESSED (1<<13) |
This flag is a general-purpose informational one that methods can set to indicate edges that were processed as part of their work, so that callers can act on them if desired. More... | |
Interface IDs | |
#define | IMNMESHUTILITIES8_INTERFACE_ID Interface_ID(0xf5235e73, 0x3b304334) |
Interface id for IMNMeshUtilities8, se.g. More... | |
#define | IMNTEMPDATA10_INTERFACE_ID Interface_ID(0x56d8fa2, 0x3459c774) |
Interface ID for IMNTempData10. More... | |
Quad Chamfer option flags: | |
#define | QCHAM_OPTION_ELWOOD_DEFAULTS (0) |
Elwood (Max 2015) defaults. More... | |
#define | QCHAM_OPTION_LIMIT_EFFECT (1<<0) |
Provides legacy-style limiting of chamfering. More... | |
Quad Chamfer version values: | |
#define | QCHAM_VERSION_ELWOOD (0) |
Elwood (Max 2015) More... | |
#define | QCHAM_VERSION_PHOENIX (100) |
Phoenix (Max 2016) - Includes edge selection fix. More... | |
#define | QCHAM_VERSION_LATEST (QCHAM_VERSION_PHOENIX) |
The latest version, used as the default. More... | |
MNFace flags: | |
#define | MN_FACE_OPEN_REGION (1<<8) |
This face is part of a region of the mesh that is not closed, i.e. More... | |
#define | MN_FACE_CHECKED (1<<9) |
#define | MN_FACE_CHANGED (1<<10) |
This flag can be cleared on all faces before an operation that moves some of the vertices of an MNMesh, then set for each face touching one of the moved vertices. More... | |
#define | MN_FACE_CULLED (1<<11) |
Used to indicate a face has been culled during hit-testing. More... | |
#define | MN_FACE_CREATED (1<<12) |
Used to indicate a face has been created by an operation. More... | |
Per-edge Data | |
#define | MAX_EDGEDATA 10 |
Developer defined data. More... | |
#define | EDATA_KNOT 0 |
The edge knot data. More... | |
#define | EDATA_CREASE 1 |
The crease data. More... | |
#define | EDATA_COLOR 2 |
Internal flags | |
#define | MN_MESH_TEMP_1 (1<<13) |
#define | MN_MESH_TEMP_2 (1<<14) |
#define | MN_MESH_DONTTRISTRIP (1<<15) |
#define | MN_MESH_SUBSELECTION_INVALID (1<<17) |
#define | MN_MESH_SOFTSELECTION_WEIGHT_INVALID (1<<18) |
#define | MN_MESH_USE_MAX2012_WELD_MATH (1<<19) |
Flags for Sub Object Hit-Test | |
#define | SUBHIT_MNUSECURRENTSEL (1<<22) |
When this bit is set, the selection only and unselection only tests will use the current level (edge or face) selection when doing a vertex level hit test. More... | |
#define | SUBHIT_OPENONLY (1<<23) |
#define | SUBHIT_MNVERTS (1<<24) |
#define | SUBHIT_MNFACES (1<<25) |
#define | SUBHIT_MNEDGES (1<<26) |
#define | SUBHIT_MNDIAGONALS (1<<27) |
Hit-test on "diagonals" of polygons - MNDiagonalHitData is the type of HitData returned. More... | |
#define | SUBHIT_MNTYPEMASK (SUBHIT_MNVERTS|SUBHIT_MNFACES|SUBHIT_MNEDGES|SUBHIT_MNDIAGONALS) |
Subdivision Flags | |
#define | MN_SUBDIV_NEWMAP 0x01 |
#define | MN_SUBDIV_HIDE_INTERNAL_EDGES 0x10 |
Enumerations | |
enum | PMeshSelLevel { MNM_SL_OBJECT, MNM_SL_VERTEX, MNM_SL_EDGE, MNM_SL_FACE, MNM_SL_CURRENT } |
MNMesh selection levels. More... | |
Quad Chamfer result options: | |
enum | MN_QCHAM_TYPE { QCHAM_CHAMFEREDOBJECT =0, QCHAM_NOCHAMFERS, QCHAM_CHAMFERSONLY } |
Functions | |
DllExport void | DiagSort (int dnum, int *diag) |
Puts diagonals in increase-by-last-index, decrease-by-first order. More... | |
DllExport int | EdgeDataType (int edID) |
DllExport void * | EdgeDataDefault (int edID) |
DllExport void | MNChamferDataDebugPrint (MNChamferData &mcd, int mapNum) |
Output all the data in the specified MNChamferData to the DebugPrint buffer during debug runs using using DebugPrint(). More... | |
DllExport void | SelectionDistance (MNMesh &mesh, float *selDist, int iters, DWORD selFlags) |
This function computes the current distance of each vertex from the current selection, along paths of edges. More... | |
DllExport void | ClustDistances (MNMesh &mesh, int numClusts, int *vclust, Tab< float > **clustDist) |
Computes the current distance of each vertex from the specified cluster. More... | |
DllExport void | ClustDistances (MNMesh &mesh, int numClusts, int *vclust, Tab< float > **clustDist, int iters) |
Computes the current distance of each vertex from the specified cluster. More... | |
Variables | |
const int | kMNNurmsHourglassLimit = 2500 |
#define REALLOC_SIZE 10 |
#define MNMESH_FACEDATA_IMPL |
Enables Face Data in PolyObjects:
#define MNM_SELCONV_REQUIRE_ALL 0x02 |
#define IMNMESHUTILITIES8_INTERFACE_ID Interface_ID(0xf5235e73, 0x3b304334) |
Interface id for IMNMeshUtilities8, se.g.
bridge edge methods.
#define IMNTEMPDATA10_INTERFACE_ID Interface_ID(0x56d8fa2, 0x3459c774) |
Interface ID for IMNTempData10.
#define QCHAM_OPTION_ELWOOD_DEFAULTS (0) |
Elwood (Max 2015) defaults.
#define QCHAM_OPTION_LIMIT_EFFECT (1<<0) |
Provides legacy-style limiting of chamfering.
#define QCHAM_VERSION_ELWOOD (0) |
Elwood (Max 2015)
#define QCHAM_VERSION_PHOENIX (100) |
Phoenix (Max 2016) - Includes edge selection fix.
#define QCHAM_VERSION_LATEST (QCHAM_VERSION_PHOENIX) |
The latest version, used as the default.
#define MN_FACE_OPEN_REGION (1<<8) |
This face is part of a region of the mesh that is not closed, i.e.
there are 1-sided edges. This means that the mesh is not a solid object, it has gaps or holes.
#define MN_FACE_CHECKED (1<<9) |
For recursive face-and-neighbor-checking
#define MN_FACE_CHANGED (1<<10) |
This flag can be cleared on all faces before an operation that moves some of the vertices of an MNMesh, then set for each face touching one of the moved vertices.
This tells the parent MNMesh that these faces may need to have information such as triangulation recomputed. This flag is set by the MNMesh::SabinDoo() method.
#define MN_FACE_CULLED (1<<11) |
Used to indicate a face has been culled during hit-testing.
#define MN_FACE_CREATED (1<<12) |
Used to indicate a face has been created by an operation.
For example, this flag is set by the MNMesh::QuadChamfer method on faces that are part of the chamfer. Methods that use this flag will clear it on all faces before performing operations, so that only newly-created faces will have it set.
#define MAX_EDGEDATA 10 |
Developer defined data.
#define EDATA_KNOT 0 |
The edge knot data.
This is index 0.
#define EDATA_CREASE 1 |
The crease data.
This is index 1.
#define EDATA_COLOR 2 |
#define MN_MESH_TEMP_1 (1<<13) |
#define MN_MESH_TEMP_2 (1<<14) |
#define MN_MESH_DONTTRISTRIP (1<<15) |
#define MN_MESH_SUBSELECTION_INVALID (1<<17) |
Mesh flag to determine if selection state of vertices, edges or faces has changed or not.
#define MN_MESH_SOFTSELECTION_WEIGHT_INVALID (1<<18) |
Mesh flag to determine if soft selection weight of vertices has changed or not.
#define MN_MESH_USE_MAX2012_WELD_MATH (1<<19) |
Mesh flag to determine whether to use a different math for MNMesh::WeldBorderVerts (float thresh, DWORD flag) since between 2012 and 2013 the FPU math changed slightly and this corrects for that
#define SUBHIT_MNUSECURRENTSEL (1<<22) |
When this bit is set, the selection only and unselection only tests will use the current level (edge or face) selection when doing a vertex level hit test.
#define SUBHIT_OPENONLY (1<<23) |
#define SUBHIT_MNVERTS (1<<24) |
#define SUBHIT_MNFACES (1<<25) |
#define SUBHIT_MNEDGES (1<<26) |
#define SUBHIT_MNDIAGONALS (1<<27) |
Hit-test on "diagonals" of polygons - MNDiagonalHitData is the type of HitData returned.
#define SUBHIT_MNTYPEMASK (SUBHIT_MNVERTS|SUBHIT_MNFACES|SUBHIT_MNEDGES|SUBHIT_MNDIAGONALS) |
#define MN_SUBDIV_NEWMAP 0x01 |
#define MN_SUBDIV_HIDE_INTERNAL_EDGES 0x10 |
#define IMNMESHUTILITIES10_INTERFACE_ID Interface_ID(0x7b1acb31, 0x763982d5) |
#define IMNMESHUTILITIES13_INTERFACE_ID Interface_ID(0x4dfa07c3, 0x637941b0) |
enum MN_QCHAM_TYPE |
enum PMeshSelLevel |
MNMesh selection levels.
MNM_SL_CURRENT is an acceptable argument to methods that take a selection level, indicating "use the current mesh selection level".
Enumerator | |
---|---|
MNM_SL_OBJECT | |
MNM_SL_VERTEX | |
MNM_SL_EDGE | |
MNM_SL_FACE | |
MNM_SL_CURRENT |
Puts diagonals in increase-by-last-index, decrease-by-first order.
This sorts the diagonals in the following fashion: each diagonal is reordered so that its smaller index comes first, then its larger. Then the list of diagonals is sorted so that it increases by second index, then decreases by first index. Such an ordered list for a 9-gon might be (1,3),(0,3), (0,4),(5,7),(4,7),(4,8). (This order is especially convenient for converting into triangles - it makes for a linear-time conversion.) DiagSort() uses qsort for speed.
DllExport void MNChamferDataDebugPrint | ( | MNChamferData & | mcd, |
int | mapNum | ||
) |
Output all the data in the specified MNChamferData to the DebugPrint buffer during debug runs using using DebugPrint().
It is available for programmers' use, providing easy access to MNChamferData during development. It ought to be removed for release builds.
mcd | The MNChamferData we want to investigate. |
mapNum | The number of map channels in the MNMesh associated with this MNChamferData . (For historical reasons, this information is not kept in the MNChamferData class.) Generally this is retrieved with a call to MNMesh::MNum(). |
This function computes the current distance of each vertex from the current selection, along paths of edges.
NOTE: This is an n-log-n algorithm: it compares every non-selected vertex with every selected one.
DllExport void ClustDistances | ( | MNMesh & | mesh, |
int | numClusts, | ||
int * | vclust, | ||
Tab< float > ** | clustDist | ||
) |
Computes the current distance of each vertex from the specified cluster.
If cached, the cache is returned. Otherwise a cache is allocated and computed from the current mesh and the parameters.
NOTE: This is an n-log-n algorithm for each cluster: it compares every vertex not in the cluster with every vertex in it.
DllExport void ClustDistances | ( | MNMesh & | mesh, |
int | numClusts, | ||
int * | vclust, | ||
Tab< float > ** | clustDist, | ||
int | iters | ||
) |
Computes the current distance of each vertex from the specified cluster.
If cached, the cache is returned. Otherwise a cache is allocated and computed from the current mesh and the parameters.
NOTE: This algorithm takes time proportional to the number of verts in each cluster times iters times the number of clusters.
const int kMNNurmsHourglassLimit = 2500 |