This reference page is linked to from the following overview topics: SDK Change Details, Incremental Improvements, Modeling, Meshes, Mesh Related Classes, MNMesh Edges, Creating Pipeline-Friendly Meshes, Hardware Mesh Support, MNMesh Note on Debugging.
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.
{MNMesh Note on Debugging}
#include <mnmesh.h>
Public Member Functions |
|
DllExport void | FacePointBary (int ff, Point3 &p, Tab< float > &bary) |
Finds "Generalized Barycentric Coordinates"
for the point given. |
|
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. |
|
MNMesh (const Mesh &from) | |
Constructor. |
|
MNMesh (const MNMesh &from) | |
Copy constructor. |
|
DllExport | ~MNMesh () |
Destructor. |
|
Allocation and Initialization
Methods
|
|
void | DefaultFlags () |
Clears all flags. |
|
DllExport void | Init () |
The data members are initialized as follows:
|
|
DllExport void | VAlloc (int num, bool keep=TRUE) |
Allocates and inits the specified number of
MNVerts. |
|
DllExport void | VShrink (int num=-1) |
Shrinks the nv_alloc size of the MNVert array to
the specified size. |
|
DllExport void | freeVEdge () |
Deallocates any MNEdges in the vedg table
and sets the vedg pointer to NULL. |
|
DllExport void | VEdgeAlloc () |
Allocates the vedg array. |
|
DllExport void | freeVFace () |
Deallocates the vfac array. |
|
DllExport void | VFaceAlloc () |
Allocates the vfac array. |
|
DllExport void | EAlloc (int num, bool keep=TRUE) |
Allocates the MNEdge data array e with
the specified size. |
|
DllExport void | EShrink (int num=-1) |
Reduces the ne_alloc size of the MNEdge data array e to the
specified number of elements. |
|
DllExport void | FAlloc (int num, bool keep=TRUE) |
Allocates the MNFace array f
with the specified size. |
|
DllExport void | FShrink (int num=-1) |
Reduces the nf_alloc size of the MNFace data
array f to the specified number of elements. |
|
DllExport void | MAlloc (int num, bool keep=TRUE) |
Allocates the
MNMap array m with the specified size. |
|
DllExport void | MShrink (int num=-1) |
Reduces the nm_alloc size of the
MNMap data array m to the specified number of elements.
|
|
Component Access Functions
|
|
int | VNum () const |
Returns the number of vertices. |
|
MNVert * | V (int i) const |
Returns a pointer to the i'th MNVert. |
|
Point3 & | P (int i) const |
Returns the point in the i'th MNVert. |
|
int | ENum () const |
Returns the number of edges. |
|
MNEdge * | E (int i) const |
Returns a pointer to the i'th MNEdge. |
|
int | FNum () const |
Returns the number of faces. |
|
MNFace * | F (int i) const |
Returns a pointer to the i'th MNFace.
|
|
int | MNum () const |
Internal. |
|
DllExport int | TriNum () const |
Number of triangles. |
|
Mapping Methods
|
|
DllExport MNMap * | M (int mapChannel) const |
This accessor accepts a value in the range
-NUM_HIDDENMAPS to MNum(). |
|
DllExport void | SetMapNum (int mpnum) |
Allocates and initializes the specified
number of
MNMap elements in the m array. |
|
DllExport void | InitMap (int mapChannel) |
Allocates and initializes basic planar map,
or a white map for the vertex color channel. |
|
DllExport void | ClearMap (int mapChannel) |
Clears and frees the specified map channel,
setting the MN_DEAD flag. |
|
DllExport UVVert | MV (int mapChannel, int i) const |
Returns the specified UVVert from the
specified mapping channel. |
|
DllExport MNMapFace * | MF (int mapChannel, int i) const |
Returns a pointer to the specified
MNMapFace from the specified mapping channel. |
|
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. |
|
DllExport bool | SeparateMapVerticesInFaceCluster (MNFaceClusters &fclust, int clusterID) |
Detaches the texture vertices on the border
edges of the fclust. |
|
DllExport bool | IsEdgeMapSeam (int mapChannel, int edge) |
Returns whether an edge is a seam or not.
|
|
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.
|
|
Per-Vertex Data
|
|
DllExport void | setNumVData (int ct, BOOL keep=FALSE) |
Sets the specified number of vertex data
elements. |
|
int | VDNum () const |
Returns the number of vertex data channels
maintained by this
MNMesh. |
|
DllExport BOOL | vDataSupport (int vdChannel) const |
Returns TRUE if the specified channel of
vertex data is available for this
MNMesh; otherwise FALSE. |
|
DllExport void | setVDataSupport (int vdChannel, BOOL support=TRUE) |
Sets if the specified channel of vertex data
is supported by this
MNMesh. |
|
void * | vertexData (int vdChannel) const |
Returns a pointer to the vertex data for the
specified channel or NULL if the channel is not supported. |
|
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. |
|
DllExport void | freeVData (int vdChannel) |
Deletes (deallocates) the vertex data for
the specified channel. |
|
DllExport void | freeAllVData () |
Deallocates the vertex data from all
channels and sets the number of supported channels to 0. |
|
Vertex Weight Methods
|
|
float * | getVertexWeights () |
Returns a pointer to the floating point
vertex weight data. |
|
void | SupportVertexWeights () |
Sets the channel support for the vertex
weights channel (VDATA_WEIGHT). |
|
void | freeVertexWeights () |
Frees (deallocates) the vertex weight
channel data. |
|
float * | getVSelectionWeights () |
Returns a pointer to the floating point
vertex selection weight data. |
|
void | SupportVSelectionWeights () |
Sets the channel support for the vertex
weights channel (VDATA_SELECT). |
|
void | freeVSelectionWeights () |
Frees (deallocates) the vertex selection
weight channel data. |
|
Per-Edge Data
|
|
DllExport void | setNumEData (int ct, BOOL keep=FALSE) |
Sets the specified number of edge data
elements. |
|
int | EDNum () const |
Returns the number of edge data channels
maintained by this
MNMesh. |
|
DllExport BOOL | eDataSupport (int edChannel) const |
Returns TRUE if the specified channel of
edge data is available for this
MNMesh; otherwise FALSE. |
|
DllExport void | setEDataSupport (int edChannel, BOOL support=TRUE) |
Sets if the specified channel of edge data
is supported by this
MNMesh. |
|
void * | edgeData (int edChannel) const |
Returns a pointer to the edge data for the
specified channel or NULL if the channel is not supported. |
|
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. |
|
DllExport void | freeEData (int edChannel) |
Deletes (deallocates) the edge data for the
specified channel. |
|
DllExport void | freeAllEData () |
Deallocates the edge data from all channels
and sets the number of supported channels to 0. |
|
Edge Knot Methods
|
|
float * | getEdgeKnots () |
Returns a pointer to the floating point edge
knot data. |
|
void | SupportEdgeKnots () |
Sets the channel support for the edge knot
channel (EDATA_KNOT). |
|
void | freeEdgeKnots () |
Frees (deallocates) the edge knot channel
data. |
|
Vertex Face and Edge Methods
|
|
DllExport void | VClear (int vv) |
Clears and frees the flags and face/edge
lists for the specified vertex. |
|
DllExport void | VInit (int vv) |
Initializes the specified MNVert, clearing
its flags and emptying its face & edge lists (if vfac & edg
are allocated). |
|
DllExport int | VFaceIndex (int vv, int ff, int ee=-1) |
Returns the index of face ff in the vfac[vv]
table. |
|
DllExport int | VEdgeIndex (int vv, int ee) |
This method is available in release 3.0 and
later only. |
|
void | VDeleteEdge (int vv, int ee) |
This method is available in release 3.0 and
later only. |
|
DllExport void | VDeleteFace (int vv, int ff) |
This method is available in release 3.0 and
later only. |
|
DllExport void | VReplaceEdge (int vv, int oe, int ne) |
This method is available in release 3.0 and
later only. |
|
DllExport void | VReplaceFace (int vv, int of, int nf) |
This method is available in release 3.0 and
later only. |
|
DllExport void | CopyVert (int nv, int ov) |
This method is available in release 3.0 and
later only. |
|
DllExport void | MNVDebugPrint (int vv) |
This method is available in release 3.0 and
later only. |
|
Mesh Building Functions
|
|
DllExport int | NewTri (int a, int b, int c, DWORD smG=0, MtlID mt=0) |
Creates a new tri-face. |
|
DllExport int | NewTri (int *vv, DWORD smG=0, MtlID mt=0) |
Creates a new face of degree 3. |
|
DllExport int | NewQuad (int a, int b, int c, int d, DWORD smG=0, MtlID mt=0) |
This method will create a new quad. |
|
DllExport int | NewQuad (int *vv, DWORD smG=0, MtlID mt=0) |
This method will create a new quad. |
|
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. |
|
DllExport int | CreateFace (int degg, int *vv) |
Creates a new face, using the vertices
given. |
|
DllExport int | AppendNewFaces (int nfnum) |
Appends the specified number of MNFaces to
f. |
|
DllExport void | setNumFaces (int nfnum) |
Sets the specified number of MNFaces
allocated in f. |
|
DllExport int | RegisterEdge (int v1, int v2, int f, int fpos) |
Edge creation tool. |
|
DllExport int | SimpleNewEdge (int v1, int v2) |
Edge creation tool. |
|
DllExport int | NewEdge (int v1, int v2, int f, int fpos) |
Edge creation tool. |
|
DllExport int | AppendNewEdges (int nenum) |
Appends the specified number of edges.
|
|
DllExport void | setNumEdges (int nenum) |
Sets the number of MNEdges allocated in e.
|
|
DllExport int | NewVert (Point3 &p) |
Creates a new vertex (increasing numv) and
sets it to the specified point. |
|
DllExport int | NewVert (Point3 &p, int vid) |
This method is available in release 3.0 and
later only. |
|
DllExport int | NewVert (int vid) |
Creates a new vertex and initializes it to
location, flags and other characteristics of vertex vid. |
|
DllExport int | NewVert (int v1, int v2, float prop) |
Creates a new vertex which is a linear
combination of two existing vertices. |
|
DllExport int | AppendNewVerts (int nvnum) |
Appends the specified number of MNVerts.
|
|
DllExport void | setNumVerts (int nvnum) |
Sets the number of verts, allocating if
needed. |
|
DllExport int | InsertSpur (int face, int vertIndex, Tab< int > *ptMapVertArray=NULL) |
Creates a spur on the face at vertexIndex.
|
|
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. |
|
DllExport void | CollapseDeadEdges () |
Removes all MNEdges with the MN_DEAD flag
from the list of edges. |
|
DllExport void | CollapseDeadFaces () |
Removes all MNFaces with the MN_DEAD flag
from the list of faces. |
|
DllExport void | CollapseDeadStructs () |
Performs all 5 of the above collapse
functions, safely removing all unused components from this mesh.
|
|
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. |
|
DllExport void | ClearAndFree () |
Deletes everything and frees all relevant
memory. |
|
DllExport void | freeVerts () |
Deletes the MNVert array and
frees any corresponding vertex data. |
|
DllExport void | freeEdges () |
Deletes the MNEdge array and frees and
corresponding edge data. |
|
DllExport void | freeFaces () |
Deletes the MNFace array.
|
|
DllExport void | freeMap (int mapChannel) |
Deletes the
MNMap on the specified map channel. |
|
DllExport void | freeMaps () |
Deletes and frees all the MNMaps. |
|
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. |
|
DllExport void | RemoveEdge (int edge) |
Kills the edge and joins the faces on either
side. |
|
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. |
|
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.
|
|
Bulk Flag Clearing and Setting
Functions
|
|
void | ClearVFlags (DWORD fl) |
Clears all specified flag bits in all
MNVerts. |
|
void | ClearEFlags (DWORD fl) |
Clears all specified flag bits in all
MNEdges. |
|
void | ClearFFlags (DWORD fl) |
Clears all specified flag bits in all
MNFaces. |
|
DllExport void | PaintFaceFlag (int ff, DWORD fl, DWORD fenceflags=0x0) |
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. |
|
DllExport void | UpdateBackfacing (GraphicsWindow *gw, bool force) |
Updates the MN_BACKFACING flag in all
components based on the specified view. |
|
Selection Methods
|
|
DllExport void | VertexSelect (const BitArray &vsel) |
Selects or deselects the vertices as
specified by on bits in the given bit array. |
|
DllExport void | EdgeSelect (const BitArray &esel) |
Selects or deselects the edges as specified
by on bits in the given bit array. |
|
DllExport void | FaceSelect (const BitArray &fsel) |
Selects or deselects the faces as specified
by on bits in the given bit array. |
|
bool | getVertexSel (BitArray &vsel) |
Fills the given bit array with the current
vertex selection state. |
|
bool | getEdgeSel (BitArray &esel) |
Fills the given bit array with the current
edge selection state. |
|
bool | getFaceSel (BitArray &fsel) |
Fills the given bit array with the current
face selection state. |
|
DllExport void | SelectEdgeLoop (BitArray &edgeSel) |
Using the current edge selection this
returns the original selection and the edge loop defined by those
selections. |
|
DllExport void | SelectEdgeRing (BitArray &edgeSel) |
Using the current edge selection this
returns the original selection and the ring loop defined by those
selections. |
|
DllExport BitArray | VertexTempSel (DWORD fmask=MN_DEAD|MN_SEL, DWORD fset=MN_SEL) |
Gets the current vertex selection, based on
the current selection level. |
|
Getting Components by Flag
|
|
DllExport bool | getVerticesByFlag (BitArray &vset, DWORD flags, DWORD fmask=0x0) |
Creates a BitArray of all vertices using the
specified flags. |
|
DllExport bool | getEdgesByFlag (BitArray &eset, DWORD flags, DWORD fmask=0x0) |
Creates a BitArray of all edges using the
specified flags. |
|
DllExport bool | getFacesByFlag (BitArray &fset, DWORD flags, DWORD fmask=0x0) |
Creates a BitArray of all faces using the
specified flags. |
|
DllExport void | ElementFromFace (int ff, BitArray &fset) |
Sets bits for all faces in the same
"element", or connected component, with face ff. |
|
DllExport void | BorderFromEdge (int ee, BitArray &eset) |
Takes a one-sided edge and sets the bits
representing this edge's "border". |
|
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.
|
|
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. |
|
Mesh Compatibility Functions
|
|
void | SetFromTri (const Mesh &from) |
Clears out all current information, and
copies in new faces and vertices from the from
argument. |
|
DllExport void | AddTri (const Mesh &from) |
Adds vertices and faces in "from" to current
MNMesh. |
|
DllExport void | OutToTri (Mesh &tmesh) |
Outputs current
MNMesh into the mesh given. |
|
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. |
|
DllExport void | FillInFaceEdges () |
Fills in the faces' edge arrays based on the
edge list. |
|
DllExport void | FillInVertEdgesFaces () |
Fills in the vertex edge and face lists
based on the edge list. |
|
DllExport bool | EliminateBadVerts (DWORD flag=0) |
A "bad" vertex in this context is one which
is shared between two distinct boundaries for this mesh. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
Bounding Box Methods
|
|
DllExport void | FaceBBox (int ff, Box3 &bbox) |
Finds the bounding box of all vertices and
hidden vertices used by face ff. |
|
DllExport void | BBox (Box3 &bbox, bool targonly=FALSE) |
Calculates the bounding box of the vertices
& hidden vertices of this mesh. |
|
DllExport Box3 | getBoundingBox (Matrix3 *tm=NULL, bool targonly=FALSE) |
Retrieves a bounding box for the
MNMesh. |
|
Targeting Methods
|
|
DllExport int | TargetVertsBySelection (int selLevel) |
Sets vertex MN_TARG flags based on the
existing MN_SEL flags. |
|
DllExport int | TargetEdgesBySelection (int selLevel) |
Sets edge MN_TARG flags based on the
existing MN_SEL flags. |
|
DllExport int | TargetFacesBySelection (int selLevel) |
Sets face MN_TARG flags based on the
existing MN_SEL flags. |
|
DllExport void | DetargetVertsBySharpness (float sharpval) |
Clears the MN_TARG flag on vertices
representing relatively flat areas, keeping the flag on vertices at
sharper corners. |
|
Face-Center methods
|
|
DllExport void | ComputeCenters (Point3 *ctr, bool targonly=FALSE) |
Finds the centers of all the faces, using
repeated calls to ComputeCenter. |
|
DllExport void | ComputeCenter (int ff, Point3 &ctr) |
Finds the center of face ff by finding the
average of all its vertices. |
|
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. |
|
DllExport void | ComputeSafeCenters (Point3 *ctr, bool targonly=FALSE, bool detarg=FALSE) |
Finds the "safe" centers of all the faces,
using repeated calls to ComputeSafeCenter. |
|
DllExport bool | ComputeSafeCenter (int ff, Point3 &ctr) |
Finds the "safe" center of face ff, if
possible. |
|
Triangulation-of-polygon Methods
|
|
DllExport void | RetriangulateFace (int ff) |
Throws out the current triangulation for
face ff and computes a new one. |
|
DllExport void | FindDiagonals (int ff, int *diag) |
Finds a diagonal of face ff that does not
include any hidden vertices. |
|
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. |
|
DllExport void | BestConvexDiagonals (int ff, int *diag=NULL) |
If the given face is convex, this will often
produce a better diagonals than RetriangulateFace would. |
|
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.
|
|
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. |
|
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. |
|
Normal methods
|
|
DllExport int | FindEdgeFromVertToVert (int vrt1, int vrt2) |
Some of these methods do not make use of
user-specified normals or smoothing groups. |
|
DllExport void | GetVertexSpace (int vrt, Matrix3 &tm) |
Chooses a suitable "local space", and sets
tm's rotation to match that space. |
|
DllExport Point3 | GetVertexNormal (int vrt) |
Returns the surface normal at the vertex
vrt. |
|
DllExport Point3 | GetEdgeNormal (int ed) |
Returns the surface normal at the edge ed.
|
|
DllExport Point3 | GetFaceNormal (int fc, bool nrmlz=FALSE) |
Returns the surface normal of face fc.
|
|
Point3 | GetEdgeNormal (int vrt1, int vrt2) |
This merely combines GetEdgeNormal (int ed)
with FindEdge (int vrt1, int vrt2). |
|
DllExport float | EdgeAngle (int ed) |
Computes the angle at the given edge.
|
|
DllExport void | FlipNormal (int faceIndex) |
Flips the normal of the specified face, as
well as the corresponding map faces in active maps. |
|
DllExport void | checkNormals (BOOL illum) |
This method can be used to build the normals
and allocate RVert space only if necessary. |
|
DllExport void | buildNormals () |
This method resolves the normals on the
RVertex array.
|
|
DllExport void | buildRenderNormals () |
This method is similar to buildNormals()
above, but ignores the material index (mtlIndex). |
|
DllExport bool | FlipElementNormals (DWORD flag=MN_SEL) |
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. |
|
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. |
|
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. |
|
DllExport MtlID | GetNewMtlID (bool targonly=FALSE) |
Produces the lowest material ID not used in
any faces in the
MNMesh. |
|
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.
|
|
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. |
|
DllExport void | PaintNewSmGroup (int ff, DWORD os, DWORD ns) |
Recursively replaces the old smoothing group
with the new smoothing group. |
|
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. |
|
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. |
|
Fence Methods
|
|
DllExport void | FenceMaterials () |
Thes methods make fences for the MNMesh::SabinDoo()
algorithm. |
|
DllExport void | FenceSmGroups () |
Sets the MN_EDGE_NOCROSS flag on all edges
that lie between faces with exclusive smoothing groups. |
|
DllExport void | FenceFaceSel () |
Sets the MN_EDGE_NOCROSS flag on all edges
that lie between selected & non-selected faces. |
|
DllExport void | FenceOneSidedEdges () |
Sets the MN_EDGE_NOCROSS flag on all edges
that are on the boundary. |
|
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. |
|
DllExport void | SetMapSeamFlags () |
Sets the MN_EDGE_MAP_SEAM on all edges that
are "seams" for any active map(s). |
|
DllExport void | SetMapSeamFlags (int mapChannel) |
Sets the MN_EDGE_MAP_SEAM on all edges that
are "seams" for the specified map(s). |
|
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. |
|
DllExport UVVert | FindFacePointMapValue (int ff, Point3 &pt, int mapChannel) |
This method is available in release 3.0 and
later only. |
|
Hole Fixing Functions
|
|
DllExport void | GetBorder (MNMeshBorder &brd, int selLevel=MNM_SL_OBJECT, DWORD targetFlag=MN_SEL) |
Finds border loops composed of all one-sided
edges. |
|
DllExport void | FillInBorders (MNMeshBorder *b=NULL) |
Fills in all the borders of a mesh. |
|
DllExport void | FindOpenRegions () |
Scans mesh to determine what parts of it are
open or closed. |
|
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. |
|
DllExport void | EliminateDoubledMappingVerts () |
Eliminates double mapped vertices in linear
time. |
|
Isolated Mapping Vertex Functions
|
|
Isolated mapping vertices are vertexes that aren't used by any mapping faces. |
|
DllExport void | EliminateIsoMapVerts () |
Deletes isolated mapping vertices. |
|
DllExport void | EliminateIsoMapVerts (int mapChannel) |
Deletes isolated mapping vertices on a
specific channel. |
|
Operators
|
|
DllExport MNMesh & | operator= (const MNMesh &from) |
Assignment operator. |
|
DllExport MNMesh & | operator+= (const MNMesh &from) |
Union operator. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
DllExport int | SplitEdge (int ff, int ed, 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.
|
|
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. |
|
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.
|
|
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.
|
|
DllExport bool | SplitFlaggedVertices (DWORD flag=MN_SEL) |
Splits the flagged vertices into a clone for
each face using the vertex. |
|
DllExport bool | SplitFlaggedEdges (DWORD flag=MN_SEL) |
"Splits" edges by breaking vertices on two
or more flagged edges into as many copies as needed. |
|
DllExport bool | SplitFacesUsingBothSidesOfEdge (DWORD edgeFlag=0x0) |
DllExport void | MultiDivideEdge (int edge, int segments) |
Splits an edge into multiple edges. |
|
DllExport void | MakeConvex () |
Calls MakeFaceConvex()
on all (non-dead) faces, producing a mesh with 100% convex faces.
|
|
DllExport void | MakeFaceConvex (int ff) |
Makes face ff convex, essentially by
chopping off corners. |
|
DllExport void | RestrictPolySize (int maxdeg) |
Subdivides polygons as needed so that no
polygon has degree larger than maxdeg. |
|
DllExport void | MakePlanar (float planarThresh) |
Makes all faces planar, within the angle
threshold given, by subdividing them as necessary. |
|
DllExport void | MakeFacePlanar (int ff, float planarThresh) |
Makes the specified face planar by
subdividing if necessary. |
|
Welding Functions
|
|
DllExport bool | WeldVerts (int a, int b) |
Welds vertices a and b, correcting the mesh
topology to match. |
|
DllExport bool | WeldEdge (int ee) |
Welds the endpoints of edge ee, correcting
the mesh topology to match. |
|
DllExport bool | WeldBorderVerts (int v1, int v2, Point3 *destination) |
Welds vertices v1 and v2 together. |
|
DllExport bool | WeldBorderEdges (int e1, int e2) |
Welds the specified border edges together.
|
|
DllExport bool | WeldBorderVerts (float thresh, DWORD flag=MN_SEL) |
Welds the specified border vertices
together. |
|
DllExport bool | WeldOpposingEdges (DWORD edgeFlag) |
Welds pairs of one-sided edges between the
same two vertices. |
|
Tessellation Methods
|
|
DllExport void | TessellateByEdges (float bulge, MeshOpProgress *mop=NULL) |
This is a tessellation routine similar to
AndersonDo().
|
|
DllExport bool | AndersonDo (float interp, int selLevel, MeshOpProgress *mop=NULL, DWORD subdivFlags=0) |
It breaks every MNFace into deg
new faces with four sides. |
|
DllExport void | TessellateByCenters (MeshOpProgress *mop=NULL) |
Note that this algorithm roughly triples the
size of the
MNMesh. |
|
DllExport void | SabinDoo (float interp, int selLevel, MeshOpProgress *mop=NULL, Tab< Point3 > *offsets=NULL) |
Note that this algorithm roughly triples the
size of the
MNMesh. |
|
DllExport void | SabinDooVert (int vid, float interp, int selLevel, Point3 *ctr, Tab< Point3 > *offsets=NULL) |
This applies the Sabin-Doo tessellation
technique to a single vertex. |
|
DllExport void | CubicNURMS (MeshOpProgress *mop=NULL, Tab< Point3 > *offsets=NULL, DWORD subdivFlags=0) |
Non-uniform rational mesh smooth. |
|
Boolean Methods
|
|
DllExport void | PrepForBoolean () |
Prepares a
MNMesh for a Boolean operation. |
|
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. |
|
DllExport bool | MakeBoolean (MNMesh &m1, MNMesh &m2, int type, MeshOpProgress *mop=NULL) |
Makes this
MNMesh into a Boolean result of the given MNMeshes.
|
|
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. |
|
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.
|
|
DllExport bool | ConnectEdges (DWORD edgeFlag, int segments=2) |
Connect the marked edges of a polygon if
they are opposing. |
|
DllExport bool | ConnectVertices (DWORD vertexFlag) |
Connects tagged vertices across a polygon.
|
|
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. |
|
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. |
|
DllExport void | CopyBasics (const MNMesh &from, bool copyEdges=false) |
Copies bare geometry only - no per-vertex
data, maps, or normals. |
|
Plane Methods
|
|
DllExport bool | MakeFlaggedPlanar (int selLev, DWORD flag=MN_SEL, Point3 *delta=NULL) |
Moves the flagged components into their
"average plane". |
|
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.
|
|
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. |
|
DllExport bool | DetachElementToObject (MNMesh &nmesh, DWORD fflags=MN_SEL, bool delDetached=true) |
Detaches specified faces (and related
vertices and edges) to a new
MNMesh. |
|
Extrusion Methods
|
|
DllExport bool | ExtrudeFaceClusters (MNFaceClusters &fclust) |
Performs the topological component of an
extrusion on all face clusters. |
|
DllExport bool | ExtrudeFaceCluster (MNFaceClusters &fclust, int cl) |
Performs the topological component of an
extrusion on the specified face cluster. |
|
DllExport bool | ExtrudeFaces (DWORD flag=MN_SEL) |
Performs the topological component of an
extrusion on each flagged face individually. |
|
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. |
|
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.
|
|
DllExport bool | ExtrudeEdges (DWORD edgeFlag, MNChamferData *pMCD, Tab< Point3 > &tUpDir) |
Same as
ExtrudeVertices() but is applied to the edges. |
|
DllExport bool | ExtrudeFaceClusterAlongPath (Tab< Matrix3 > tFrenets, MNFaceClusters &fclust, int clusterID, bool align) |
Extrudes a group of faces along a path
defined by tFrenets. |
|
Coloring Methods
|
|
DllExport bool | SetVertColor (UVVert clr, int mapChannel, DWORD flag=MN_SEL) |
Sets vertex colors for the specified
vertices. |
|
DllExport bool | SetFaceColor (UVVert clr, int mapChannel, DWORD flag=MN_SEL) |
Sets vertex colors for the specified faces.
|
|
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. |
|
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. |
|
Cutting Methods
|
|
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. |
|
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. |
|
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. |
|
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. |
|
DllExport void | InvalidateGeomCache () |
Invalidates information, like bounding box
and face normals, that's dependent on Geometry. |
|
DllExport void | InvalidateTopoCache (bool in_clearCacheFlags=true) |
Clears out topology-dependent cache
information. |
|
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). |
|
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). |
|
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.
|
|
DllExport void | PrepForPipeline () |
This method reconciles flags with arrays,
checks and modifies data, ensures that the caches are consistent,
and prepares the
MNMesh pipeline. |
|
DllExport void | allocRVerts () |
Allocates the "render vertices" used to
optimize display routines. |
|
DllExport void | updateRVerts (GraphicsWindow *gw) |
Fills in the render vertices with display
coordinates based on the specified view. |
|
DllExport void | freeRVerts () |
Frees the "render vertices" used to optimize
display routines. |
|
Display Flag Methods
|
|
See MNMesh Display Flags for a list of supported display flags. |
|
void | SetDispFlag (DWORD f) |
This method allows you to set the display
flags. |
|
DWORD | GetDispFlag (DWORD f) |
This method returns the displFlags & f.
|
|
void | ClearDispFlag (DWORD f) |
This method allows you to clear the
specified display flags. |
|
Render Methods
|
|
DllExport void | render (GraphicsWindow *gw, Material *ma, RECT *rp, int compFlags, int numMat=1, InterfaceServer *pi=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. |
|
DllExport void | render3DFace (GraphicsWindow *gw, int ff) |
Displays the indicated face in the GraphicsWindow using
hardware acceleration for texture and lighting if available.
|
|
DllExport void | render3DDiagonals (GraphicsWindow *gw, DWORD compFlags) |
Displays all face diagonals in the GraphicsWindow using
hardware acceleration for texture and lighting if available.
|
|
DllExport void | renderDiagonals (GraphicsWindow *gw, DWORD compFlags) |
Displays all face diagonals in the GraphicsWindow. |
|
DllExport void | renderDiagonal (GraphicsWindow *gw, int ff, bool useSegments=false, bool *lastColorSubSel=NULL) |
Displays diagonals for the specified face in
the GraphicsWindow. |
|
DllExport void | render3DEdges (GraphicsWindow *gw, DWORD compFlags) |
Displays all edges in the GraphicsWindow using hardware
acceleration for texture and lighting if available. |
|
DllExport void | renderEdges (GraphicsWindow *gw, DWORD compFlags) |
Displays all edges in the GraphicsWindow. |
|
DllExport void | renderEdge (GraphicsWindow *gw, int ee, bool useSegments=false, bool *lastColorSubSel=NULL) |
Displays an edge in a GraphicsWindow. |
|
Intersection and Hit Testing
Functions
|
|
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. |
|
DllExport int | IntersectRay (Ray &ray, float &at, Point3 &norm) |
Provides the intersection point and normal
for the ray with this mesh. |
|
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. |
|
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. |
|
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.
|
|
DllExport void | InvalidateHardwareMesh (DWORD keepFlags=0) |
This method can be used to invalidate any
display-technology-specific caches of the
MNMesh. |
|
DllExport void | SetStaticMesh (bool staticMesh) |
Set the mesh or as static or not. |
|
Specified Normal Methods
|
|
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. |
|
DllExport void | ClearSpecifiedNormals () |
Clears out the specified normal interface,
if present. |
|
DllExport void | SpecifyNormals () |
Creates the user-specified normal interface
in this mesh. |
|
Miscellaneous Methods
|
|
DllExport void | Transform (Matrix3 &xfm) |
Transforms all vertices & hidden
vertices by the Matrix xfm. |
|
bool | IsClosed () |
Figures out if this mesh is completely
closed. |
|
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). |
|
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. |
|
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. |
|
Public Attributes |
|
MNVert * | v |
The array of vertices. |
|
MNEdge * | e |
The array of edges. |
|
MNFace * | f |
The array of faces;. |
|
int | numv |
Number of MNVert elements
in v. |
|
int | nume |
Number of MNEdge elements in e.
|
|
int | numf |
Number of MNFace elements
in f. |
|
int | numm |
PerData * | vd |
The array of
PerData objects which maintain and provide access to the
floating point vertex data. |
|
BitArray | vdSupport |
This bit array indicates if a particular
vertex data channel is supported in this
MNMesh. |
|
PerData * | ed |
The array of
PerData objects which maintain and provide access to the
floating point edge data. |
|
BitArray | edSupport |
This bit array indicates if a particular
edge data channel is supported in this
MNMesh. |
|
int | selLevel |
The current
MNMesh selection level. |
|
DWORD | dispFlags |
Display flags. |
|
Tab< int > * | vedg |
This is an array of int Tabs that records
which edges use each vertex. |
|
Tab< int > * | vfac |
This is an array of int Tabs that records
which faces touch each vertex. |
|
Friends |
|
class | HardwareMNMesh |
class | MNNormalSpec |
class | MNMeshUtilites8Impl |
class | MNMeshUtilities10Impl |
class | MNMeshFGBGObject |
class | MaxGraphics::IMNMeshInternal |
void | gfxCleanup (void *data) |
MNMesh | ( | ) | [inline] |
Initializes the MNMesh with no components and the default flags.
{ Init(); DefaultFlags (); }
Constructor.
Initializes the MNMesh with the mesh "from", and fills in the topology completely (using FillInMesh).
{ Init(); SetFromTri (from); FillInMesh (); }
Copy constructor.
{ Init(); DefaultFlags(); *this = from; }
DllExport ~MNMesh | ( | ) |
Destructor.
Frees all allocated memory (using Clear).
void DefaultFlags | ( | ) | [inline] |
DllExport void Init | ( | ) |
The data members are initialized as follows:
nv_alloc = ne_alloc = nf_alloc = nm_alloc = 0; numv = nume = numf = numm = 0; v = NULL; e = NULL; f = NULL; m = NULL; vd = NULL; ed = NULL; vedg = NULL; vfac = NULL; bdgBox.Init(); fnorm = NULL; dispFlags = 0; rVerts = NULL; cacheGW = NULL; normalsBuilt = 0; norScale = 0.0f; selLevel = MNM_SL_OBJECT;
DllExport void VAlloc | ( | int | num, |
bool | keep = TRUE |
||
) |
Allocates and inits the specified number of MNVerts.
DllExport void VShrink | ( | int | num = -1 |
) |
Shrinks the nv_alloc size of the MNVert array to the specified size.
DllExport void freeVEdge | ( | ) |
Deallocates any MNEdges in the vedg table and sets the vedg pointer to NULL.
DllExport void VEdgeAlloc | ( | ) |
Allocates the vedg array.
DllExport void freeVFace | ( | ) |
Deallocates the vfac array.
DllExport void VFaceAlloc | ( | ) |
Allocates the vfac array.
DllExport void EAlloc | ( | int | num, |
bool | keep = TRUE |
||
) |
Allocates the MNEdge data array e with the specified size.
DllExport void EShrink | ( | int | num = -1 |
) |
Reduces the ne_alloc size of the MNEdge data array e to the specified number of elements.
DllExport void FAlloc | ( | int | num, |
bool | keep = TRUE |
||
) |
Allocates the MNFace array f with the specified size.
DllExport void FShrink | ( | int | num = -1 |
) |
Reduces the nf_alloc size of the MNFace data array f to the specified number of elements.
DllExport void MAlloc | ( | int | num, |
bool | keep = TRUE |
||
) |
DllExport void MShrink | ( | int | num = -1 |
) |
Reduces the nm_alloc size of the MNMap data array m to the specified number of elements.
int VNum | ( | ) | const [inline] |
MNVert* V | ( | int | i | ) | const [inline] |
Point3& P | ( | int | i | ) | const [inline] |
Returns the point in the i'th MNVert.
P(i) is the same as V(i)->p.
int ENum | ( | ) | const [inline] |
MNEdge* E | ( | int | i | ) | const [inline] |
int FNum | ( | ) | const [inline] |
MNFace* F | ( | int | i | ) | const [inline] |
int MNum | ( | ) | const [inline] |
DllExport int TriNum | ( | ) | const |
Number of triangles.
DllExport MNMap* M | ( | int | mapChannel | ) | const |
This accessor accepts a value in the range -NUM_HIDDENMAPS to MNum().
DllExport void SetMapNum | ( | int | mpnum | ) |
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.
DllExport void InitMap | ( | int | mapChannel | ) |
Allocates and initializes basic planar map, or a white map for the vertex color channel.
DllExport void ClearMap | ( | int | mapChannel | ) |
Clears and frees the specified map channel, setting the MN_DEAD flag.
DllExport UVVert MV | ( | int | mapChannel, |
int | i | ||
) | const |
Returns the specified UVVert from the specified mapping channel.
DllExport MNMapFace* MF | ( | int | mapChannel, |
int | i | ||
) | const |
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. |
DllExport bool IsEdgeMapSeam | ( | int | mapChannel, |
int | edge | ||
) |
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.
DllExport void setNumVData | ( | int | ct, |
BOOL | keep = FALSE |
||
) |
Sets the specified number of vertex data elements.
int VDNum | ( | ) | const [inline] |
Returns the number of vertex data channels maintained by this MNMesh.
DllExport BOOL vDataSupport | ( | int | vdChannel | ) | const |
Returns TRUE if the specified channel of vertex data is available for this MNMesh; otherwise FALSE.
DllExport void setVDataSupport | ( | int | vdChannel, |
BOOL | support =
TRUE |
||
) |
Sets if the specified channel of vertex data is supported by this MNMesh.
void* vertexData | ( | int | vdChannel | ) | const [inline] |
Returns a pointer to the vertex data for the specified channel or NULL if the channel is not supported.
{ return vDataSupport(vdChannel) ? vd[vdChannel].data : NULL; }
float* vertexFloat | ( | int | vdChannel | ) | const [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.
{ return (float *) vertexData (vdChannel); }
DllExport void freeVData | ( | int | vdChannel | ) |
Deletes (deallocates) the vertex data for the specified channel.
DllExport void freeAllVData | ( | ) |
Deallocates the vertex data from all channels and sets the number of supported channels to 0.
float* getVertexWeights | ( | ) | [inline] |
Returns a pointer to the floating point vertex weight data.
{ return vertexFloat(VDATA_WEIGHT); }
void SupportVertexWeights | ( | ) | [inline] |
Sets the channel support for the vertex weights channel (VDATA_WEIGHT).
{ setVDataSupport (VDATA_WEIGHT); }
void freeVertexWeights | ( | ) | [inline] |
Frees (deallocates) the vertex weight channel data.
{ freeVData (VDATA_WEIGHT); }
float* getVSelectionWeights | ( | ) | [inline] |
Returns a pointer to the floating point vertex selection weight data.
{ return vertexFloat(VDATA_SELECT); }
void SupportVSelectionWeights | ( | ) | [inline] |
Sets the channel support for the vertex weights channel (VDATA_SELECT).
{ setVDataSupport (VDATA_SELECT); }
void freeVSelectionWeights | ( | ) | [inline] |
Frees (deallocates) the vertex selection weight channel data.
{ freeVData (VDATA_SELECT); }
DllExport void setNumEData | ( | int | ct, |
BOOL | keep = FALSE |
||
) |
Sets the specified number of edge data elements.
int EDNum | ( | ) | const [inline] |
Returns the number of edge data channels maintained by this MNMesh.
DllExport BOOL eDataSupport | ( | int | edChannel | ) | const |
Returns TRUE if the specified channel of edge data is available for this MNMesh; otherwise FALSE.
DllExport void setEDataSupport | ( | int | edChannel, |
BOOL | support =
TRUE |
||
) |
Sets if the specified channel of edge data is supported by this MNMesh.
void* edgeData | ( | int | edChannel | ) | const [inline] |
Returns a pointer to the edge data for the specified channel or NULL if the channel is not supported.
{ return eDataSupport(edChannel) ? ed[edChannel].data : NULL; }
float* edgeFloat | ( | int | edChannel | ) | const [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.
{ return (float *) edgeData (edChannel); }
DllExport void freeEData | ( | int | edChannel | ) |
Deletes (deallocates) the edge data for the specified channel.
DllExport void freeAllEData | ( | ) |
Deallocates the edge data from all channels and sets the number of supported channels to 0.
float* getEdgeKnots | ( | ) | [inline] |
Returns a pointer to the floating point edge knot data.
{ return edgeFloat(EDATA_KNOT); }
void SupportEdgeKnots | ( | ) | [inline] |
Sets the channel support for the edge knot channel (EDATA_KNOT).
{ setEDataSupport (EDATA_KNOT); }
void freeEdgeKnots | ( | ) | [inline] |
Frees (deallocates) the edge knot channel data.
{ freeEData (EDATA_KNOT); }
DllExport void VClear | ( | int | vv | ) |
Clears and frees the flags and face/edge lists for the specified vertex.
vv | The vertex to clear. |
DllExport void VInit | ( | int | vv | ) |
Initializes the specified MNVert, clearing its flags and emptying its face & edge lists (if vfac & edg are allocated).
DllExport int VFaceIndex | ( | int | vv, |
int | ff, | ||
int | ee = -1 |
||
) |
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.
DllExport int VEdgeIndex | ( | int | vv, |
int | ee | ||
) |
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.)
void VDeleteEdge | ( | int | vv, |
int | ee | ||
) | [inline] |
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.
{ if (vedg) vedg[vv].Delete (VEdgeIndex(vv, ee), 1); }
DllExport void VDeleteFace | ( | int | vv, |
int | ff | ||
) |
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.
DllExport void VReplaceEdge | ( | int | vv, |
int | oe, | ||
int | ne | ||
) |
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.
DllExport void VReplaceFace | ( | int | vv, |
int | of, | ||
int | nf | ||
) |
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.
DllExport void CopyVert | ( | int | nv, |
int | ov | ||
) |
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).
DllExport void MNVDebugPrint | ( | int | vv | ) |
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);
DllExport int NewTri | ( | int | a, |
int | b, | ||
int | c, | ||
DWORD | smG = 0 , |
||
MtlID | mt = 0 |
||
) |
Creates a new tri-face.
Note that no mapping coords or vertex colors can be specified.
DllExport int NewTri | ( | int * | vv, |
DWORD | smG = 0 , |
||
MtlID | mt = 0 |
||
) |
Creates a new face of degree 3.
Edge selection and visibility flags are set to the default: all visible and not selected.
DllExport int NewQuad | ( | int | a, |
int | b, | ||
int | c, | ||
int | d, | ||
DWORD | smG = 0 , |
||
MtlID | mt = 0 |
||
) |
This method will create a new quad.
Previous to 4.0 this method used two tri-faces that shared and
invisible edge.
DllExport int NewQuad | ( | int * | vv, |
DWORD | smG = 0 , |
||
MtlID | mt = 0 |
||
) |
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.
DllExport int CreateFace | ( | int | degg, |
int * | vv | ||
) |
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).
DllExport int AppendNewFaces | ( | int | nfnum | ) |
Appends the specified number of MNFaces to f.
DllExport void setNumFaces | ( | int | nfnum | ) |
Sets the specified number of MNFaces allocated in f.
DllExport int RegisterEdge | ( | int | v1, |
int | v2, | ||
int | f, | ||
int | fpos | ||
) |
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.
DllExport int SimpleNewEdge | ( | int | v1, |
int | v2 | ||
) |
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.
DllExport int NewEdge | ( | int | v1, |
int | v2, | ||
int | f, | ||
int | fpos | ||
) |
Edge creation tool.
Requires the developer to previously ascertain that there is no edge from v1 to v2 or from v2 to v1.
DllExport int AppendNewEdges | ( | int | nenum | ) |
Appends the specified number of edges.
DllExport void setNumEdges | ( | int | nenum | ) |
Sets the number of MNEdges allocated in e.
DllExport int NewVert | ( | Point3 & | p | ) |
Creates a new vertex (increasing numv) and sets it to the specified point.
DllExport int NewVert | ( | Point3 & | p, |
int | vid | ||
) |
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.
DllExport int NewVert | ( | int | vid | ) |
Creates a new vertex and initializes it to location, flags and other characteristics of vertex vid.
DllExport int NewVert | ( | int | v1, |
int | v2, | ||
float | prop | ||
) |
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.
DllExport int AppendNewVerts | ( | int | nvnum | ) |
Appends the specified number of MNVerts.
DllExport void setNumVerts | ( | int | nvnum | ) |
Sets the number of verts, allocating if needed.
DllExport int InsertSpur | ( | int | face, |
int | vertIndex, | ||
Tab< int > * | ptMapVertArray =
NULL |
||
) |
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.
DllExport void CollapseDeadVerts | ( | ) |
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.
DllExport void CollapseDeadEdges | ( | ) |
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.
DllExport void CollapseDeadFaces | ( | ) |
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.
DllExport void CollapseDeadStructs | ( | ) |
Performs all 5 of the above collapse functions, safely removing all unused components from this mesh.
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.
This option is suitable if you need to clear a MNMesh you will be reusing. numv, etc, are set to 0.
DllExport void ClearAndFree | ( | ) |
Deletes everything and frees all relevant memory.
Leaves you with an empty MNMesh with the default flags.
DllExport void freeVerts | ( | ) |
Deletes the MNVert array and frees any corresponding vertex data.
DllExport void freeEdges | ( | ) |
Deletes the MNEdge array and frees and corresponding edge data.
DllExport void freeFaces | ( | ) |
Deletes the MNFace array.
DllExport void freeMap | ( | int | mapChannel | ) |
DllExport void freeMaps | ( | ) |
Deletes and frees all the MNMaps.
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.
DllExport void RemoveEdge | ( | int | edge | ) |
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.
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.
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.
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.
Another way of looking at it is that it uses weld to remove extremely small edges.
void ClearVFlags | ( | DWORD | fl | ) | [inline] |
Clears all specified flag bits in all MNVerts.
void ClearEFlags | ( | DWORD | fl | ) | [inline] |
Clears all specified flag bits in all MNEdges.
void ClearFFlags | ( | DWORD | fl | ) | [inline] |
Clears all specified flag bits in all MNFaces.
DllExport void PaintFaceFlag | ( | int | ff, |
DWORD | fl, | ||
DWORD | fenceflags =
0x0 |
||
) |
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.
DllExport void VertexSelect | ( | const BitArray & | vsel | ) |
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.
DllExport void EdgeSelect | ( | const BitArray & | esel | ) |
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.
DllExport void FaceSelect | ( | const BitArray & | fsel | ) |
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.
bool getVertexSel | ( | BitArray & | vsel | ) | [inline] |
Fills the given bit array with the current vertex selection state.
{ return getVerticesByFlag (vsel, MN_SEL); }
bool getEdgeSel | ( | BitArray & | esel | ) | [inline] |
Fills the given bit array with the current edge selection state.
{ return getEdgesByFlag (esel, MN_SEL); }
bool getFaceSel | ( | BitArray & | fsel | ) | [inline] |
Fills the given bit array with the current face selection state.
{ return getFacesByFlag (fsel, MN_SEL); }
DllExport void SelectEdgeLoop | ( | BitArray & | edgeSel | ) |
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 &. |
DllExport void SelectEdgeRing | ( | BitArray & | edgeSel | ) |
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 &. |
DllExport BitArray VertexTempSel | ( | DWORD | fmask =
MN_DEAD|MN_SEL , |
DWORD | fset =
MN_SEL |
||
) |
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.
DllExport bool getVerticesByFlag | ( | BitArray & | vset, |
DWORD | flags, | ||
DWORD | fmask = 0x0 |
||
) |
Creates a BitArray of all vertices using the specified flags.
DllExport bool getEdgesByFlag | ( | BitArray & | eset, |
DWORD | flags, | ||
DWORD | fmask = 0x0 |
||
) |
Creates a BitArray of all edges using the specified flags.
DllExport bool getFacesByFlag | ( | BitArray & | fset, |
DWORD | flags, | ||
DWORD | fmask = 0x0 |
||
) |
Creates a BitArray of all faces using the specified flags.
DllExport void ElementFromFace | ( | int | ff, |
BitArray & | fset | ||
) |
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.
DllExport void BorderFromEdge | ( | int | ee, |
BitArray & | eset | ||
) |
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.
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.
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.
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.
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.
void SetFromTri | ( | const Mesh & | from | ) | [inline] |
Clears out all current information, and copies in new faces and
vertices from the from
argument.
DllExport void AddTri | ( | const Mesh & | from | ) |
Adds vertices and faces in "from" to current MNMesh.
This algorithm has O(N) complexity.
DllExport void OutToTri | ( | Mesh & | tmesh | ) |
DllExport void FillInMesh | ( | ) |
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).
DllExport void FillInFaceEdges | ( | ) |
Fills in the faces' edge arrays based on the edge list.
Complexity of O(N).
DllExport void FillInVertEdgesFaces | ( | ) |
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.
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.
(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.
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.
(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.)
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.
This routine is called from OutToTri if the MN_MESH_NONTRI flag is set. Has complexity O(N)
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.
Has complexity of O(N) where N is the number of triangles.
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.
An n-gon becomes n triangles by this method.
DllExport void FaceBBox | ( | int | ff, |
Box3 & | bbox | ||
) |
Finds the bounding box of all vertices and hidden vertices used by face ff.
DllExport void BBox | ( | Box3 & | bbox, |
bool | targonly =
FALSE |
||
) |
Calculates the bounding box of the vertices & hidden vertices of this mesh.
Retrieves a bounding box for the MNMesh.
DllExport int TargetVertsBySelection | ( | int | selLevel | ) |
Sets vertex MN_TARG flags based on the existing MN_SEL flags.
DllExport int TargetEdgesBySelection | ( | int | selLevel | ) |
Sets edge MN_TARG flags based on the existing MN_SEL flags.
DllExport int TargetFacesBySelection | ( | int | selLevel | ) |
Sets face MN_TARG flags based on the existing MN_SEL flags.
DllExport void DetargetVertsBySharpness | ( | float | sharpval | ) |
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).
DllExport void ComputeCenters | ( | Point3 * | ctr, |
bool | targonly =
FALSE |
||
) |
Finds the centers of all the faces, using repeated calls to ComputeCenter.
DllExport void ComputeCenter | ( | int | ff, |
Point3 & | ctr | ||
) |
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.)
DllExport void ComputeSafeCenters | ( | Point3 * | ctr, |
bool | targonly = FALSE , |
||
bool | detarg =
FALSE |
||
) |
Finds the "safe" centers of all the faces, using repeated calls to ComputeSafeCenter.
DllExport bool ComputeSafeCenter | ( | int | ff, |
Point3 & | ctr | ||
) |
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).
DllExport void RetriangulateFace | ( | int | ff | ) |
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.
DllExport void FindDiagonals | ( | int | ff, |
int * | diag | ||
) |
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.
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.
DllExport void BestConvexDiagonals | ( | int | ff, |
int * | diag = NULL |
||
) |
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.
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.
DllExport bool SetDiagonal | ( | int | ff, |
int | d1, | ||
int | d2 | ||
) |
DllExport void MakePolyMesh | ( | int | maxdeg = 0 , |
BOOL | elimCollin =
TRUE |
||
) |
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().
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.
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.
DllExport int FindEdgeFromVertToVert | ( | int | vrt1, |
int | vrt2 | ||
) |
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.
DllExport void GetVertexSpace | ( | int | vrt, |
Matrix3 & | tm | ||
) |
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.)
DllExport Point3 GetVertexNormal | ( | int | vrt | ) |
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.
DllExport Point3 GetEdgeNormal | ( | int | ed | ) |
Returns the surface normal at the edge ed.
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.
DllExport Point3 GetFaceNormal | ( | int | fc, |
bool | nrmlz =
FALSE |
||
) |
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.
Point3 GetEdgeNormal | ( | int | vrt1, |
int | vrt2 | ||
) | [inline] |
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).)
{ return GetEdgeNormal (FindEdgeFromVertToVert(vrt1, vrt2)); }
DllExport float EdgeAngle | ( | int | ed | ) |
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.
DllExport void FlipNormal | ( | int | faceIndex | ) |
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.
DllExport void checkNormals | ( | BOOL | illum | ) |
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.
DllExport void buildNormals | ( | ) |
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.
DllExport void buildRenderNormals | ( | ) |
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.
DllExport bool FlipElementNormals | ( | DWORD | flag = MN_SEL |
) |
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.
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.
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 MtlID GetNewMtlID | ( | bool | targonly = FALSE |
) |
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.
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.
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.
DllExport void PaintNewSmGroup | ( | int | ff, |
DWORD | os, | ||
DWORD | ns | ||
) |
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.
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.
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.
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.
DllExport void FenceMaterials | ( | ) |
Thes 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.
DllExport void FenceSmGroups | ( | ) |
Sets the MN_EDGE_NOCROSS flag on all edges that lie between faces with exclusive smoothing groups.
DllExport void FenceFaceSel | ( | ) |
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.)
DllExport void FenceOneSidedEdges | ( | ) |
Sets the MN_EDGE_NOCROSS flag on all edges that are on the boundary.
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.
DllExport void SetMapSeamFlags | ( | ) |
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.
DllExport void SetMapSeamFlags | ( | int | mapChannel | ) |
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.
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.
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 | selLevel =
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.
DllExport void FindOpenRegions | ( | ) |
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
DllExport void EliminateDoubledMappingVerts | ( | ) |
Eliminates double mapped vertices in linear time.
DllExport void EliminateIsoMapVerts | ( | ) |
Deletes isolated mapping vertices.
DllExport void EliminateIsoMapVerts | ( | int | mapChannel | ) |
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.)
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.
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.
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.
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.
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.
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.
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.
Everything else is the same as the existing SplitEdge (int ee, float prop=.5f) method.
DllExport int SplitEdge | ( | int | ff, |
int | ed, | ||
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.
DllExport bool SplitFlaggedVertices | ( | DWORD | flag = MN_SEL |
) |
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.
DllExport bool SplitFlaggedEdges | ( | DWORD | flag = MN_SEL |
) |
"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 |
) |
DllExport void MultiDivideEdge | ( | int | edge, |
int | segments | ||
) |
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. |
DllExport void MakeConvex | ( | ) |
Calls MakeFaceConvex() on all (non-dead) faces, producing a mesh with 100% convex faces.
DllExport void MakeFaceConvex | ( | int | ff | ) |
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.
DllExport void RestrictPolySize | ( | int | maxdeg | ) |
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.)
DllExport void MakePlanar | ( | float | planarThresh | ) |
Makes all faces planar, within the angle threshold given, by subdividing them as necessary.
(See MakeFacePlanar.)
DllExport void MakeFacePlanar | ( | int | ff, |
float | planarThresh | ||
) |
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.
DllExport bool WeldVerts | ( | int | a, |
int | b | ||
) |
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.
DllExport bool WeldEdge | ( | int | ee | ) |
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.
DllExport bool WeldBorderVerts | ( | int | v1, |
int | v2, | ||
Point3 * | destination | ||
) |
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.)
DllExport bool WeldBorderEdges | ( | int | e1, |
int | e2 | ||
) |
Welds the specified border edges together.
DllExport bool WeldBorderVerts | ( | float | thresh, |
DWORD | flag =
MN_SEL |
||
) |
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 | selLevel, | ||
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 | selLevel, | ||
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 | selLevel, | ||
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.
DllExport void PrepForBoolean | ( | ) |
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.
As with Boolean, both this and m2 should be prepared with the PrepForBoolean method.
DllExport bool MakeBoolean | ( | MNMesh & | m1, |
MNMesh & | m2, | ||
int | type, | ||
MeshOpProgress * | mop = NULL |
||
) |
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.
BOOL CalcNewBooleanOp(Mesh & mesh, Mesh & mesh1, Mesh & mesh2, int op, MeshOpProgress *prog=NULL, Matrix3 *tm1=NULL, Matrix3 *tm2=NULL, int whichinv=0) { MNMesh m1(mesh1); MNMesh m2(mesh2); if(tm1) m1.Transform(*tm1); if(tm2) m2.Transform(*tm2); m1.PrepForBoolean(); m2.PrepForBoolean(); MNMesh mOut; mOut.MakeBoolean(m1, m2, op, prog); if(whichinv==0) mOut.Transform(Inverse(*tm1)); if(whichinv==1) mOut.Transform(Inverse(*tm2)); mOut.OutToTri(mesh); return TRUE; }
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.
DllExport bool ConnectEdges | ( | DWORD | edgeFlag, |
int | segments = 2 |
||
) |
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 CloneVerts | ( | DWORD | cloneFlag =
MN_SEL , |
bool | clear_orig =
TRUE |
||
) |
Clones flagged vertices, creating new vertices that aren't used by any faces.
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.
DllExport void CopyBasics | ( | const MNMesh & | from, |
bool | copyEdges =
false |
||
) |
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.
DllExport bool MakeFlaggedPlanar | ( | int | selLev, |
DWORD | flag = MN_SEL , |
||
Point3 * | delta = NULL |
||
) |
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.
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.
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.)
DllExport bool ExtrudeFaces | ( | DWORD | flag = MN_SEL |
) |
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.
MNChamferData *pChamData = NULL; pChamData = MNTempData (&mnMesh); float height, width; Tab<Point3> tUpDir, tDelta; if (!mnMesh.ExtrudeEdges (flag, pChamData, tUpDir)) return false; // Apply map changes based on base width: for (mapChannel=-NUM_HIDDENMAPS; mapChannel<mesh.numm; mapChannel++) { if (mesh.M(mapChannel)->GetFlag (MN_DEAD)) continue; pChamData->GetMapDelta (mesh, mapChannel, width, tMapDelta); UVVert *pMapVerts = mesh.M(mapChannel)->v; if (!pMapVerts) continue; for (i=0; i<mesh.M(mapChannel)->numv; i++) pMapVerts[i] += tMapDelta[i]; } // Apply geom changes based on base width: pChamData->GetDelta (width, tDelta); for (i=0; i<mesh.numv; i++) mesh.v[i].p += tDelta[i]; // Move the points up: for (i=0; i<tUpDir.Count(); i++) mesh.v[i].p += tUpDir[i]*height;
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.
MNChamferData *pChamData = NULL; pChamData = MNTempData (&mnMesh); float height, width; Tab<Point3> tUpDir, tDelta; if (!mnMesh.ExtrudeEdges (flag, pChamData, tUpDir)) return false; // Apply map changes based on base width: for (mapChannel=-NUM_HIDDENMAPS; mapChannel<mesh.numm; mapChannel++) { if (mesh.M(mapChannel)->GetFlag (MN_DEAD)) continue; pChamData->GetMapDelta (mesh, mapChannel, width, tMapDelta); UVVert *pMapVerts = mesh.M(mapChannel)->v; if (!pMapVerts) continue; for (i=0; i<mesh.M(mapChannel)->numv; i++) pMapVerts[i] += tMapDelta[i]; } // Apply geom changes based on base width: pChamData->GetDelta (width, tDelta); for (i=0; i<mesh.numv; i++) mesh.v[i].p += tDelta[i]; // Move the points up: for (i=0; i<tUpDir.Count(); i++) mesh.v[i].p += tUpDir[i]*height;
edgeFlag | Determines what edges 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 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. |
DllExport bool SetVertColor | ( | UVVert | clr, |
int | mapChannel, | ||
DWORD | flag =
MN_SEL |
||
) |
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.
DllExport bool SetFaceColor | ( | UVVert | clr, |
int | mapChannel, | ||
DWORD | flag =
MN_SEL |
||
) |
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.
Implements the Editable Poly Cut algorithm from the face level - cuts from a point on one face to a point on another face.
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.
Implements the Editable Poly Cut algorithm from the vertex level - cuts from one vertex to another.
DllExport void ApplyMapper | ( | UVWMapper & | mapChannel, |
int | channel = 0 , |
||
BOOL | useSel =
FALSE |
||
) |
Applies UVW Mapper to create the desired mapping in the specified channel.
DllExport void InvalidateGeomCache | ( | ) |
Invalidates information, like bounding box and face normals, that's dependent on Geometry.
Call after changing the geometry.
DllExport void InvalidateTopoCache | ( | bool | in_clearCacheFlags =
true |
) |
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().
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).
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.
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).
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.
DllExport void PrepForPipeline | ( | ) |
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.
DllExport void allocRVerts | ( | ) |
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.
DllExport void freeRVerts | ( | ) |
Frees the "render vertices" used to optimize display routines.
void SetDispFlag | ( | DWORD | f | ) | [inline] |
This method allows you to set the display flags.
See MNMesh Display Flags.
DWORD GetDispFlag | ( | DWORD | f | ) | [inline] |
This method returns the displFlags & f.
See MNMesh Display Flags.
void ClearDispFlag | ( | DWORD | f | ) | [inline] |
This method allows you to clear the specified display flags.
See MNMesh Display Flags.
DllExport void render | ( | GraphicsWindow * | gw, |
Material * | ma, | ||
RECT * | rp, | ||
int | compFlags, | ||
int | numMat = 1 , |
||
InterfaceServer * | pi = 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 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.
DllExport void NewAndCopyChannels | ( | ChannelMask | channels | ) |
DllExport void FreeChannels | ( | ChannelMask | channels, |
BOOL | zeroOthers =
1 |
||
) |
DllExport void ClearFlag | ( | DWORD | fl | ) |
DllExport BaseInterface* GetInterface | ( | Interface_ID | id | ) | [virtual] |
DllExport void ReduceDisplayCaches | ( | ) |
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.
DllExport void InvalidateHardwareMesh | ( | DWORD | keepFlags = 0 |
) |
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.)
DllExport void SetStaticMesh | ( | bool | staticMesh | ) |
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.)
DllExport void ClearSpecifiedNormals | ( | ) |
Clears out the specified normal interface, if present.
Removes it
completely, so it won't flow up the stack, etc.
DllExport void SpecifyNormals | ( | ) |
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 PART_GEOM and PART_TOPO channels.
DllExport void Transform | ( | Matrix3 & | xfm | ) |
Transforms all vertices & hidden vertices by the Matrix xfm.
bool IsClosed | ( | ) | [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.
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).
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. |
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.
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.
friend class HardwareMNMesh
[friend] |
friend class MNNormalSpec
[friend] |
friend class MNMeshUtilites8Impl
[friend] |
friend class MNMeshUtilities10Impl
[friend] |
friend class MNMeshFGBGObject
[friend] |
friend class MaxGraphics::IMNMeshInternal
[friend] |
void gfxCleanup | ( | void * | data | ) | [friend] |
The array of vertices.
The array of edges.
The array of faces;.
This bit array indicates if a particular vertex data channel is supported in this MNMesh.
If the bit is set the channel is supported.
This bit array indicates if a particular edge data channel is supported in this MNMesh.
If the bit is set the channel is supported.
int selLevel |
DWORD dispFlags |
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.