VertexNormal Class Reference
 
 
 
VertexNormal Class Reference

#include <VertexNormal.h>

Inheritance diagram for VertexNormal:
MaxHeapOperators

Class Description

The class used to compute vertex normals considering smoothing.

Public Member Functions

  VertexNormal ()
  Default Constructor.
  VertexNormal (Point3 &n, DWORD s)
  Constructor.
  VertexNormal (const VertexNormal &copyVNormal)
  Copy Constructor.
VertexNormal operator= (const VertexNormal &from)
  Assignment operator.
virtual  ~VertexNormal ()
  Destructor.
void  AddNormal (Point3 &n, DWORD s)
  Add a normal to the list if the smoothing group bits overlap, otherwise create a new vertex normal in the list.
Point3 GetNormal (DWORD s)
  Retrieves a normal if the smoothing groups overlap or there is only one in the list.
void  Normalize ()
  Normalize each normal in the list.

Public Attributes

Point3  norm
  The normal.
DWORD  smooth
  The smoothing groups.
VertexNormal next
  A pointer to the next normal -- this class is a linked list.
BOOL  init
  The init variable is used as a flag to indicate if the first normal in the list has been initialized.

Constructor & Destructor Documentation

Default Constructor.

VertexNormal ( Point3 n,
DWORD  s 
)

Constructor.

Parameters:
n - The vertex normal vector
s - The ID of the smoothing group
VertexNormal ( const VertexNormal copyVNormal )

Copy Constructor.

virtual ~VertexNormal ( ) [virtual]

Destructor.


Member Function Documentation

VertexNormal& operator= ( const VertexNormal from )

Assignment operator.

void AddNormal ( Point3 n,
DWORD  s 
)

Add a normal to the list if the smoothing group bits overlap, otherwise create a new vertex normal in the list.

It is used when a face is going to add its normal to a vertex. This method is passed the normal and the smoothing information for that face. It checks if the normal passed shares smoothing information with the existing normal. If it does, the normal is added in, and the smoothing bits are bitwise OR-ed in. If it does not, a new vertex normal is created.

Parameters:
n The new normal to be added.
s The smoothing group information.
Point3& GetNormal ( DWORD  s )

Retrieves a normal if the smoothing groups overlap or there is only one in the list.

Parameters:
s The smoothing group information.
Returns:
The Normal
void Normalize ( )

Normalize each normal in the list.


Member Data Documentation

DWORD smooth

The smoothing groups.

A pointer to the next normal -- this class is a linked list.

BOOL init

The init variable is used as a flag to indicate if the first normal in the list has been initialized.