Dali 3D User Interface Engine
Namespaces | Classes | Functions
Dali::Internal::HitTestAlgorithm Namespace Reference

This namespace is provided for application developers to do hit test for the actors. More...

Namespaces

namespace  anonymous_namespace{hit-test-algorithm-impl.cpp}
 

Classes

struct  Results
 
struct  HitTestInterface
 Interface used by the hit-test-algorithm to determine whether the actor is hittable or whether we walk down its hierarchy. More...
 

Functions

bool HitTest (Stage &stage, const Vector2 &screenCoordinates, Dali::HitTestAlgorithm::Results &results, Dali::HitTestAlgorithm::HitTestFunction func)
 Given screen coordinates, this method returns the hit actor & the local coordinates relative to the top-left (0.0f, 0.0f, 0.5f) of the actor. More...
 
bool HitTest (Stage &stage, const Vector2 &screenCoordinates, Results &results, HitTestInterface &hitTestInterface)
 Given screen coordinates, this method returns the hit actor & the local coordinates relative to the actor etc. More...
 
bool HitTest (Stage &stage, const Vector2 &screenCoordinates, Results &results)
 Default HitTest where we check if a touch is required. More...
 
bool HitTest (Stage &stage, RenderTask &renderTask, const Vector2 &screenCoordinates, Dali::HitTestAlgorithm::Results &results, Dali::HitTestAlgorithm::HitTestFunction func)
 Hit test specific to a given RenderTask. More...
 

Detailed Description

This namespace is provided for application developers to do hit test for the actors.

Function Documentation

bool Dali::Internal::HitTestAlgorithm::HitTest ( Stage &  stage,
const Vector2 &  screenCoordinates,
Dali::HitTestAlgorithm::Results results,
Dali::HitTestAlgorithm::HitTestFunction  func 
)

Given screen coordinates, this method returns the hit actor & the local coordinates relative to the top-left (0.0f, 0.0f, 0.5f) of the actor.

An actor is only hittable if the actor meets all the conditions defined by the given function (see HitTestAlgorithm).

Typically, if an actor has a zero size or its world color is fully transparent, it should not be hittable; and if an actor's visibility flag is unset, its children should not be hittable either.

Parameters
[in]stageThe stage.
[in]screenCoordinatesThe screen coordinates.
[out]resultsThe results of the hit-test, only modified if something is hit
[in]funcThe function to use in the hit-test algorithm.
Returns
true if something was hit

Definition at line 603 of file hit-test-algorithm-impl.cpp.

References Dali::Internal::HitTestAlgorithm::Results::actor, Dali::HitTestAlgorithm::Results::actor, Dali::Internal::HitTestAlgorithm::Results::actorCoordinates, Dali::HitTestAlgorithm::Results::actorCoordinates, Dali::Internal::Stage::GetLayerList(), Dali::Internal::Stage::GetRenderTaskList(), and Dali::Internal::HitTestAlgorithm::anonymous_namespace{hit-test-algorithm-impl.cpp}::HitTestForEachRenderTask().

Referenced by Dali::HitTestAlgorithm::HitTest(), Dali::Internal::GestureProcessor::HitTest(), HitTest(), Dali::Internal::HoverEventProcessor::ProcessHoverEvent(), Dali::Internal::TouchEventProcessor::ProcessTouchEvent(), and Dali::Internal::WheelEventProcessor::ProcessWheelEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Dali::Internal::HitTestAlgorithm::HitTest ( Stage &  stage,
const Vector2 &  screenCoordinates,
Results &  results,
HitTestInterface &  hitTestInterface 
)

Given screen coordinates, this method returns the hit actor & the local coordinates relative to the actor etc.

Parameters
[in]stageThe stage.
[in]screenCoordinatesThe screen coordinates.
[out]resultsThe results of the hit-test.
[in]hitTestInterfaceUsed to determine whether the actor is hit or whether we walk down its hierarchy
Returns
true if something was hit

Hit Test Algorithm:

  • The system overlay RenderTaskList is hit-tested first.
  • If no hit then the regular RenderTaskList is used to hit test the on stage actors.
  • The bulk of the hit test algorithm is described in Dali::Actor.
  • In each RenderTask's its viewing parameters (the view and projection matrices, and the viewport) are used to build a picking ray into the scene which is used for our ray tests when hit testing an actor within each layer.
  • If an actor is deemed to be hittable, then a quicker ray sphere test on the actor is performed first to determine if the ray is in the actor's proximity.
  • If this is also successful, then a more accurate ray test is performed to see if we have a hit.
Note
Currently, we prefer a child hit over a parent (regardless of the distance from the camera) unless the parent is a RenderableActor but this is subject to change.

Definition at line 621 of file hit-test-algorithm-impl.cpp.

References Dali::Internal::Stage::GetLayerList(), Dali::Integration::SystemOverlay::GetOverlayRenderTasks(), Dali::Internal::Stage::GetRenderTaskList(), Dali::Internal::Stage::GetSystemOverlayInternal(), and Dali::Internal::HitTestAlgorithm::anonymous_namespace{hit-test-algorithm-impl.cpp}::HitTestForEachRenderTask().

Here is the call graph for this function:

bool Dali::Internal::HitTestAlgorithm::HitTest ( Stage &  stage,
const Vector2 &  screenCoordinates,
Results &  results 
)

Default HitTest where we check if a touch is required.

Parameters
[in]stageThe stage.
[in]screenCoordinatesThe screen coordinates.
[out]resultsThe results of the hit-test.
Returns
true if something was hit
See Also
HitTest(Stage&, const Vector2&, Results&, HitTestInterface&)

Definition at line 647 of file hit-test-algorithm-impl.cpp.

References HitTest().

Here is the call graph for this function:

bool Dali::Internal::HitTestAlgorithm::HitTest ( Stage &  stage,
RenderTask &  renderTask,
const Vector2 &  screenCoordinates,
Dali::HitTestAlgorithm::Results results,
Dali::HitTestAlgorithm::HitTestFunction  func 
)

Hit test specific to a given RenderTask.

Parameters
[in]stageThe stage.
[in]renderTaskThe render task for hit test
[in]screenCoordinatesThe screen coordinates.
[out]resultsThe results of the hit-test.
[in]funcThe function to use in the hit-test algorithm.
Returns
true if something was hit

Definition at line 653 of file hit-test-algorithm-impl.cpp.

References Dali::HitTestAlgorithm::Results::actor, Dali::HitTestAlgorithm::Results::actorCoordinates, Dali::Internal::RenderTaskList::GetExclusivesList(), Dali::Internal::Stage::GetLayerList(), Dali::Internal::Stage::GetRenderTaskList(), and Dali::Internal::HitTestAlgorithm::anonymous_namespace{hit-test-algorithm-impl.cpp}::HitTestRenderTask().

Here is the call graph for this function:

Dali Docs Home
Read more about Dali