Public Member Functions | Public Attributes | Friends

MNMap Class Reference

Search for all occurrences

Detailed Description

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>

Inheritance diagram for MNMap:
Inheritance graph
[legend]

List of all members.

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

Constructor & Destructor Documentation

MNMap ( ) [inline]

Constructor.

This calls Init().

{ Init(); }
~MNMap ( ) [inline]

Destructor.

This calls ClearAndFree().

{ ClearAndFree (); }

Member Function Documentation

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.

Parameters:
int num

The number of UVVerts to allocate.

bool keep=TRUE

If TRUE any previous verts are kept; otherwise they are discarded.
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.

Parameters:
int num

The number of map verts to allocate.

bool keep=TRUE

If TRUE any previous map faces are kept; otherwise they are discarded.
int VNum ( ) const [inline]

Returns the current number of UVVerts.

{ return numv; }
UVVert V ( int  i ) const [inline]

Returns the 'i-th' UVVert.

Parameters:
int i

The zero based index into the v array of the UVVert to return.
{ return v[i]; }
int FNum ( ) const [inline]

Returns the number of map faces.

{ return numf; }
MNMapFace* F ( int  i ) const [inline]

Returns a pointer to the 'i-th' map face.

Parameters:
int i

The zero based index of the map face to return.
{ 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.

Parameters:
int a

int b

int c

The mapping vertices for the new triangle.
DllExport int NewTri ( int *  vv )

Like MNMesh::NewTri, this creates a new mapping face, of degree 3, with the specified map vertices.

Parameters:
int *vv

The mapping vertices for the new triangle.
DllExport int NewQuad ( int  a,
int  b,
int  c,
int  d 
)

Like MNMesh::NewQuad, this creates a quad, with the specified map vertices.

Parameters:
int a

int b

int c

int d

The mapping vertices for this quad. (The two faces are formed with mapping verts (a,b,c) and (c,d,a).
DllExport int NewQuad ( int *  vv )

Like MNMesh::NewQuad, this creates a quad, with the specified map vertices.

Parameters:
int *vv

The mapping vertices for this quad. (The two faces are formed with mapping verts (vv[0],vv[1],vv[2]) and (vv[2],vv[3],vv[0]).
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.

Parameters:
int degg=0

The degree of the new face. (Note that this should match the degree of the associated MNFace.)

int *vv=NULL

The new mapping vertices, in order around the perimeter.
DllExport void setNumFaces ( int  nfnum )

Sets the number of map faces keeping any previously allocated faces.

Parameters:
int nfnum

The number of faces to set.
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.)

Parameters:
UVVert p

The UVVert to store.

int uoff=0

If non-zero this is an offset applied in U when p is stored.

int voff=0

If non-zero this is an offset applied in V when p is stored.
DllExport void setNumVerts ( int  nvnum )

Sets the number of UVVerts keeping any previously allocated UVVerts.

Parameters:
int nvnum

The number of UVVerts to set.
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.)

Parameters:
MNFace *faces

This should point to the MNFace array of the parent MNMesh. This allows the method to find out if any faces should be considered MN_DEAD, so that it won't mark such faces' map verts as used. (The MN_DEAD flag is stored in the MNFace, but not in the related MNMapFaces.)
DllExport void CollapseDeadFaces ( MNFace faces )

Eliminates the MN_DEAD map faces from the array.

This should be called immediately before calling CollapseDeadFaces on the parent MNMesh, to keep the face arrays in sync.

Parameters:
MNFace *faces

The parent MNMesh's array of MNFaces. This array is used to find out which faces are MN_DEAD.
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.

Parameters:
Matrix3 &xfm

The matrix to transform the UVVerts by.
DllExport MNMap& operator= ( const MNMap from )

Assignment operator.

DllExport MNMap& operator+= ( const MNMap from )

Appends the specified MNMap object onto this MNMap.

Parameters:
const MNMap &from

The source MNMap.
DllExport MNMap& operator+= ( const MNMesh from )

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.

Parameters:
const MNMesh &from

The source MNMesh.
DllExport void ShallowCopy ( const MNMap from )

Copies pointers.

To avoid memory errors, this method should only be used by the pipeline.

Parameters:
const MNMap & from

The map to copy pointers from.
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.

Parameters:
MNFace *faces

This should be the MNFace array of the parent MNMesh. It's used to prevent the DebugPrinting of MN_DEAD faces.
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

Parameters:
int mp

The map channel this MNMap represents - used to give more helpful debug information.

int nf

The number of faces of the parent MNMesh.

MNFace *faces

The parent MNMesh's face array. This is used to prevent checking of MN_DEAD faces, which may safely be invalid.
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.


Friends And Related Function Documentation

friend class MNMesh [friend]

Member Data Documentation

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.


MNMap MNMap MNMap MNMap MNMap MNMap MNMap MNMap MNMap MNMap
MNMap MNMap MNMap MNMap MNMap MNMap MNMap MNMap MNMap MNMap