3ds Max C++ API Reference
MapDelta Class Reference

Represents some kind of change to a mesh map. More...

#include <meshdelta.h>

+ Inheritance diagram for MapDelta:

Public Member Functions

MapDeltaoperator= (MapDelta &from)
 
DllExport MapDeltaoperator*= (MapDelta &from)
 
DllExport DWORD ChangeFlags ()
 
DllExport void CopyMDChannels (MapDelta &from, DWORD channels)
 
DllExport BOOL CheckOrder ()
 
DllExport BOOL CheckFaces ()
 
Initialization & Clean-up
 MapDelta ()
 
DllExport void ClearAllOps ()
 
DllExport void SetInVNum (DWORD n)
 
DllExport void SetInFNum (DWORD n)
 
Characteristics (MapDelta)


DllExport int NumVSet (DWORD inVNum)
 
DWORD outVNum ()
 
DWORD outVNum (DWORD inVNum)
 
bool IsCreate (DWORD i)
 
DllExport DWORD SetID (DWORD i)
 
DllExport DWORD RemapID (DWORD ff)
 
DllExport DWORD IsRemapped (DWORD ff, DWORD vid)
 
DllExport TVFace OutFace (TVFace *mf, DWORD ff)
 
Basic Operations (MapDelta)


DllExport DWORD VCreate (UVVert *v, int num=1)
 
DllExport void FCreate (TVFace *f, int num=1)
 
DllExport void FCreateDefault (int num=1)
 
DllExport void FCreateQuad (DWORD *t)
 
DllExport void FClone (const TVFace &tf, DWORD remapFlags=0, DWORD *v=NULL)
 
DllExport void FRemap (DWORD f, DWORD flags, DWORD *v)
 
void FRemap (FaceRemap &fr)
 
DllExport void FDelete (int offset, BitArray &fdel)
 
DllExport void Set (DWORD i, const UVVert &p)
 
DllExport void Set (BitArray &sel, const UVVert &p)
 
Mesh Map Interaction


DllExport void Apply (UVVert *tv, TVFace *tf, DWORD inVNum, DWORD inFNum)
 
Debugging
DllExport void MyDebugPrint ()
 

Public Attributes

DWORD vnum
 The expected number of vertices in the input mesh. More...
 
DWORD fnum
 The expected number of faces in the input mesh. More...
 
Tab< UVVertSetvSet
 This data member stores changes in the mapping vertices given as input. More...
 
Tab< Point3vCreate
 This data member stores mapping vertices newly created as part of the MapDelta. More...
 
Tab< TVFacefCreate
 This data member stores map faces newly created as part of the MapDelta. More...
 
Tab< FaceRemapfRemap
 This data member stores changes in which map vertices are used by existing map faces. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

Represents some kind of change to a mesh map.

This "delta" can include changes in map vertices and/or faces. It is always a subordinate part of a MeshDelta. Most of the time, the programmer does not need to worry about this class directly, but can let the parent MeshDelta do most of the work.

See also
Class Mesh, Class MeshDelta, Template Class Tab.

Constructor & Destructor Documentation

◆ MapDelta()

MapDelta ( )
inline
Remarks
Constructor. Initializes the MapDelta with empty tables and 0's for input mesh map size.
327 { vnum=0; fnum=0; }
DWORD vnum
The expected number of vertices in the input mesh.
Definition: meshdelta.h:304
DWORD fnum
The expected number of faces in the input mesh.
Definition: meshdelta.h:306

Member Function Documentation

◆ ClearAllOps()

DllExport void ClearAllOps ( )
Remarks
Clears out all existing map changes. Zeroes all the vCreate, vSet, etc tables.

◆ NumVSet()

