Public Member Functions

MNMapPreserveData Class Reference

Search for all occurrences

Detailed Description

This class is used to "preserve" mapping coordinates while moving vertices.

The "Preserve" name is actually a little confusing; what this class helps us do is modify map vertices such that the overall map on a surface looks about the same, even though the regular vertices have moved. For instance, if you start with a Plane object, and move the middle vertex to the right, the map is typically distorted even though all the original map vertices are unaffected. This class will help by adjusting the middle map vertex so that the overall regular texture pattern is preserved.


Example: See example usage in the Editable Poly object, in maxsdk/samples/mesh/EditablePoly

#include <mnmesh.h>

Inheritance diagram for MNMapPreserveData:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  MNMapPreserveData ()
  Constructor. Initializes to empty data.
  ~MNMapPreserveData ()
  Destructor. Frees allocated data.
DllExport void  Clear ()
  Clears out all allocated data, and resets to empty.
DllExport void  Initialize (MNMesh &mm, const MapBitArray &mapsToDo)
  Creates caches of data based on the mesh given and the set of maps to be preserved.
DllExport void  Apply (MNMesh &mm, Point3 *pDelta, int numDeltas)
  Given a mesh and a set of offsets for vertices, manipulate map channels to preserve the initial UV mapping.

Constructor & Destructor Documentation

MNMapPreserveData ( ) [inline]

Constructor. Initializes to empty data.

: mDegreeSum(0), mProtectVertexColors(true) { }
~MNMapPreserveData ( ) [inline]

Destructor. Frees allocated data.

{ Clear(); }

Member Function Documentation

DllExport void Clear ( )

Clears out all allocated data, and resets to empty.

DllExport void Initialize ( MNMesh mm,
const MapBitArray mapsToDo 
)

Creates caches of data based on the mesh given and the set of maps to be preserved.

Sets the "initial state" which the maps should try to adhere to.

Parameters:
mm The mesh whose maps should be preserved
mapsToDo A MapBitArray indicating which map channels should be preserved. See class MapBitArray for more details.
DllExport void Apply ( MNMesh mm,
Point3 pDelta,
int  numDeltas 
)

Given a mesh and a set of offsets for vertices, manipulate map channels to preserve the initial UV mapping.

Parameters:
mm The mesh being affected. Note that this algorithm uses the face information in the mesh, and affects the maps in the mesh, but it doesn't use the vertex information at all. (All relevant vertex information was digested in Initialize.) So this method may be called before or after applying the offsets given in pDelta.
pDelta The set of offsets for the vertices.
numDeltas The length of the pDelta array

MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData
MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData MNMapPreserveData