[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / controls / model / model.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/controls/model/model.h>
20
21 // INTERNAL INCLUDES
22 #include <dali-scene3d/internal/controls/model/model-impl.h>
23 #include <dali-scene3d/public-api/model-components/model-node.h>
24
25 namespace Dali::Scene3D
26 {
27 Model::Model() = default;
28
29 Model::Model(const Model& model) = default;
30
31 Model::Model(Model&& rhs) noexcept = default;
32
33 Model& Model::operator=(const Model& model) = default;
34
35 Model& Model::operator=(Model&& rhs) noexcept = default;
36
37 Model::~Model() = default;
38
39 Model Model::New(const std::string& modelUrl, const std::string& resourceDirectoryUrl)
40 {
41   return Internal::Model::New(modelUrl, resourceDirectoryUrl);
42 }
43
44 Model Model::DownCast(BaseHandle handle)
45 {
46   return Control::DownCast<Model, Internal::Model>(handle);
47 }
48
49 Model::Model(Internal::Model& implementation)
50 : Control(implementation)
51 {
52 }
53
54 Model::Model(Dali::Internal::CustomActor* internal)
55 : Control(internal)
56 {
57   VerifyCustomActorPointer<Internal::Model>(internal);
58 }
59
60 const ModelNode Model::GetModelRoot() const
61 {
62   return GetImpl(*this).GetModelRoot();
63 }
64
65 void Model::AddModelNode(ModelNode modelNode)
66 {
67   return GetImpl(*this).AddModelNode(modelNode);
68 }
69
70 void Model::RemoveModelNode(ModelNode modelNode)
71 {
72   return GetImpl(*this).RemoveModelNode(modelNode);
73 }
74
75 void Model::SetChildrenSensitive(bool enable)
76 {
77   GetImpl(*this).SetChildrenSensitive(enable);
78 }
79
80 bool Model::GetChildrenSensitive() const
81 {
82   return GetImpl(*this).GetChildrenSensitive();
83 }
84
85 void Model::SetChildrenFocusable(bool enable)
86 {
87   GetImpl(*this).SetChildrenFocusable(enable);
88 }
89
90 bool Model::GetChildrenFocusable() const
91 {
92   return GetImpl(*this).GetChildrenFocusable();
93 }
94
95 void Model::SetImageBasedLightSource(const std::string& diffuseUrl, const std::string& specularUrl, float scaleFactor)
96 {
97   GetImpl(*this).SetImageBasedLightSource(diffuseUrl, specularUrl, scaleFactor);
98 }
99
100 void Model::SetImageBasedLightScaleFactor(float scaleFactor)
101 {
102   GetImpl(*this).SetImageBasedLightScaleFactor(scaleFactor);
103 }
104
105 float Model::GetImageBasedLightScaleFactor() const
106 {
107   return GetImpl(*this).GetImageBasedLightScaleFactor();
108 }
109
110 uint32_t Model::GetAnimationCount() const
111 {
112   return GetImpl(*this).GetAnimationCount();
113 }
114
115 Dali::Animation Model::GetAnimation(uint32_t index) const
116 {
117   return GetImpl(*this).GetAnimation(index);
118 }
119
120 Dali::Animation Model::GetAnimation(const std::string& name) const
121 {
122   return GetImpl(*this).GetAnimation(name);
123 }
124
125 uint32_t Model::GetCameraCount() const
126 {
127   return GetImpl(*this).GetCameraCount();
128 }
129
130 Dali::CameraActor Model::GenerateCamera(uint32_t index) const
131 {
132   return GetImpl(*this).GenerateCamera(index);
133 }
134
135 bool Model::ApplyCamera(uint32_t index, Dali::CameraActor camera) const
136 {
137   return GetImpl(*this).ApplyCamera(index, camera);
138 }
139
140 ModelNode Model::FindChildModelNodeByName(std::string_view nodeName)
141 {
142   return GetImpl(*this).FindChildModelNodeByName(nodeName);
143 }
144
145 void Model::RetrieveBlendShapeNames(std::vector<std::string>& blendShapeNames) const
146 {
147   GetImpl(*this).RetrieveBlendShapeNames(blendShapeNames);
148 }
149
150 void Model::RetrieveModelNodesByBlendShapeName(std::string_view blendShapeName, std::vector<ModelNode>& modelNodes) const
151 {
152   GetImpl(*this).RetrieveModelNodesByBlendShapeName(blendShapeName, modelNodes);
153 }
154
155 Dali::Animation Model::GenerateMotionDataAnimation(MotionData motionData)
156 {
157   return GetImpl(*this).GenerateMotionDataAnimation(motionData);
158 }
159
160 void Model::SetMotionData(MotionData motionData)
161 {
162   GetImpl(*this).SetMotionData(motionData);
163 }
164
165 void Model::CastShadow(bool castShadow)
166 {
167   GetImpl(*this).CastShadow(castShadow);
168 }
169
170 bool Model::IsShadowCasting() const
171 {
172   return GetImpl(*this).IsShadowCasting();
173 }
174
175 void Model::ReceiveShadow(bool receiveShadow)
176 {
177   GetImpl(*this).ReceiveShadow(receiveShadow);
178 }
179
180 bool Model::IsShadowReceiving() const
181 {
182   return GetImpl(*this).IsShadowReceiving();
183 }
184
185 Model::MeshHitSignalType& Model::MeshHitSignal()
186 {
187   return GetImpl(*this).MeshHitSignal();
188 }
189
190 } // namespace Dali::Scene3D