DllExport int NumVSet ( DWORD  inVNum)
Remarks
Returns the number of map vertex sets that would be applied to a map with the specified number of map vertices. (If that number equals this MapDelta's vnum, this is simply vSet.Count().)
Parameters:
DWORD inVNum The number of vertices in the input map we're inquiring about.

◆ SetInVNum()

DllExport void SetInVNum ( DWORD  n)
Remarks
Sets the number of map vertices in the input map. NOTE that if n is less than the current vnum, the data relating to the extra vertices will be lost. (That is, if one of your map vertex sets is applied to map vertex 32, and you SetInVNum to 30, that vertex set will be lost, and will not be recovered if you later SetInVNum to 35.) It is NOT necessary to call this method before applying this MapDelta to a smaller than expected Map.
Parameters:
DWORD n The number of vertices expected from the input mesh.

◆ SetInFNum()

DllExport void SetInFNum ( DWORD  n)
Remarks
Sets the number of map faces in the input map. NOTE that if n is less than the current fnum, the data relating to the extra faces will be lost. (That is, if one of your face remaps is applied to face 32, and you SetInFNum to 30, that face remap will be lost, and will not be recovered if you later SetInFNum to 35.) It is NOT necessary to call this method before applying this MapDelta to a smaller than expected Map.
Parameters:
DWORD n The number of faces expected from the input mesh.

◆ outVNum() [1/2]

DWORD outVNum ( )
inline
Remarks
Returns the number of vertices in the output map, assuming that the input map is of the expected (vnum) size.
373 { return vnum + vCreate.Count(); }
Tab< Point3 > vCreate
This data member stores mapping vertices newly created as part of the MapDelta.
Definition: meshdelta.h:313
int Count() const
Retrieves the number of items in the Tab.
Definition: tab.h:219

◆ outVNum() [2/2]

DWORD outVNum ( DWORD  inVNum)
inline
Remarks
Returns the number of vertices in the output map, assuming that the input map has the specified number of map vertices.
Parameters:
DWORD inVNum The number of map vertices expected in the input map.
379 { return inVNum + vCreate.Count(); }

◆ IsCreate()

bool IsCreate ( DWORD  i)
inline
Remarks
Indicates whether the specified map vertex was created in this MapDelta.
Parameters:
DWORD i The index in the output of the map vertex.
385 { int j=i-vnum; return ((j>=0) && (j<vCreate.Count())); }

◆ SetID()

DllExport DWORD SetID ( DWORD  i)
Remarks
Obtains the index of the vSet entry that relates to this vertex.
Parameters:
DWORD i The map vertex index.
Returns
The index in the vSet array of the map vertex set corresponding to this vertex, or UNDEFINED if this map vertex has not been modified.

◆ VCreate()

DllExport DWORD VCreate ( UVVert v,
int  num = 1 
)
Remarks
Creates new map vertices.
Parameters:
UVVert *v A pointer to an array of UVVerts representing the new map vertices. int num The size of the UVVert array.
Returns
The index (in the output map) of the first of these new map vertices.

◆ FCreate()

DllExport void FCreate ( TVFace f,
int  num = 1 
)
Remarks
Creates new map faces. Note: MapDeltas must be kept up to date with the parent MeshDelta in all new face creations. See the MeshDelta method CreateDefaultMapFaces for details.
Parameters:
TVFace *f A pointer to an array of map faces to be added to the MapDelta. int num The size of the map face array.

◆ FCreateDefault()

DllExport void FCreateDefault ( int  num = 1)
Remarks
Creates new "default" map faces, where all the corners are UNDEFINED. (These are later filled in by a call to the parent MeshDelta's FillInFaces method.) Note: MapDeltas must be kept up to date with the parent MeshDelta in all new face creations. See the MeshDelta method CreateDefaultMapFaces for details.
Parameters:
int num The number of default faces to create.

◆ FCreateQuad()

DllExport void FCreateQuad ( DWORD *  t)
Remarks
Creates 2 new faces, forming a quad. Note: MapDeltas must be kept up to date with the parent MeshDelta in all new face creations. See the MeshDelta method CreateDefaultMapFaces for details.
Parameters:
DWORD *t A pointer to an array of 4 map vertices to be used as corners of the quad.

◆ FClone()

DllExport void FClone ( const TVFace tf,
DWORD  remapFlags = 0,
DWORD *  v = NULL 
)
Remarks
Creates a new map face by copying (and optionally remapping) the face given. Note: MapDeltas must be kept up to date with the parent MeshDelta in all new face creations. See the MeshDelta method CreateDefaultMapFaces for details.
Parameters:
TVFace & tf The map face we wish to clone. (This is typically generated by the OutFace method.) DWORD remapFlags=0 DWORD *v=NULL If we wish to remap any of the corners of this map face while cloning, the appropriate flags and vertices should be passed in these last two arguments. v should point to an array of 3 map vertex indices, although the ones not marked as used by the remapFlags need not be set to anything in particular. See class FaceRemap for more information about face remapping.

◆ FRemap() [1/2]

DllExport void FRemap ( DWORD  f,
DWORD  flags,
DWORD *  v 
)
Remarks
Adds a face remap to this MapDelta. If the face specified already has a remap record, the two are combined. If the face specified is a face created by this MapDelta, the remap is applied directly to the fCreate entry instead of being stored in fRemap.
Parameters:
DWORD f The face to remap. DWORD flags Face Remap flags - these indicate which vertices should be remapped. The possibilities are FR_V0 (1), FR_V1 (2), and FR_V2 (4). (See class FaceRemap for more information.) DWORD *v A pointer to the vertices to remap the face to use. Only the positions indicated in the remap flags need contain meaningful data. Note that the vertices indicated here must be indexed by their positions after all of the current MeshDelta's creates and clones, but before any vertex deletes - essentially input-based indexing. Vertex index values of 0 through vnum-1 are considered to be the original mesh's vertices; values of vnum through vnum+vCreate.Count()-1 are considered to be this MeshDelta's newly created vertices; and values above this are cloned vertices.

◆ FRemap() [2/2]

void FRemap ( FaceRemap fr)
inline
Remarks
Adds a face remap to this MapDelta. If the face specified in the FaceRemap already has a remap record, the two are combined. If the face specified is a face created by this MapDelta, the remap is applied directly to the fCreate entry instead of being stored in fRemap.
Parameters:
FaceRemap & fr A FaceRemap that should be appended to this MapDelta.
478 { FRemap (fr.f, fr.flags, fr.v); }
DWORD f
Face being remapped. This is a zero based index into the Mesh's faces array.
Definition: meshdelta.h:162
DWORD flags
Specifies which vertices to remap.
Definition: meshdelta.h:168
DWORD v[3]
Array of vertex indices.
Definition: meshdelta.h:171
DllExport void FRemap(DWORD f, DWORD flags, DWORD *v)

◆ FDelete()

DllExport void FDelete ( int  offset,
BitArray fdel 
)
Remarks
Deletes the specified faces. This only affects the fCreate array, and should generally only be called by the parent MeshDelta's FDelete method to keep the face create arrays in sync.
Parameters:
int offset Indicates what position in the fdel array corresponds to the first created face. (This is necessary since the BitArrays handed to MeshDelta::FDelete generally are based on the indexing after the previous MeshDelta::fDelete is applied. So this value is less than fnum if there was some previous deletion of original faces in the MeshDelta.) BitArray & fdel The faces to delete. The faces are indexed by their output mesh positions.

◆ Set() [1/2]

DllExport void Set ( DWORD  i,
const UVVert p 
)
Remarks
Sets an existing map vertex to the value given. (Note that if the same map vertex is set twice, the new set simply replaces the old one - there is never more than one UVVertSet in the vSet array for a single input map vertex.)
Parameters:
int i The index of the map vertex to set. const UVVert & p The value to set the map vertex to.

◆ Set() [2/2]

DllExport void Set ( BitArray sel,
const UVVert p 
)
Remarks
Creates new map vertices.
Parameters:
UVVert *v A pointer to an array of UVVerts representing the new map vertices. int num The size of the UVVert array.
Returns
The index (in the output map) of the first of these new map vertices.

◆ RemapID()

DllExport DWORD RemapID ( DWORD  ff)
Remarks
Obtains the index of the fRemap entry that relates to this face.
Parameters:
DWORD ff The map face index.
Returns
If there is such an entry, the index is returned, so fRemap[RemapID(ff)].fid == ff. If there is no remap record for this map face, the method returns UNDEFINED.

◆ IsRemapped()

DllExport DWORD IsRemapped ( DWORD  ff,
DWORD  vid 
)
Remarks
Tells whether the specified corner of the specified face has been remapped in this MapDelta.
Parameters:
DWORD ff The map face index. DWORD vid The corner of the face - 0, 1, or 2.
Returns
If this corner has been remapped, it returns the vertex it's been remapped to. Otherwise, it returns UNDEFINED.

◆ OutFace()

DllExport TVFace OutFace ( TVFace mf,
DWORD  ff 
)
Remarks
Returns the specified map face as it would appear in the MapDelta output, taking into account any remaps.
Parameters:
TVFace *mf The input map face array. DWORD f The index of the face you want the output version of.

◆ operator=()

MapDelta& operator= ( MapDelta from)
inline
Remarks
Equality operator - makes this MapDelta just like the one given.
543 { CopyMDChannels (from, MDELTA_ALL); return *this; }
DllExport void CopyMDChannels(MapDelta &from, DWORD channels)
#define MDELTA_ALL
Definition: meshdelta.h:50

◆ operator*=()

DllExport MapDelta& operator*= ( MapDelta from)
Remarks
Appends the given MapDelta to the current one.
Parameters:
MapDelta & td The MapDelta to append. This MapDelta may be modified to make it suitable, ie the vnum and fnum values will be set to the expected output of the current MapDelta if they don't already match. (This may result in the loss of some data - see "SetInVNum" and "SetInFNum" for more information.)

◆ Apply()

DllExport void Apply ( UVVert tv,
TVFace tf,
DWORD  inVNum,
DWORD  inFNum 
)
Remarks
Changes the given map by this MapDelta, in the following manner: First, any maps that are supported by the MeshDelta but not by the mesh are assigned to the mesh in their default form. (Vertex colors are white, other maps are copies of the mesh vertices, and all have the same topology as the mesh). Next, any UNDEFINED mapping verts in the MeshDelta are filled in by FillInFaces. Then the new vertices are added, creates first, followed by clones. The original vertices are then moved. The faces are then modified, by applying all the FaceRemaps, FaceChanges, and FaceSmooths to the appropriate faces. New faces (in fCreate) are appended to the end of the face list. Map changes are applied to all active maps, and map channels not supported by this MeshDelta are removed. After all that is done, the vertices and faces marked in the vDelete and fDelete arrays are deleted. Finally, the vertex data, vertex hide, and selections kept in the MeshDelta are applied to the result.
Parameters
tv- The map vertex array to change. This should be allocated to handle all the new map vertices in the vCreate array.
tf- The map face array to change. This should be allocated to handle all the new map faces in the fCreate array.
inVNum- The actual number of map vertices (which doesn't have to match this MapDelta's vnum) in the input map.
inFNum- The actual number of map faces (which doesn't have to match this MapDelta's fnum) in the input map.

◆ MyDebugPrint()

DllExport void MyDebugPrint ( )
Remarks
Prints out all the changes in this MapDelta to the DebugPrint window in Developer Studio.

◆ ChangeFlags()

DllExport DWORD ChangeFlags ( )
Remarks
Indicates what parts of a MapDelta could be changed if this MapDelta were appended to it. This is useful when backing up the MapDelta for Restore Objects. For instance, if you had a MapDelta with lots of face remaps, and you wanted to compose it with one that only added map vertices, there would be no reason to back up the remaps for an undo.
Returns
Returns some combination of the following flags, corresponding to the data members that would be changed: MDELTA_VMOVE: Indicates that the vSet array will be altered by this MapDelta. MDELTA_VCREATE: Indicates that the vCreate array will be altered by this MapDelta. MDELTA_FREMAP: Indicates that the fRemap array will be altered by this MapDelta. MDELTA_FCREATE: Indicates that the fCreate array will be altered by this MapDelta.

◆ CopyMDChannels()

DllExport void CopyMDChannels ( MapDelta from,
DWORD  channels 
)
Remarks
Copies the specified parts of the MapDelta. (Useful in combination with ChangeFlags to create efficient Restore objects.)
Parameters:
MapDelta & from The MapDelta to copy into this. DWORD channels Indicates the parts to copy - some combination of the following flags: MDELTA_VMOVE: Copy the vSet array. MDELTA_VCREATE: Copy the vCreate array. MDELTA_FREMAP: Copy the fRemap array. MDELTA_FCREATE: Copy the fCreate array.

◆ CheckOrder()

DllExport BOOL CheckOrder ( )

◆ CheckFaces()

DllExport BOOL CheckFaces ( )

Member Data Documentation

◆ vnum

DWORD vnum

The expected number of vertices in the input mesh.

◆ fnum

DWORD fnum

The expected number of faces in the input mesh.

◆ vSet

Tab<UVVertSet> vSet

This data member stores changes in the mapping vertices given as input.

See class UVVertSet for more information. UVVertSets are stored in original map vertex ID order, and there is never more than one UVVertSet per original map vertex.

◆ vCreate

Tab<Point3> vCreate

This data member stores mapping vertices newly created as part of the MapDelta.

These are stored in the order created.

◆ fCreate

Tab<TVFace> fCreate

This data member stores map faces newly created as part of the MapDelta.

These are stored in the order created. This must match driver MeshDelta fCreate in size.

◆ fRemap

Tab<FaceRemap> fRemap

This data member stores changes in which map vertices are used by existing map faces.

See Class FaceRemap for more information. These are stored in original face order, and there is never more than one per original face. At least one per new vertex.