Adding chipmunk implementation for physics adaptor
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / light / light.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
18 // CLASS HEADER
19 #include <dali-scene3d/public-api/light/light.h>
20
21 // INTERNAL INCLUDES
22 #include <dali-scene3d/internal/light/light-impl.h>
23
24 namespace Dali
25 {
26 namespace Scene3D
27 {
28 Light::Light()
29 {
30 }
31
32 Light::Light(const Light& light) = default;
33
34 Light::Light(Light&& rhs) noexcept = default;
35
36 Light& Light::operator=(const Light& light) = default;
37
38 Light& Light::operator=(Light&& rhs) noexcept = default;
39
40 Light::~Light()
41 {
42 }
43
44 Light Light::New()
45 {
46   return Internal::Light::New();
47 }
48
49 Light Light::DownCast(BaseHandle handle)
50 {
51   Light result;
52
53   CustomActor custom = Dali::CustomActor::DownCast(handle);
54   if(custom)
55   {
56     CustomActorImpl& customImpl = custom.GetImplementation();
57
58     Internal::Light* impl = dynamic_cast<Internal::Light*>(&customImpl);
59
60     if(impl)
61     {
62       result = Light(customImpl.GetOwner());
63     }
64   }
65
66   return result;
67 }
68
69 void Light::Enable(bool enable)
70 {
71   Internal::GetImplementation(*this).Enable(enable);
72 }
73
74 bool Light::IsEnabled() const
75 {
76   return Internal::GetImplementation(*this).IsEnabled();
77 }
78
79 uint32_t Light::GetMaximumEnabledLightCount()
80 {
81   return Internal::Light::GetMaximumEnabledLightCount();
82 }
83
84 Light::Light(Internal::Light& implementation)
85 : CustomActor(implementation)
86 {
87 }
88
89 Light::Light(Dali::Internal::CustomActor* internal)
90 : CustomActor(internal)
91 {
92   // Can have a NULL pointer so we only need to check if the internal implementation is our class
93   // when there is a value.
94   if(internal)
95   {
96     DALI_ASSERT_DEBUG(dynamic_cast<Internal::Light*>(&CustomActor(internal).GetImplementation()));
97   }
98 }
99
100 } // namespace Scene3D
101
102 } // namespace Dali