[dali_2.1.42] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / controls / model / model.cpp
1 /*
2  * Copyright (c) 2022 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/controls/model/model.h>
20
21 // INTERNAL INCLUDES
22 #include <dali-scene3d/internal/controls/model/model-impl.h>
23
24 namespace Dali
25 {
26 namespace Scene3D
27 {
28 Model::Model()
29 {
30 }
31
32 Model::Model(const Model& model) = default;
33
34 Model::Model(Model&& rhs) = default;
35
36 Model& Model::operator=(const Model& model) = default;
37
38 Model& Model::operator=(Model&& rhs) = default;
39
40 Model::~Model()
41 {
42 }
43
44 Model Model::New(const std::string& modelUrl, const std::string& resourceDirectoryUrl)
45 {
46   return Internal::Model::New(modelUrl, resourceDirectoryUrl);
47 }
48
49 Model Model::DownCast(BaseHandle handle)
50 {
51   return Control::DownCast<Model, Internal::Model>(handle);
52 }
53
54 Model::Model(Internal::Model& implementation)
55 : Control(implementation)
56 {
57 }
58
59 Model::Model(Dali::Internal::CustomActor* internal)
60 : Control(internal)
61 {
62   VerifyCustomActorPointer<Internal::Model>(internal);
63 }
64
65 const Actor Model::GetModelRoot() const
66 {
67   return GetImpl(*this).GetModelRoot();
68 }
69
70 void Model::SetImageBasedLightSource(const std::string& diffuseUrl, const std::string& specularUrl, float scaleFactor)
71 {
72   GetImpl(*this).SetImageBasedLightSource(diffuseUrl, specularUrl, scaleFactor);
73 }
74
75 void Model::SetImageBasedLightTexture(Texture diffuseTexture, Texture specularTexture, float scaleFactor)
76 {
77   GetImpl(*this).SetImageBasedLightTexture(diffuseTexture, specularTexture, scaleFactor);
78 }
79
80 void Model::SetImageBasedLightScaleFactor(float scaleFactor)
81 {
82   GetImpl(*this).SetImageBasedLightScaleFactor(scaleFactor);
83 }
84
85 float Model::GetImageBasedLightScaleFactor() const
86 {
87   return GetImpl(*this).GetImageBasedLightScaleFactor();
88 }
89
90 uint32_t Model::GetAnimationCount() const
91 {
92   return GetImpl(*this).GetAnimationCount();
93 }
94
95 Dali::Animation Model::GetAnimation(uint32_t index) const
96 {
97   return GetImpl(*this).GetAnimation(index);
98 }
99
100 Dali::Animation Model::GetAnimation(const std::string& name) const
101 {
102   return GetImpl(*this).GetAnimation(name);
103 }
104
105 } // namespace Scene3D
106
107 } // namespace Dali