1 #ifndef DALI_INTERNAL_RAY_TEST_H
2 #define DALI_INTERNAL_RAY_TEST_H
5 * Copyright (c) 2021 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>
32 class EventThreadServices;
35 * Contains methods to perform ray tests on given actors.
37 * Stores a reference to the EventThreadServices so limit the number of times this is created
38 * to avoid repeated calls to EventThreadServices::Get().
46 /// Default Destructor
50 * Performs a ray-sphere test with the given pick-ray and the given actor's bounding sphere.
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
57 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
59 bool SphereTest(const Internal::Actor& actor, const Vector4& rayOrigin, const Vector4& rayDir) const;
62 * Performs a ray-actor test with the given pick-ray and the given actor's geometry.
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.
71 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
73 bool ActorTest(const Internal::Actor& actor, const Vector4& rayOrigin, const Vector4& rayDir, Vector2& hitPointLocal, float& distance) const;
76 const EventThreadServices& mEventThreadServices;
79 } // namespace Internal
83 #endif // DALI_INTERNAL_RAY_TEST_H