[Tizen] Add Asynchronous loading for Model and SceneView
[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() = default;
29
30 Model::Model(const Model& model) = default;
31
32 Model::Model(Model&& rhs) = default;
33
34 Model& Model::operator=(const Model& model) = default;
35
36 Model& Model::operator=(Model&& rhs) = default;
37
38 Model::~Model() = default;
39
40 Model Model::New(const std::string& modelUrl, const std::string& resourceDirectoryUrl)
41 {
42   return Internal::Model::New(modelUrl, resourceDirectoryUrl);
43 }
44
45 Model Model::DownCast(BaseHandle handle)
46 {
47   return Control::DownCast<Model, Internal::Model>(handle);
48 }
49
50 Model::Model(Internal::Model& implementation)
51 : Control(implementation)
52 {
53 }
54
55 Model::Model(Dali::Internal::CustomActor* internal)
56 : Control(internal)
57 {
58   VerifyCustomActorPointer<Internal::Model>(internal);
59 }
60
61 const Actor Model::GetModelRoot() const
62 {
63   return GetImpl(*this).GetModelRoot();
64 }
65
66 void Model::SetChildrenSensitive(bool enable)
67 {
68   GetImpl(*this).SetChildrenSensitive(enable);
69 }
70
71 bool Model::GetChildrenSensitive() const
72 {
73   return GetImpl(*this).GetChildrenSensitive();
74 }
75
76 void Model::SetImageBasedLightSource(const std::string& diffuseUrl, const std::string& specularUrl, float scaleFactor)
77 {
78   GetImpl(*this).SetImageBasedLightSource(diffuseUrl, specularUrl, scaleFactor);
79 }
80
81 void Model::SetImageBasedLightTexture(Texture diffuseTexture, Texture specularTexture, float scaleFactor)
82 {
83   GetImpl(*this).SetImageBasedLightTexture(diffuseTexture, specularTexture, scaleFactor);
84 }
85
86 void Model::SetImageBasedLightScaleFactor(float scaleFactor)
87 {
88   GetImpl(*this).SetImageBasedLightScaleFactor(scaleFactor);
89 }
90
91 float Model::GetImageBasedLightScaleFactor() const
92 {
93   return GetImpl(*this).GetImageBasedLightScaleFactor();
94 }
95
96 uint32_t Model::GetAnimationCount() const
97 {
98   return GetImpl(*this).GetAnimationCount();
99 }
100
101 Dali::Animation Model::GetAnimation(uint32_t index) const
102 {
103   return GetImpl(*this).GetAnimation(index);
104 }
105
106 Dali::Animation Model::GetAnimation(const std::string& name) const
107 {
108   return GetImpl(*this).GetAnimation(name);
109 }
110
111 } // namespace Scene3D
112
113 } // namespace Dali