1 #ifndef DALI_INTERNAL_RAY_TEST_H
2 #define DALI_INTERNAL_RAY_TEST_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/internal/event/actors/actor-impl.h>
34 class EventThreadServices;
37 * Contains methods to perform ray tests on given actors.
39 * Stores a reference to the EventThreadServices so limit the number of times this is created
40 * to avoid repeated calls to EventThreadServices::Get().
49 /// Default Destructor
53 * Performs a ray-sphere test with the given pick-ray and the given actor's bounding sphere.
55 * @param[in] actor The actor to perform the ray-sphere test on
56 * @param[in] rayOrigin The ray origin in the world's reference system
57 * @param[in] rayDir The ray director vector in the world's reference system
58 * @return True if the ray intersects the actor's bounding sphere
60 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
62 bool SphereTest(const Internal::Actor& actor, const Vector4& rayOrigin, const Vector4& rayDir) const;
65 * Performs a ray-actor test with the given pick-ray and the given actor's geometry.
67 * @param[in] actor The actor to perform the ray-sphere test on
68 * @param[in] rayOrigin The ray origin in the world's reference system.
69 * @param[in] rayDir The ray director vector in the world's reference system.
70 * @param[out] hitPointLocal The hit point in the Actor's local reference system.
71 * @param[out] distance The distance from the hit point to the camera.
72 * @return True if the ray intersects the actor's geometry.
74 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
76 bool ActorTest(const Internal::Actor& actor, const Vector4& rayOrigin, const Vector4& rayDir, Vector2& hitPointLocal, float& distance) const;
79 const EventThreadServices& mEventThreadServices;
82 } // namespace Internal
86 #endif // DALI_INTERNAL_RAY_TEST_H