Holds the mapping information for a particular map channel of the MNMesh.
As with regular Mesh maps, the MNMap holds an array of map vertices and an array of map faces that define how those mapping vertices are applied to the MNMesh. The number (numf) of mapping faces should always match the number of faces in the parent MNMesh, and each MNMapFace gives the map vertices for the related MNFace. The number of map vertices may be different from the number of MNVerts in the parent MNMesh.
#include <mnmesh.h>
Public Member Functions |
|
MNMap () | |
Constructor. |
|
~MNMap () | |
Destructor. |
|
DllExport int | NewTri (int a, int b, int c) |
Like MNMesh::NewTri, this creates a new
mapping face, of degree 3, with the specified map vertices.
|
|
DllExport int | NewTri (int *vv) |
Like MNMesh::NewTri, this creates a new
mapping face, of degree 3, with the specified map vertices.
|
|
DllExport int | NewQuad (int a, int b, int c, int d) |
Like MNMesh::NewQuad, this
creates a quad, with the specified map vertices. |
|
DllExport int | NewQuad (int *vv) |
Like MNMesh::NewQuad, this
creates a quad, with the specified map vertices. |
|
DllExport int | NewFace (int degg=0, int *vv=NULL) |
Like
MNMesh::NewFace, this creates a new mapping face with the
specified degree and map vertices. |
|
DllExport void | setNumFaces (int nfnum) |
Sets the number of map faces keeping any
previously allocated faces. |
|
DllExport int | NewVert (UVVert p, int uoff=0, int voff=0) |
Allocates storage for a new specified
UVVert. |
|
DllExport void | setNumVerts (int nvnum) |
Sets the number of UVVerts keeping any
previously allocated UVVerts. |
|
DllExport void | CollapseDeadVerts (MNFace *faces) |
Eliminates the mapping vertices not used by
any active mapping faces in this map. |
|
DllExport void | CollapseDeadFaces (MNFace *faces) |
Eliminates the MN_DEAD map faces from the
array. |
|
DllExport void | Clear () |
Sets the number of UVVerts and map faces to
0. |
|
DllExport void | ClearAndFree () |
Sets the number of UVVerts and map faces to
0 and deallocates the memory. |
|
DllExport void | Transform (Matrix3 &xfm) |
Transforms each UVVert with the specified
matrix. |
|
DllExport void | ShallowCopy (const MNMap &from) |
Copies pointers. |
|
DllExport void | NewAndCopy () |
Creates new pointers and copies over all the
data. |
|
DllExport void | MNDebugPrint (MNFace *faces) |
Uses DebugPrint to print out information
about this
MNMap to the Debug Results window in DevStudio. |
|
DllExport bool | CheckAllData (int mapChannel, int nf, MNFace *faces) |
Checks the
MNMap for internal errors, such as a
MNMapFace referring to an out of range map vertex. |
|
DllExport IOResult | Save (ISave *isave, MNFace *faces=NULL) |
Used internally to save this
MNMap to the 3ds Max file. |
|
DllExport IOResult | Load (ILoad *iload, MNFace *faces=NULL) |
Used internally to load this
MNMap from the 3ds Max file. |
|
Initialization Functions
|
|
DllExport void | Init () |
Initializes the map - sets numv and numf to
0, and sets the pointers to NULL. |
|
DllExport void | VAlloc (int num, bool keep=TRUE) |
Allocates the specified number of UVVerts in
the v array. |
|
DllExport void | FAlloc (int num, bool keep=TRUE) |
Allocates the specified number of map faces
in the f array. |
|
Data Access Functions
|
|
int | VNum () const |
Returns the current number of UVVerts.
|
|
UVVert | V (int i) const |
Returns the 'i-th' UVVert. |
|
int | FNum () const |
Returns the number of map faces. |
|
MNMapFace * | F (int i) const |
Returns a pointer to the 'i-th' map face.
|
|
Operators
|
|
DllExport MNMap & | operator= (const MNMap &from) |
Assignment operator. |
|
DllExport MNMap & | operator+= (const MNMap &from) |
Appends the specified
MNMap object onto this
MNMap. |
|
DllExport MNMap & | operator+= (const MNMesh &from) |
Appends a default planar map corresponding
to the mesh passed onto this map. |
|
Public Attributes |
|
MNMapFace * | f |
The array of map faces. |
|
UVVert * | v |
The array of UVVerts. |
|
int | numv |
The number of vertices in the v array.
|
|
int | numf |
The number of map faces in the f array.
|
|
Friends |
|
class | MNMesh |
~MNMap | ( | ) | [inline] |
DllExport void Init | ( | ) |
Initializes the map - sets numv and numf to 0, and sets the pointers to NULL.
Also initializes private allocation related data members.
DllExport void VAlloc | ( | int | num, |
bool | keep = TRUE |
||
) |
Allocates the specified number of UVVerts in the v array.
(If you're creating a number of map verts, but you're not sure exactly how many, it's good to pre-allocate a large number using this method.) This method doesn't affect MNMap::numv, only the allocation amount.
DllExport void FAlloc | ( | int | num, |
bool | keep = TRUE |
||
) |
Allocates the specified number of map faces in the f array.
This method doesn't affect MNMap::numf, just the number allocated.
int VNum | ( | ) | const [inline] |
UVVert V | ( | int | i | ) | const [inline] |
Returns the 'i-th' UVVert.
{ return v[i]; }
int FNum | ( | ) | const [inline] |
MNMapFace* F | ( | int | i | ) | const [inline] |
Returns a pointer to the 'i-th' map face.
{ return &(f[i]); }
DllExport int NewTri | ( | int | a, |
int | b, | ||
int | c | ||
) |
Like MNMesh::NewTri, this creates a new mapping face, of degree 3, with the specified map vertices.
DllExport int NewTri | ( | int * | vv | ) |
Like MNMesh::NewTri, this creates a new mapping face, of degree 3, with the specified map vertices.
DllExport int NewQuad | ( | int | a, |
int | b, | ||
int | c, | ||
int | d | ||
) |
Like MNMesh::NewQuad, this creates a quad, with the specified map vertices.
DllExport int NewQuad | ( | int * | vv | ) |
Like MNMesh::NewQuad, this creates a quad, with the specified map vertices.
DllExport int NewFace | ( | int | degg = 0 , |
int * | vv = NULL |
||
) |
Like MNMesh::NewFace, this creates a new mapping face with the specified degree and map vertices.
DllExport void setNumFaces | ( | int | nfnum | ) |
Sets the number of map faces keeping any previously allocated faces.
DllExport int NewVert | ( | UVVert | p, |
int | uoff = 0 , |
||
int | voff = 0 |
||
) |
Allocates storage for a new specified UVVert.
An optional offset to the UVVert may be supplied. (The offset is useful when you want to create a new UVVert which is on the other side of a seam in U or V from some existing UVVert p.)
DllExport void setNumVerts | ( | int | nvnum | ) |
Sets the number of UVVerts keeping any previously allocated UVVerts.
DllExport void CollapseDeadVerts | ( | MNFace * | faces | ) |
Eliminates the mapping vertices not used by any active mapping faces in this map.
(Analogous to the Mesh::DeleteIsoMapVerts method.)
DllExport void CollapseDeadFaces | ( | MNFace * | faces | ) |
DllExport void Clear | ( | ) |
Sets the number of UVVerts and map faces to 0.
DllExport void ClearAndFree | ( | ) |
Sets the number of UVVerts and map faces to 0 and deallocates the memory.
DllExport void Transform | ( | Matrix3 & | xfm | ) |
Transforms each UVVert with the specified matrix.
Appends a default planar map corresponding to the mesh passed onto this map.
This is typically used when joining two MNMeshes together when one MNMesh has a map channel active but the other doesn't. Rather than eliminate the map channel, we just use the object coordinates of the other mesh to generate a planar map for its faces.
DllExport void ShallowCopy | ( | const MNMap & | from | ) |
Copies pointers.
To avoid memory errors, this method should only be used by the pipeline.
DllExport void NewAndCopy | ( | ) |
Creates new pointers and copies over all the data.
To avoid memory errors, this method should only be used by the pipeline.
DllExport void MNDebugPrint | ( | MNFace * | faces | ) |
Uses DebugPrint to print out information about this MNMap to the Debug Results window in DevStudio.
This includes all map verts and faces, one per line.
DllExport bool CheckAllData | ( | int | mapChannel, |
int | nf, | ||
MNFace * | faces | ||
) |
Checks the MNMap for internal errors, such as a MNMapFace referring to an out of range map vertex.
If an error is found, an error message is DebugPrinted, and a the method returns FALSE. This is strictly a debugging tool of no use in releases - a good way to use it is to say
, so it won't be called when not in a Debug build, and so it'll throw up an assertion failure if something's wrong. Error messages generated: Map d: Wrong number of faces. Should be d, is d. (Sent if nf != MNMap::numf) Map d, Face d has wrong degree. Should be d, is d. (Sent if f[i].deg != faces[i].deg) Map d, Face d has wrong hdegree. Should be d, is d. (Sent if f[i].hdeg != faces[i].hdeg) Map d, Face d has an out-of-range map vertex: d. Map d, Face d has an out-of-range hidden map vertex: d
Used internally to save this MNMap to the 3ds Max file.
Used internally to load this MNMap from the 3ds Max file.
friend class MNMesh [friend] |
The array of map faces.
The array of UVVerts.
int numv |
The number of vertices in the v array.
int numf |
The number of map faces in the f array.