MNNormalFace Class Reference

MNNormalFace Class Reference

#include <MNNormalSpec.h>

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

+ 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(). More...
 
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. More...
 
DllExport void SpecifyNormalID (int corner, int norm)
 
DllExport void MakePoly (int degree, int *pNormalID)
 
DllExport void Insert (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. 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...
 

Constructor & Destructor Documentation

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

46 : mDegree(0), mpNormalID(NULL) { }
#define NULL
Definition: autoptr.h:18
DllExport MNNormalFace ( int  degree)
Remarks
Constructor - initializes to the degree specified.

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

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

Member Function Documentation

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.

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

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

67 { return mDegree; }
DllExport void SetDegree ( int  degree)
Remarks
Sets the face's degree.
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.

81 { return (mpNormalID && (corner<mDegree)) ? mpNormalID[corner] : -1; }
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).
90 { if (mpNormalID && (corner<mDegree)) mpNormalID[corner] = norm; }
int* GetNormalIDArray ( )
inline

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

93 { return mpNormalID; }
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.)

103 { return (mpNormalID && (corner<mDegree) && mSpecified[corner]) ? true : false; }
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.

117 { if (mpNormalID && (corner<mDegree)) mSpecified.Set (corner, value); }
void Set(int i)
Definition: bitarray.h:289
void SpecifyAll ( bool  value = true)
inline

Set all normals on this face to be specified.

120 { if (value) mSpecified.SetAll(); else mSpecified.ClearAll(); }
void SetAll()
Definition: bitarray.h:275
void ClearAll()
Definition: bitarray.h:262
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).

DllExport void MakePoly ( int  degree,
int pNormalID 
)
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.

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.

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

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

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.

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

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.

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.

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

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