Class HitLog

3DS Max Plug-In SDK

Class HitLog

See Also: Class HitRecord, Class HitData.

class HitLog

Description:

This class provides a data structure for keeping a log of hits during sub-object hit-testing. It provides a list of HitRecords that may be added to and cleared. A developer may also request the 'closest' hit record in the list.

Methods:

Prototype:

HitLog();

Remarks:

Constructor. The list of HitRecords is set to NULL.

Prototype:

~HitLog();

Remarks:

Destructor. Clears the hit log.

Prototype:

void Clear();

Remarks:

Clears the log of hits by deleting the list of HitRecords.

Prototype:

HitRecord* First();

Remarks:

Implemented by the System.

Returns the first HitRecord.

Prototype:

HitRecord* ClosestHit();

Remarks:

Implemented by the System.

Returns the HitRecord that was 'closest' to the mouse position when hit testing was performed. This is the HitRecord with the minimum distance.

Prototype:

void LogHit(INode *nr, ModContext *mc,

DWORD dist, ulong info, HitData *hitdat = NULL);

Remarks:

Implemented by the System.

This method is called to log a hit. It creates a new HitRecord object using the data passed and adds it to the hit log.

Parameters:

INode *nr

The node that was hit.

ModContext *mc

The ModContext of the modifier.

DWORD dist

The 'distance' of the hit. What the distance actually represents depends on the rendering level of the viewport. For wireframe modes, it refers to the distance in the screen XY plane from the mouse to the sub-object component. In a shaded mode, it refers to the Z depth of the sub-object component. In both cases, smaller values indicate that the sub-object component is 'closer' to the mouse cursor.

ulong info

Identifies the sub-object component that was hit.

HitData *hitdat = NULL

If the info field is insufficient to indicate the sub-object component that was hit, pass an instance of the HitData class that contains the needed information.