2 * Copyright (c) 2023 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/controls/model/model.h>
22 #include <dali-scene3d/internal/controls/model/model-impl.h>
23 #include <dali-scene3d/public-api/model-components/model-node.h>
25 namespace Dali::Scene3D
27 Model::Model() = default;
29 Model::Model(const Model& model) = default;
31 Model::Model(Model&& rhs) noexcept = default;
33 Model& Model::operator=(const Model& model) = default;
35 Model& Model::operator=(Model&& rhs) noexcept = default;
37 Model::~Model() = default;
39 Model Model::New(const std::string& modelUrl, const std::string& resourceDirectoryUrl)
41 return Internal::Model::New(modelUrl, resourceDirectoryUrl);
44 Model Model::DownCast(BaseHandle handle)
46 return Control::DownCast<Model, Internal::Model>(handle);
49 Model::Model(Internal::Model& implementation)
50 : Control(implementation)
54 Model::Model(Dali::Internal::CustomActor* internal)
57 VerifyCustomActorPointer<Internal::Model>(internal);
60 const ModelNode Model::GetModelRoot() const
62 return GetImpl(*this).GetModelRoot();
65 void Model::AddModelNode(ModelNode modelNode)
67 return GetImpl(*this).AddModelNode(modelNode);
70 void Model::RemoveModelNode(ModelNode modelNode)
72 return GetImpl(*this).RemoveModelNode(modelNode);
75 void Model::SetChildrenSensitive(bool enable)
77 GetImpl(*this).SetChildrenSensitive(enable);
80 bool Model::GetChildrenSensitive() const
82 return GetImpl(*this).GetChildrenSensitive();
85 void Model::SetChildrenFocusable(bool enable)
87 GetImpl(*this).SetChildrenFocusable(enable);
90 bool Model::GetChildrenFocusable() const
92 return GetImpl(*this).GetChildrenFocusable();
95 void Model::SetImageBasedLightSource(const std::string& diffuseUrl, const std::string& specularUrl, float scaleFactor)
97 GetImpl(*this).SetImageBasedLightSource(diffuseUrl, specularUrl, scaleFactor);
100 void Model::SetImageBasedLightScaleFactor(float scaleFactor)
102 GetImpl(*this).SetImageBasedLightScaleFactor(scaleFactor);
105 float Model::GetImageBasedLightScaleFactor() const
107 return GetImpl(*this).GetImageBasedLightScaleFactor();
110 uint32_t Model::GetAnimationCount() const
112 return GetImpl(*this).GetAnimationCount();
115 Dali::Animation Model::GetAnimation(uint32_t index) const
117 return GetImpl(*this).GetAnimation(index);
120 Dali::Animation Model::GetAnimation(const std::string& name) const
122 return GetImpl(*this).GetAnimation(name);
125 uint32_t Model::GetCameraCount() const
127 return GetImpl(*this).GetCameraCount();
130 Dali::CameraActor Model::GenerateCamera(uint32_t index) const
132 return GetImpl(*this).GenerateCamera(index);
135 bool Model::ApplyCamera(uint32_t index, Dali::CameraActor camera) const
137 return GetImpl(*this).ApplyCamera(index, camera);
140 ModelNode Model::FindChildModelNodeByName(std::string_view nodeName)
142 return GetImpl(*this).FindChildModelNodeByName(nodeName);
145 void Model::RetrieveBlendShapeNames(std::vector<std::string>& blendShapeNames) const
147 GetImpl(*this).RetrieveBlendShapeNames(blendShapeNames);
150 void Model::RetrieveModelNodesByBlendShapeName(std::string_view blendShapeName, std::vector<ModelNode>& modelNodes) const
152 GetImpl(*this).RetrieveModelNodesByBlendShapeName(blendShapeName, modelNodes);
155 Dali::Animation Model::GenerateMotionDataAnimation(MotionData motionData)
157 return GetImpl(*this).GenerateMotionDataAnimation(motionData);
160 void Model::SetMotionData(MotionData motionData)
162 GetImpl(*this).SetMotionData(motionData);
165 void Model::CastShadow(bool castShadow)
167 GetImpl(*this).CastShadow(castShadow);
170 bool Model::IsShadowCasting() const
172 return GetImpl(*this).IsShadowCasting();
175 void Model::ReceiveShadow(bool receiveShadow)
177 GetImpl(*this).ReceiveShadow(receiveShadow);
180 bool Model::IsShadowReceiving() const
182 return GetImpl(*this).IsShadowReceiving();
185 Model::MeshHitSignalType& Model::MeshHitSignal()
187 return GetImpl(*this).MeshHitSignal();
190 } // namespace Dali::Scene3D