Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / internal / event / events / hit-test-algorithm-impl.h
1 #ifndef __DALI_INTERNAL_HIT_TEST_ALGORITHM_H__
2 #define __DALI_INTERNAL_HIT_TEST_ALGORITHM_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //     http://floralicense.org/license/
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19
20 // INTERNAL INCLUDES
21 #include <dali/public-api/events/hit-test-algorithm.h>
22 #include <dali/public-api/render-tasks/render-task.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 /**
31  * This namespace is provided for application developers to do hit test for the actors.
32  */
33 namespace HitTestAlgorithm
34 {
35
36 struct Results
37 {
38   Dali::RenderTask renderTask;       ///< The render-task displaying the actor.
39   Dali::Actor      actor;            ///< The hit actor.
40   Vector2          actorCoordinates; ///< The actor coordinates.
41   Vector4          rayOrigin;        ///< The point of origin of the ray.
42   Vector4          rayDirection;     ///< The direction vector of the ray.
43 };
44
45 /**
46  * @copydoc Dali::HitTestAlgorithm::HitTest(Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func )
47  */
48 void HitTest( Stage& stage, const Vector2& screenCoordinates, Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func );
49
50 /**
51  * Given screen coordinates, this method returns the hit actor & the local coordinates relative to the actor etc.
52  * @param[in] stage The stage.
53  * @param[in] screenCoordinates The screen coordinates.
54  * @param[out] results The results of the hit-test.
55  *
56  * <h3>Hit Test Algorithm:</h3>
57  *
58  * - The system overlay RenderTaskList is hit-tested first.
59  * - If no hit then the regular RenderTaskList is used to hit test the on stage actors.
60  * - The bulk of the hit test algorithm is described in Dali::Actor.
61  * - In each RenderTask's its viewing parameters (the view and projection matrices, and the viewport)
62  *   are used to build a picking ray into the scene which is used for our ray tests when hit testing
63  *   an actor within each layer.
64  * - If an actor is deemed to be hittable, then a quicker ray sphere test on the actor is performed
65  *   first to determine if the ray is in the actor's proximity.
66  * - If this is also successful, then a more accurate ray test is performed to see if we have a hit.
67  *
68  * - NOTE: Currently, we prefer a child hit over a parent (regardless of the distance from the
69  *   camera) unless the parent is a RenderableActor but this is subject to change.
70  */
71 void HitTest( Stage& stage, const Vector2& screenCoordinates, Results& results );
72
73 /**
74  * Hit test specific to a given RenderTask
75  * @param[in] stage The stage.
76  * @param[in] renderTask The render task for hit test
77  * @param[in] screenCoordinates The screen coordinates.
78  * @param[out] results The results of the hit-test.
79  * @param[in] func The function to use in the hit-test algorithm.
80  */
81 void HitTest( Stage& stage, RenderTask& renderTask, const Vector2& screenCoordinates,
82               Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func );
83
84 } // namespace HitTestAlgorithm
85
86 } // namespace Internal
87
88 } // namespace Dali
89
90 #endif // __DALI_INTERNAL_HIT_TEST_ALGORITHM_H__