3ds Max C++ API Reference
Loading...
Searching...
No Matches
MNNormalFace Class Reference

This stores specified normal information for a given face. More...

#include <MNNormalSpec.h>

+ Inheritance diagram for MNNormalFace:

Public Member Functions

 MNNormalFace ()
 
DllExport MNNormalFace (int degree)
 
 ~MNNormalFace ()
 
DllExport void Init ()
 
DllExport void Clear ()
 
int GetDegree ()
 
DllExport void SetDegree (int degree)
 
int GetNormalID (int corner)
 
void SetNormalID (int corner, int norm)
 
intGetNormalIDArray ()
 Return a pointer to the internal array of normal IDs. This array has length == GetDegree().

 
bool GetSpecified (int corner)
 
void SetSpecified (int corner, bool value=true)
 
void SpecifyAll (bool value=true)
 Set all normals on this face to be specified.
 
DllExport void SpecifyNormalID (int corner, int norm)
 
DllExport void MakePoly (int degree, int *pNormalID)
 
DllExport void Insert (int pos, int num=1)
 
DllExport void InsertAndClear (int pos, int num=1)
 
DllExport void Delete (int pos, int num=1)
 
DllExport void RotateStart (int newstart)
 
DllExport void Flip ()
 
DllExport MNNormalFaceoperator= (const MNNormalFace &from)
 
DllExport MNNormalFaceoperator= (const MNFace &from)
 
DllExport void ShallowTransfer (MNNormalFace &from)
 
DllExport void MNDebugPrint (bool printAll=false)
 
DllExport IOResult Save (ISave *isave)
 
DllExport IOResult Load (ILoad *iload)
 

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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 

Detailed Description

This stores specified normal information for a given face.

An array of these faces is used as a data member of class MNNormalSpec, in much the same way as an MNMapFace array is a data member of class MNMap.

Constructor & Destructor Documentation

◆ MNNormalFace() [1/2]

MNNormalFace ( )
inline
Remarks
Constructor - initializes mDegree to 0, mpNormalID to NULL.

47: mDegree(0), mpNormalID(NULL) { }
#define NULL
Definition: autoptr.h:18

◆ MNNormalFace() [2/2]

DllExport MNNormalFace ( int  degree)
Remarks
Constructor - initializes to the degree specified.

◆ ~MNNormalFace()

~MNNormalFace ( )
inline
Remarks
Destructor - frees data members.

53{ Clear(); }
DllExport void Clear()

Member Function Documentation

◆ Init()

DllExport void Init ( )
Remarks
Initializes data members. This is useful in situations where the default constructor may not have been properly called, such as

MNNormalFace *fc = new MNNormalFace[10];

It should not be called on an MNNormalFace with data allocated, or that memory will leak.

◆ Clear()

DllExport void Clear ( )
Remarks
Frees all allocated data, sets degree to 0.

◆ GetDegree()

int GetDegree ( )
inline
Remarks
Returns the face's degree.

68{ return mDegree; }

◆ SetDegree()

DllExport void SetDegree ( int  degree)
Remarks
Sets the face's degree.

◆ GetNormalID()

int GetNormalID ( int  corner)
inline
Remarks
Accessor for normal in a particular corner of the face.

Parameters:
int corner

The (zero-based) index of the corner of the face. (A quad face has corners 0, 1, 2, and 3.)

