3ds Max C++ API Reference
UVWMapper Class Reference

#include <UVWMapper.h>

+ Inheritance diagram for UVWMapper:

Public Member Functions

DllExport UVWMapper ()
 
DllExport UVWMapper (int type, const Matrix3 &tm, int cap=FALSE, float utile=1.0f, float vtile=1.0f, float wtile=1.0f, int uflip=FALSE, int vflip=FALSE, int wflip=FALSE)
 
DllExport UVWMapper (UVWMapper &m)
 
DllExport UVVert MapPoint (Point3 p, const Point3 &norm, int *nan=NULL)
 
DllExport UVVert TileFlip (UVVert uvw)
 
DllExport int MainAxis (const Point3 &n)
 
bool NormalMatters ()
 

Public Attributes

int type
 
int cap
 
float utile
 
float vtile
 
float wtile
 
int uflip
 
int vflip
 
int wflip
 
Matrix3 tm
 

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

See also
Class Mesh, Class Matrix3, Class Point3.

Description:
Prior to release 3.0, developers could implement Object::ApplyUVWMap() in their objects, but didn't have access to the algorithm 3ds Max uses internally to turn the mapping types (MAP_BOX, MAP_PLANE, etc) into an actual vertex-to-mapping-coordinate function. This class now makes this available.

The constructors for the class initialize the data members with information about the mapping desired. The main method, MapPoint(), maps a point in object space into the UVW map defined by this mapper.

Note: typedef Point3 UVVert;
Data Members:
int type;

The mapping type. One of the following values:

MAP_PLANAR

MAP_CYLINDRICAL

MAP_SPHERICAL

MAP_BALL

MAP_BOX

MAP_FACE

int cap;

This is used with MAP_CYLINDRICAL. If nonzero, then any face normal that is pointing more vertically than horizontally will be mapped using planar coordinates.

float utile;

Number of tiles in the U direction.

float vtile;

Number of tiles in the V direction.

float wtile;

Number of tiles in the W direction.

int uflip;

If nonzero the U values are mirrored.

int vflip

If nonzero the V values are mirrored.

int wflip;

If nonzero the W values are mirrored.

Matrix3 tm;

This defines the mapping space. As each point is mapped, it is multiplied by this matrix, and then it is mapped.

Constructor & Destructor Documentation

◆ UVWMapper() [1/3]

Remarks
Constructor. The data members are initialized as follows:

type = MAP_BOX;

utile = 1.0f;

vtile = 1.0f;

wtile = 1.0f;

uflip = 0;

vflip = 0;

wflip = 0;

cap = 0;

tm.IdentityMatrix();

◆ UVWMapper() [2/3]

DllExport UVWMapper ( int  type,
const Matrix3 tm,
int  cap = FALSE,
float  utile = 1.0f,
float  vtile = 1.0f,
float  wtile = 1.0f,
int  uflip = FALSE,
int  vflip = FALSE,
int  wflip = FALSE 
)
Remarks
Constructor. The data members are initialized to the values passed.

◆ UVWMapper() [3/3]

Remarks
Constructor. The data members are initialized from the UVWMapper passed.

Member Function Documentation

◆ MapPoint()

DllExport UVVert MapPoint ( Point3  p,
const Point3 norm,
int nan = NULL 
)
Remarks
This method maps a point in object space into the UVW map defined by this mapper. This gives the UVW coordinates for the specified point according to this mapper's mapping scheme.
Parameters:
Point3 p

The location of a vertex, i.e. the point being mapped. This point should NOT be transformed by the UVWMapper's tm, as this happens internally.

const Point3 & norm

The direction of the surface normal at p. This information is only required for types MAP_BOX or MAP_CYLINDRICAL. See the method NormalMatters() below.

int *nan=NULL

If non-NULL, this points to an int which should be set to FALSE if this mapping is good for all faces using this vertex, or TRUE if different faces should have different mapping coordinates. This is generally set to TRUE more often than absolutely necessary to make sure nothing is missed.
Returns
The mapped point.

◆ TileFlip()

DllExport UVVert TileFlip ( UVVert  uvw)
Remarks
Applies the UVWMap's tile and flip parameters to the given UVVert, and returns the result..
Parameters:
UVVert uvw

The input UVVert.
Returns
The modified UVVert.

◆ MainAxis()

DllExport int MainAxis ( const Point3 n)
Remarks
This method indicates which direction the given vector "chiefly points", after vector transformation by the UVWMapper's transform.
Parameters:
const Point3 & n

The input vector whose main axis is determined.
Returns
One of the following values:

0: tm.VectorTransform(n) points mainly in the +x direction.

1: tm.VectorTransform(n) points mainly in the +y direction.

2: tm.VectorTransform(n) points mainly in the +z direction.

3: tm.VectorTransform(n) points mainly in the -x direction.

4: tm.VectorTransform(n) points mainly in the -y direction.

5: tm.VectorTransform(n) points mainly in the -z direction.

◆ NormalMatters()

bool NormalMatters ( )
inline
Remarks
This method lets you know whether the current mapping type uses the normal information. If FALSE, it doesn't matter what value you pass as a normal to MapPoint. If TRUE, the MainAxis of the normal is used to determine the mapping.
150 { return ((type==MAP_BOX || type==MAP_ACAD_BOX)||((type==MAP_CYLINDRICAL || type==MAP_ACAD_CYLINDRICAL )&&cap)) ? TRUE:FALSE; }
#define MAP_ACAD_CYLINDRICAL
Definition: UVWMapTypes.h:22
#define MAP_ACAD_BOX
Definition: UVWMapTypes.h:21
#define MAP_BOX
Definition: UVWMapTypes.h:18
#define MAP_CYLINDRICAL
Definition: UVWMapTypes.h:15
int type
Definition: UVWMapper.h:83
int cap
Definition: UVWMapper.h:83

Member Data Documentation

◆ type

int type

◆ cap

int cap

◆ utile

float utile

◆ vtile

float vtile

◆ wtile

float wtile

◆ uflip

int uflip

◆ vflip

int vflip

◆ wflip

int wflip

◆ tm

Matrix3 tm