Class TriObject

3DS Max Plug-In SDK

Class TriObject

See Also: Class GeomObject, Class ClassDesc, Class Mesh, Class TessApprox.

class TriObject : public GeomObject

Description:

This class represents a renderable, deformable, triangle mesh object. All procedural objects must be able to convert themselves to TriObjects. This class provides implementations of all the required methods of Animatable, ReferenceMaker, ReferenceTarget, Base Object, Object, and GeomObject. All methods of this class are implemented by the system.

Data Members:

public:

Mesh mesh;

This is the mesh of the TriObject. See Class Mesh for methods to manipulate this mesh.

The following data members are used by the Displacement Mapping mechanism in 3ds max.

TessApprox mDispApprox;

The object which describes the properties of the tesselation approximation of the mesh.

bool mSubDivideDisplacement;

The subdivision displacement flag. When TRUE, displacement mapping mechanism subdivides mesh faces to accurately displace the map, using the method and settings you specify in the Subdivision Presets and Subdivision Method group boxes. When FALSE, the modifier applies the map by moving vertices in the mesh, the way the Displace modifier does.

bool mDisableDisplacement;

TRUE to disable displacement mapping; FALSE to enable it.

bool mSplitMesh;

The split mesh flag. This flag affects texture mapping as done by the displacement mapping mechanism. When on, the modifier splits the mesh into individual faces before displacing them: this helps preserve texture mapping. When off, the modifier uses an internal method to assign texture mapping. Default=On.

Methods:

Prototype:

Mesh& GetMesh();

Remarks:

This method is available in release 3.0 and later only.

Returns a reference to the mesh data member of this TriObject.

Prototype:

TessApprox& DisplacmentApprox();

Remarks:

This method is available in release 3.0 and later only.

Returns a reference to the mDispApprox data member.

Prototype:

bool& DoSubdivisionDisplacment();

Remarks:

This method is available in release 3.0 and later only.

Returns a reference to the boolean mSubDivideDisplacement data member.

Prototype:

bool& SplitMeshForDisplacement();

Remarks:

This method is available in release 3.0 and later only.

Returns a reference to the boolean mSplitMesh data member.

Prototype:

void SetDisplacmentApproxToPreset(int preset);

Remarks:

This method is available in release 3.0 and later only.

This method is used internally to set the mDispApprox data member to one of the low/medium/high subdivision presets.

Prototype:

void DisableDisplacementMapping(BOOL disable);

Remarks:

This method is available in release 3.0 and later only.

Sets the mDisableDisplacement data member to the given state.

Parameters:

BOOL disable

TRUE to disable; FALSE to enable.

Related Functions:

There are several global functions (not part of class TriObject) for dealing with TriObjects and the control of standard TriObject versus Editable TriObjects. These functions are described below:

Function:

TriObject *CreateNewTriObject();

Remarks:

This method is used to create a new TriObject. Use this instead of new TriObject. It will use the registered descriptor if one is registered, otherwise you'll get a default TriObject.

Function:

ClassDesc* GetTriObjDescriptor();

Remarks:

Returns a pointer to the class descriptor for the regular, standard TriObject.

Function:

ClassDesc* GetEditTriObjDesc();

Remarks:

Returns a pointer to the class descriptor for the editable TriObject. It returns the default if none has been registered. See below.

Function:

void RegisterEditTriObjDesc(ClassDesc* desc);

Remarks:

A new descriptor can be registered to replace the default TriObject descriptor. This new descriptor will then be used to create TriObjects.

Parameters:

ClassDesc* desc

The class descriptor to replace the default TriObject descriptor.