IIntersect Class Reference Library » Intersect

#include <lib_intersect.h>

详细描述

Intersect interface.

注意
Has to be created with Alloc() and destroyed with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

私有成员函数

  IIntersect ()
  ~IIntersect ()

Alloc/Free

static IIntersect Alloc ( INTERSECTTYPE type)
static void  Free ( IIntersect *&isect)

杂项

Bool   Init ( PolygonObject *pObject)
Bool   AddObject ( PolygonObject *pObject)
void  清零 ()

Hit

Bool   Hit ( BaseDraw *bd, Float mx, Float my, Bool backfaces, IntersectHitData &hitData)
Bool   Hit (const 向量 &rayp, const 向量 &rayv, Bool backfaces, IntersectHitData &hitData)

构造函数 & 析构函数文档编制

◆  IIntersect()

IIntersect () private

◆  ~IIntersect()

~ IIntersect () private

成员函数文档编制

◆  Alloc()

static IIntersect * Alloc ( INTERSECTTYPE   type )
static

Allocates an intersect interface. Destroy the allocated intersect interface with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

参数
[in] type The intersect type: INTERSECTTYPE
返回
The allocated intersect interface, or nullptr if the allocation failed.

◆  Free()

static void Free ( IIntersect *&  isect )
static

Destructs intersect interfaces allocated with Alloc() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

参数
[in,out] isect The intersect interface to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆  Init()

Bool Init ( PolygonObject pObject )

Adds the PolygonObject pObject to the data structure for intersection testing against the triangles.

注意
Internally this calls Clear() before.
参数
[in] pObject The polygon object to set. The caller owns the pointed object.
返回
true if successful, otherwise false . (Due to not enough memory.)

◆  AddObject()

Bool AddObject ( PolygonObject pObject )

Adds another polygon object object.

参数
[in] pObject The polygon object to set. The caller owns the pointed object.
返回
true if successful, otherwise false . (Due to not enough memory.)

◆  Clear()

void Clear ( )

Clears all the data.

◆  Hit() [1/2]

Bool Hit ( BaseDraw bd ,
Float   mx ,
Float   my ,
Bool   backfaces ,
IntersectHitData hitData  
)

From a viewport cast a ray, in screen space, onto the object(s) and return any data if there was a hit.
Returns the closest hit point if multiple intersections are found.

参数
[in] bd The view that the user is casting the ray from. The caller owns the pointed view.
[in] mx The X coordinate (mouse coordinate) in screen space.
[in] my The Y coordinate (mouse coordinate) in screen space.
[in] backfaces true to allow back facing polygons to be hit tested.
If enabled and the back facing hit point is closer than the front hit point, then it is returned.
[out] hitData Filled with the intersection data if there was a hit.
返回
true if there was a hit, otherwise false .

◆  Hit() [2/2]

Bool Hit ( const 向量 rayp ,
const 向量 rayv ,
Bool   backfaces ,
IntersectHitData hitData  
)

Given a ray in object space do a hit intersection against the object(s) and return any data if there was a hit.
Return the closest hit point if multiple intersections are found.

参数
[in] rayp The starting position of the ray in object space.
[in] rayv The direction the ray is pointing.
[in] backfaces true to allow back facing polygons to be hit tested.
If enabled and the back facing hit point is closer than the front hit point, then it is returned.
[out] hitData Filled with the intersection data if there was a hit.
返回
true if there was a hit, otherwise false .