Revert "[Tizen] Not execute the remove callback"
[platform/core/uifw/dali-core.git] / dali / internal / event / events / ray-test.h
1 #ifndef DALI_INTERNAL_RAY_TEST_H
2 #define DALI_INTERNAL_RAY_TEST_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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
21 // CLASS HEADER
22 #include <dali/internal/event/actors/actor-impl.h>
23
24 namespace Dali
25 {
26 struct Vector2;
27 struct Vector4;
28
29 namespace Internal
30 {
31 class Actor;
32 class EventThreadServices;
33
34 /**
35  * Contains methods to perform ray tests on given actors.
36  *
37  * Stores a reference to the EventThreadServices so limit the number of times this is created
38  * to avoid repeated calls to EventThreadServices::Get().
39  */
40 class RayTest
41 {
42 public:
43   /// Constructor
44   RayTest();
45
46   /// Default Destructor
47   ~RayTest() = default;
48
49   /**
50    * Performs a ray-sphere test with the given pick-ray and the given actor's bounding sphere.
51    *
52    * @param[in] actor The actor to perform the ray-sphere test on
53    * @param[in] rayOrigin The ray origin in the world's reference system
54    * @param[in] rayDir The ray director vector in the world's reference system
55    * @return True if the ray intersects the actor's bounding sphere
56    *
57    * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
58    */
59   bool SphereTest(const Internal::Actor& actor, const Vector4& rayOrigin, const Vector4& rayDir) const;
60
61   /**
62    * Performs a ray-actor test with the given pick-ray and the given actor's geometry.
63    *
64    * @param[in] actor The actor to perform the ray-sphere test on
65    * @param[in] rayOrigin The ray origin in the world's reference system.
66    * @param[in] rayDir The ray director vector in the world's reference system.
67    * @param[out] hitPointLocal The hit point in the Actor's local reference system.
68    * @param[out] distance The distance from the hit point to the camera.
69    * @return True if the ray intersects the actor's geometry.
70    *
71    * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
72    */
73   bool ActorTest(const Internal::Actor& actor, const Vector4& rayOrigin, const Vector4& rayDir, Vector2& hitPointLocal, float& distance) const;
74
75 private:
76   const EventThreadServices& mEventThreadServices;
77 };
78
79 } // namespace Internal
80
81 } // namespace Dali
82
83 #endif // DALI_INTERNAL_RAY_TEST_H