Class MNNormalFace

3DS Max Plug-In SDK

Class MNNormalFace

 

class MNNormalFace

 

Description:

This class is available in release 5.0 and later only.

This class is a face used to store 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.

.

Methods:

 

Prototype:

MNNormalFace ()

 

Remarks:

Constructor - initializes mDegree to 0, mpNormalID to NULL.

 

 

Prototype:

MNNormalFace (int degree)

 

Remarks:

Constructor - initializes to the degree specified.

.

 

Prototype:

~MNNormalFace ()

 

Remarks:

Destructor - frees data members.

 

Prototype:

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.

 

Prototype:

void Clear();

 

Remarks:

Frees all allocated data, sets degree to 0.

 

Prototype:

int GetDegree();

 

Remarks:

Returns the face's degree.

 

 

Prototype:

int SetDegree (int degree);

 

Remarks:

Sets the face's degree.

 

 

Prototype:

int GetNormalID(int corner);

 

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.)

 

Return Value:

Index of normal (in parent MNNormalSpec's normal array), or -1 if "corner"

is out of range.

 

Prototype:

int SetNormalID (int corner, int norm);

 

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).

 

Prototype:

bool GetSpecified (int corner)

 

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.)

 

Prototype:

void SetSpecified (int corner, bool value=true);

 

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.

 

Prototype:

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).

 

 

Prototype:

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.

 

Prototype:

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.

 

 

Prototype:

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

 

Prototype:

void Flip ();

 

 

Remarks:

Reverses order of normals, effectively inverting the face. (Designed

to be used in conjunction with MNFace::Flip.)

 

Prototype:

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.

 

 

Prototype:

MNNormalFace & operator= (const MNFace & from);

 

 

Remarks:

Sets the degree of this NormalFace to that of the MNFace given..

 

 

Prototype:

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.

 

Prototype:

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.

 

 

Prototype:

IOResult Save (ISave *isave);

 

 

Remarks:

Called by the system. Saves the face's data to the stream given.

 

Prototype:

IOResult Load (ILoad *iload);

 

 

Remarks:

Called by the system. Loads the face's data from the stream given.