Class RNormal

3DS Max Plug-In SDK

Class RNormal

See Also: Class Mesh, Class RVertex, Class GraphicsWindow.

class RNormal

Description:

The 'rendered' normal class. RNormals are stored as unit vectors in object space. An instance of this class is maintained by the RVertex class since the RVertex is what gets rendered (lit), and the lighting methods need to know about the normals. All methods of this class are implemented by the system.

Note: This class is used internally by 3ds max. Developers who need to compute face and vertex normals for a mesh should instead refer to the Advanced Topics section Computing Face and Vertex Normals.

Data Members:

private:

Point3 normal;

The normal as a unit vector. Note that if you set this normal, you should call the method normalize() if you are not sure the normal is already unit length.

DWORD smGroup;

The smoothing group. Normals are attached to smoothing groups in the sense that one vertex, if it is shared by two triangles with different smoothing groups, will have two normals associated with it -- one for each smoothing group.

MtlID mtlIndex;

The material index. If one vertex is shared between two materials, there will be two normals. Therefore the material index is stored with the normal as well.

Note: typedef unsigned short MtlID;

Point3 rgb;

The RGB value.

Methods:

Prototype:

RNormal();

Remarks:

Constructor. The smoothing group and material index are set to zero.

Prototype:

void setNormal(const Point3 &nor);

Remarks:

Sets the normal to the specified value.

Parameters:

const Point3 &nor

The normal value to set.

Prototype:

void addNormal(const Point3 &nor);

Remarks:

Adds the specified value to the value of the normal.

Parameters:

const Point3 &nor

The normal value to add to the existing value.

Prototype:

void normalize();

Remarks:

Converts the normal to a unit vector.

Prototype:

Point3 &getNormal();

Remarks:

Returns the normal.

Prototype:

void setSmGroup(DWORD g);

Remarks:

Sets the smoothing group to the specified value.

Parameters:

DWORD g

The smoothing group value to set.

Prototype:

void addSmGroup(DWORD g);

Remarks:

ORs the specified smoothing group value to the existing value.

Parameters:

DWORD g

The smoothing group bits to set.

Prototype:

DWORD getSmGroup();

Remarks:

Returns the smoothing group value.

Prototype:

void setMtlIndex(MtlID i);

Remarks:

Sets the material index to the specified value.

Parameters:

MtlID i

The material index value to set.

Prototype:

MtlID getMtlIndex();

Remarks:

Returns the material index.

Prototype:

void setRGB(Point3 &clr);

Remarks:

Sets the RGB value.

Parameters:

Point3 &clr

The RGB color to set.

Prototype:

Point3 &getRGB();

Remarks:

Returns the RGB value.