Returns
Index of normal (in parent MNNormalSpec's normal array), or -1 if "corner" is out of range.

82{ return (mpNormalID && (corner<mDegree)) ? mpNormalID[corner] : -1; }

◆ SetNormalID()

void SetNormalID ( int  corner,
int  norm 
)
inline
Remarks
Sets the normal ID used in a particular corner.

Parameters:
int corner

The (zero-based) index of the corner of the face. (A quad face has corners 0, 1, 2, and 3.)

int norm

The index of the normal (in the parent MNNormalSpec's normal array).
91{ if (mpNormalID && (corner<mDegree)) mpNormalID[corner] = norm; }

◆ GetNormalIDArray()

int * GetNormalIDArray ( )
inline

Return a pointer to the internal array of normal IDs. This array has length == GetDegree().

94{ return mpNormalID; }

◆ GetSpecified()

bool GetSpecified ( int  corner)
inline
Remarks
Indicates whether the normal used in a particular corner is specified or not.

Parameters:
int corner

The (zero-based) index of the corner of the face. (A quad face has

corners 0, 1, 2, and 3.)

104{ return (mpNormalID && (corner<mDegree) && mSpecified[corner]) ? true : false; }

◆ SetSpecified()

void SetSpecified ( int  corner,
bool  value = true 
)
inline
Remarks
Controls whether the normal used in a particular corner of the face is specified or not.

Parameters:
int corner

The (zero-based) index of the corner of the face. (A quad face has corners 0, 1, 2, and 3.)

Parameters:
bool value

Whether the corner should have a specified (true) or unspecified (false) normal.

118{ if (mpNormalID && (corner<mDegree)) mSpecified.Set (corner, value); }
void Set(int i)
Definition: bitarray.h:299

◆ SpecifyAll()

void SpecifyAll ( bool  value = true)
inline

Set all normals on this face to be specified.

121{ if (value) mSpecified.SetAll(); else mSpecified.ClearAll(); }
void SetAll()
Definition: bitarray.h:285
void ClearAll()
Definition: bitarray.h:272

◆ SpecifyNormalID()

DllExport void SpecifyNormalID ( int  corner,
int  norm 
)
Remarks
Specifies that a particular corner of the face should use a given normal index.

Parameters:
int corner

The (zero-based) index of the corner of the face. (A quad face has corners 0, 1, 2, and 3.)

Parameters:
int norm

The index of the normal (in the parent MNNormalSpec's normal array).

◆ MakePoly()

DllExport void MakePoly ( int  degree,
int pNormalID 
)

◆ Insert()

DllExport void Insert ( int  pos,
int  num = 1 
)
Remarks
Inserts space for more normals into an existing face. (Designed to be used in conjunction with MNFace::Insert, to increase the size of a polygon and add new vertices & normals.)
Parameters:
int pos

The location within the face where the new normals will be added.

Parameters:
int num=1

The number of new normals to add.

◆ InsertAndClear()

DllExport void InsertAndClear ( int  pos,
int  num = 1 
)
Remarks
Identical to the Insert function, with the exception that the new normal entries for vertices [pos, pos + num) are initialized to be unspecified, rather than retaining the values from the vertices shifted to positions [pos + num, deg), where deg is the degree of the face after insertion.
Parameters:
int pos

The location within the face where the new normals will be added.

Parameters:
int num=1

The number of new normals to add.

◆ Delete()

DllExport void Delete ( int  pos,
int  num = 1 
)
Remarks
Deletes normals from this map face. (Designed to be used in conjunction with MNFace::Delete, to decrease the size of a polygon and remove vertices & normals.).
Parameters:
int pos

The location within the face where the new normals will be deleted.

Parameters:
int num=1

The number of new normals to delete.

◆ RotateStart()

DllExport void RotateStart ( int  newstart)
Remarks
Deletes normals from this map face. (Designed to be used in conjunction with MNFace::Delete, to decrease the size of a polygon and remove vertices & normals.).
Parameters:
int newstart

The new first normal

◆ Flip()

DllExport void Flip ( )
Remarks
Reverses order of normals, effectively inverting the face. (Designed to be used in conjunction with MNFace::Flip.)

◆ operator=() [1/2]

DllExport MNNormalFace & operator= ( const MNNormalFace from)
Remarks
Typical = operator - calls SetDegree to make this face the same size as "from", then copies the specification data and the normalIDs.

◆ operator=() [2/2]

DllExport MNNormalFace & operator= ( const MNFace from)
Remarks
Sets the degree of this NormalFace to that of the MNFace given.

◆ ShallowTransfer()

DllExport void ShallowTransfer ( MNNormalFace from)
Remarks
"Shallow-copies" data from "from". This is dangerous to use - the pointer to the normal ID array is the same in both faces after this is called.

It's typically used by MNNormal::FAlloc, when resizing the whole face array.

◆ MNDebugPrint()

DllExport void MNDebugPrint ( bool  printAll = false)
Remarks
Uses "DebugPrint" to output information about this MNNormalFace to the Debug buffer in DevStudio. Output is formatted as follows: suppose we have a 5-sided face, with normals {4,5,6,7,8}, and only the normals in corners 1 and 2 (i.e. normals 5 and 6) are specified.

MNDebugPrint (true) would generate:

_4 5 6 _7 _8

MNDebugPrint (false) would generate:

_ 5 6 _ _

This is mainly used as part of MNNormalSpec::MNDebugPrint.

◆ Save()

DllExport IOResult Save ( ISave isave)
Remarks
Called by the system. Saves the face's data to the stream given.

◆ Load()

DllExport IOResult Load ( ILoad iload)
Remarks
Called by the system. Loads the face's data from the stream given.