[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-physics / integration-api / physics-world.cpp
1 /*
2  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <dali-physics/integration-api/physics-world.h>
18 #include <dali-physics/internal/physics-world-impl.h>
19 #include <dali/public-api/common/dali-common.h>
20
21 namespace Dali::Toolkit::Physics::Integration
22 {
23 PhysicsWorld::PhysicsWorld(Dali::Toolkit::Physics::Internal::PhysicsWorld* internalWorld)
24 : impl(internalWorld)
25 {
26 }
27
28 PhysicsWorld::~PhysicsWorld() = default;
29
30 Dali::Toolkit::Physics::Internal::PhysicsWorld* PhysicsWorld::GetImpl()
31 {
32   return impl;
33 }
34
35 void PhysicsWorld::Lock()
36 {
37   DALI_ASSERT_ALWAYS(impl && "Physics world proxy has null impl");
38   impl->Lock();
39 }
40
41 void PhysicsWorld::Unlock()
42 {
43   DALI_ASSERT_ALWAYS(impl && "Physics world proxy has null impl");
44   impl->Unlock();
45 }
46
47 Dali::Any PhysicsWorld::GetNative()
48 {
49   DALI_ASSERT_ALWAYS(impl && "Physics world proxy has null impl");
50   return impl->GetNative();
51 }
52
53 Dali::Any PhysicsWorld::HitTest(Dali::Vector3 rayFromWorld, Dali::Vector3 rayToWorld, Dali::Any nativeFilter, Dali::Vector3& localPivot, float& distanceFromCamera)
54
55 {
56   DALI_ASSERT_ALWAYS(impl && "Physics world proxy has null impl");
57   return impl->HitTest(rayFromWorld, rayToWorld, nativeFilter, localPivot, distanceFromCamera);
58 }
59
60 } // namespace Dali::Toolkit::Physics::Integration