RayHitID Struct Reference

#include <c4d_shader.h>

Detailed Description

The class RayHitID replaces the old Int32 value that stored information of an object/polygon.
It conveniently allows to set objects with a polygon index, or read this information.
SetSecond()/GetSecond() determine for a non-coplanar quadrangle which part of the quadrangle was stored (A-B-C or A-C-D). In case of a coplanar quadrangle "second" is not set.

Note
- Instead of if (lhit==0) write if (lhit.IsPopulated())
  • Instead of lhit=0 write lhit.Clear()

Public Member Functions

 RayHitID ()
 
 RayHitID (_DONTCONSTRUCT DC)
 
 RayHitID (const RayObject *t_rayobject, Int32 t_polygon, Bool second)
 
Bool IsEqual (const RayHitID &snd) const
 
Bool IsPopulated () const
 
void Clear ()
 
void Set (const RayObject *t_rayobject, Int32 t_polygon, Bool second)
 
const RayObjectGetObject (const VolumeData *vd) const
 
Int32 GetPolygon () const
 
Bool GetSecond () const
 
void ClearSecond ()
 
void SetSecond ()
 
void SetPrivateData (Int32 t_rayobject, Int32 t_polygon)
 
void GetPrivateData (Int32 *t_rayobject, Int32 *t_polygon) const
 

Private Attributes

Int32 rayobject
 
Int32 polygon
 

Constructor & Destructor Documentation

◆ RayHitID() [1/3]

RayHitID ( )

Default constructor.

◆ RayHitID() [2/3]

RayHitID ( _DONTCONSTRUCT  DC)
explicit

Creates an uninitialized ray hit structure.

Parameters
[in]DCDummy argument. Pass DC.

◆ RayHitID() [3/3]

RayHitID ( const RayObject t_rayobject,
Int32  t_polygon,
Bool  second 
)

Creates a ray hit structure based on the passed parameters.

Parameters
[in]t_rayobjectThe ray object.
[in]t_polygonThe polygon index.
[in]secondtrue for second part (A-C-D) of a quadrangle, false for the first part (A-B-C).

Member Function Documentation

◆ IsEqual()

Bool IsEqual ( const RayHitID snd) const

Checks if 2 ray hit structures are equal.

Parameters
[in]sndThe ray hit structure to compare with.
Returns
true if the ray hit structures are equal, otherwise false.

◆ IsPopulated()

Bool IsPopulated ( ) const

Checks if the ray hit identity is zero.

Returns
true if he ray hit identity is zero, otherwise false.

◆ Clear()

void Clear ( )

Clears the ray hit identity.

◆ Set()

void Set ( const RayObject t_rayobject,
Int32  t_polygon,
Bool  second 
)

Setups the ray hit structure.

Parameters
[in]t_rayobjectThe ray object.
[in]t_polygonThe polygon index.
[in]secondtrue for second part (A-C-D) of a quadrangle, false for the first part (A-B-C).

◆ GetObject()

const RayObject* GetObject ( const VolumeData vd) const

Retrieves the ray object of the ray hit identity for a volume data.

Parameters
[in]vdThe volume data.
Returns
The ray object, or nullptr if not available.

◆ GetPolygon()

Int32 GetPolygon ( ) const

Gets the polygon index.

Returns
The polygon index.

◆ GetSecond()

Bool GetSecond ( ) const

Checks if the polygon is the second part of a quadrangle.

Returns
true if the polygon is a second part of a quadrangle (A-C-D), false for the first part (A-B-C).

◆ ClearSecond()

void ClearSecond ( )

Sets the polygon to be a first part of a quadrangle (A-B-C).

◆ SetSecond()

void SetSecond ( )

Set the polygon to be a second part of a quadrangle (A-C-D).

◆ SetPrivateData()

void SetPrivateData ( Int32  t_rayobject,
Int32  t_polygon 
)

Sets the private data.

Parameters
[in]t_rayobjectThe ray object index.
[in]t_polygonThe polygon index.

◆ GetPrivateData()

void GetPrivateData ( Int32 t_rayobject,
Int32 t_polygon 
) const

Gets the private data.

Parameters
[out]t_rayobjectAssigned the ray object index.
[out]t_polygonAssigned the polygon index.

Member Data Documentation

◆ rayobject

Int32 rayobject
private

◆ polygon

Int32 polygon
private