HitRecord Class Reference
 
 
 
HitRecord Class Reference

This reference page is linked to from the following overview topics: Modifier Selection Methods, Sub-Object Hit Testing.


#include <object.h>

Inheritance diagram for HitRecord:
MaxHeapOperators

Class Description

This class provides a data structure used during sub-object hit-testing.

See also:
Class HitLog, Class HitData

Public Member Functions

  HitRecord ()
  Default Constructor.
  HitRecord (INode *nr, ModContext *mc, DWORD d, ulong inf, HitData *hitdat)
  Constructor.
  HitRecord (HitRecord *n, INode *nr, ModContext *mc, DWORD d, ulong inf, HitData *hitdat)
  Constructor.
HitRecord Next ()
  Each HitRecord maintains a pointer to another HitRecord.
CoreExport  ~HitRecord ()
  Destructor.

Public Attributes

INode nodeRef
  Points to the node that was hit.
ModContext modContext
  Points to the ModContext of the modifier.
DWORD  distance
  The 'distance' of the hit.
ulong  hitInfo
  A general unsigned long value.
HitData hitData
  In case 4 bytes in hitInfo is not enough space to identity the sub-object element, this pointer is available.

Friends

class  HitLog

Constructor & Destructor Documentation

HitRecord ( ) [inline]

Default Constructor.

Initializes all members to NULL.

{ next = NULL; modContext = NULL; distance = 0; hitInfo = 0; hitData = NULL;}
HitRecord ( INode nr,
ModContext mc,
DWORD  d,
ulong  inf,
HitData hitdat 
) [inline]

Constructor.

The data members are initialized to the data passed.

                                                                                  {
                next = NULL;
                nodeRef = nr; modContext = mc; distance = d; hitInfo = inf; hitData = hitdat;
        }
HitRecord ( HitRecord n,
INode nr,
ModContext mc,
DWORD  d,
ulong  inf,
HitData hitdat 
) [inline]

Constructor.

The data members are initialized to the data passed.

                                                                                               {
                next = n;
                nodeRef = nr; modContext = mc; distance = d; hitInfo = inf; hitData = hitdat;
        }
CoreExport ~HitRecord ( )

Destructor.

If HitData has been allocated, it is deleted as well.


Member Function Documentation

HitRecord* Next ( ) [inline]

Each HitRecord maintains a pointer to another HitRecord.

This method returns the next hit record.

{ return next; }

Friends And Related Function Documentation

friend class HitLog [friend]

Member Data Documentation

Points to the node that was hit.

DWORD distance

The 'distance' of the hit.

To classify as a hit, the sub-object component must be within some threshold distance of the mouse. This distance is recorded in the hit record so that the closest of all the hits can be identified. What the distance actually represents depends on the rendering level of the viewport. For wire frame 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.

A general unsigned long value.

Most modifiers will just need this to identity the sub-object element. The edit mesh modifier uses the value to store the index of the vertex or face that was hit for example.

In case 4 bytes in hitInfo is not enough space to identity the sub-object element, this pointer is available.

To use this, a developer would define a class derived from HitData that would contain the necessary data. The HitData class has one member function, a virtual destructor, so the derived class can be properly deleted when the HitRecord instance is deleted by the system.