Merge "Updated FrameCallback to return value to specify whether we should keep render...
[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
26 {
27 namespace Scene3D
28 {
29 Model::Model()
30 {
31 }
32
33 Model::Model(const Model& model) = default;
34
35 Model::Model(Model&& rhs) noexcept = default;
36
37 Model& Model::operator=(const Model& model) = default;
38
39 Model& Model::operator=(Model&& rhs) noexcept = default;
40
41 Model::~Model()
42 {
43 }
44
45 Model Model::New(const std::string& modelUrl, const std::string& resourceDirectoryUrl)
46 {
47   return Internal::Model::New(modelUrl, resourceDirectoryUrl);
48 }
49
50 Model Model::DownCast(BaseHandle handle)
51 {
52   return Control::DownCast<Model, Internal::Model>(handle);
53 }
54
55 Model::Model(Internal::Model& implementation)
56 : Control(implementation)
57 {
58 }
59
60 Model::Model(Dali::Internal::CustomActor* internal)
61 : Control(internal)
62 {
63   VerifyCustomActorPointer<Internal::Model>(internal);
64 }
65
66 const ModelNode Model::GetModelRoot() const
67 {
68   return GetImpl(*this).GetModelRoot();
69 }
70
71 void Model::AddModelNode(ModelNode modelNode)
72 {
73   return GetImpl(*this).AddModelNode(modelNode);
74 }
75
76 void Model::RemoveModelNode(ModelNode modelNode)
77 {
78   return GetImpl(*this).RemoveModelNode(modelNode);
79 }
80
81 void Model::SetChildrenSensitive(bool enable)
82 {
83   GetImpl(*this).SetChildrenSensitive(enable);
84 }
85
86 bool Model::GetChildrenSensitive() const
87 {
88   return GetImpl(*this).GetChildrenSensitive();
89 }
90
91 void Model::SetChildrenFocusable(bool enable)
92 {
93   GetImpl(*this).SetChildrenFocusable(enable);
94 }
95
96 bool Model::GetChildrenFocusable() const
97 {
98   return GetImpl(*this).GetChildrenFocusable();
99 }
100
101 void Model::SetImageBasedLightSource(const std::string& diffuseUrl, const std::string& specularUrl, float scaleFactor)
102 {
103   GetImpl(*this).SetImageBasedLightSource(diffuseUrl, specularUrl, scaleFactor);
104 }
105
106 void Model::SetImageBasedLightScaleFactor(float scaleFactor)
107 {
108   GetImpl(*this).SetImageBasedLightScaleFactor(scaleFactor);
109 }
110
111 float Model::GetImageBasedLightScaleFactor() const
112 {
113   return GetImpl(*this).GetImageBasedLightScaleFactor();
114 }
115
116 uint32_t Model::GetAnimationCount() const
117 {
118   return GetImpl(*this).GetAnimationCount();
119 }
120
121 Dali::Animation Model::GetAnimation(uint32_t index) const
122 {
123   return GetImpl(*this).GetAnimation(index);
124 }
125
126 Dali::Animation Model::GetAnimation(const std::string& name) const
127 {
128   return GetImpl(*this).GetAnimation(name);
129 }
130
131 uint32_t Model::GetCameraCount() const
132 {
133   return GetImpl(*this).GetCameraCount();
134 }
135
136 Dali::CameraActor Model::GenerateCamera(uint32_t index) const
137 {
138   return GetImpl(*this).GenerateCamera(index);
139 }
140
141 bool Model::ApplyCamera(uint32_t index, Dali::CameraActor camera) const
142 {
143   return GetImpl(*this).ApplyCamera(index, camera);
144 }
145
146 ModelNode Model::FindChildModelNodeByName(std::string_view nodeName)
147 {
148   return GetImpl(*this).FindChildModelNodeByName(nodeName);
149 }
150
151 void Model::RetrieveBlendShapeNames(std::vector<std::string>& blendShapeNames) const
152 {
153   GetImpl(*this).RetrieveBlendShapeNames(blendShapeNames);
154 }
155
156 void Model::RetrieveModelNodesByBlendShapeName(std::string_view blendShapeName, std::vector<ModelNode>& modelNodes) const
157 {
158   GetImpl(*this).RetrieveModelNodesByBlendShapeName(blendShapeName, modelNodes);
159 }
160
161 Dali::Animation Model::GenerateMotionDataAnimation(MotionData motionData)
162 {
163   return GetImpl(*this).GenerateMotionDataAnimation(motionData);
164 }
165
166 void Model::SetMotionData(MotionData motionData)
167 {
168   GetImpl(*this).SetMotionData(motionData);
169 }
170
171 } // namespace Scene3D
172
173 } // namespace Dali