2 * Copyright (c) 2024 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali-scene3d/public-api/light/light.h>
22 #include <dali-scene3d/internal/light/light-impl.h>
32 Light::Light(const Light& light) = default;
34 Light::Light(Light&& rhs) noexcept = default;
36 Light& Light::operator=(const Light& light) = default;
38 Light& Light::operator=(Light&& rhs) noexcept = default;
46 return Internal::Light::New();
49 Light Light::DownCast(BaseHandle handle)
53 CustomActor custom = Dali::CustomActor::DownCast(handle);
56 CustomActorImpl& customImpl = custom.GetImplementation();
58 Internal::Light* impl = dynamic_cast<Internal::Light*>(&customImpl);
62 result = Light(customImpl.GetOwner());
69 void Light::Enable(bool enable)
71 Internal::GetImplementation(*this).Enable(enable);
74 bool Light::IsEnabled() const
76 return Internal::GetImplementation(*this).IsEnabled();
79 uint32_t Light::GetMaximumEnabledLightCount()
81 return Internal::Light::GetMaximumEnabledLightCount();
84 void Light::EnableShadow(bool enable)
86 Internal::GetImplementation(*this).EnableShadow(enable);
89 bool Light::IsShadowEnabled() const
91 return Internal::GetImplementation(*this).IsShadowEnabled();
94 void Light::EnableShadowSoftFiltering(bool useSoftFiltering)
96 Internal::GetImplementation(*this).EnableShadowSoftFiltering(useSoftFiltering);
99 bool Light::IsShadowSoftFilteringEnabled() const
101 return Internal::GetImplementation(*this).IsShadowSoftFilteringEnabled();
104 void Light::SetShadowIntensity(float shadowIntensity)
106 Internal::GetImplementation(*this).SetShadowIntensity(shadowIntensity);
109 float Light::GetShadowIntensity() const
111 return Internal::GetImplementation(*this).GetShadowIntensity();
114 void Light::SetShadowBias(float shadowBias)
116 Internal::GetImplementation(*this).SetShadowBias(shadowBias);
119 float Light::GetShadowBias() const
121 return Internal::GetImplementation(*this).GetShadowBias();
124 Light::Light(Internal::Light& implementation)
125 : Control(implementation)
129 Light::Light(Dali::Internal::CustomActor* internal)
132 // Can have a NULL pointer so we only need to check if the internal implementation is our class
133 // when there is a value.
136 DALI_ASSERT_DEBUG(dynamic_cast<Internal::Light*>(&CustomActor(internal).GetImplementation()));
140 } // namespace Scene3D