DALi signals refactor to remove V2 naming
[platform/core/uifw/dali-core.git] / dali / public-api / modeling / material.cpp
1 /*
2  * Copyright (c) 2014 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/public-api/modeling/material.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/modeling/material-impl.h>
23
24 namespace Dali
25 {
26
27 const float   Material::DEFAULT_OPACITY   = 1.0f;
28 const float   Material::DEFAULT_SHININESS = 0.5f;
29 const Vector4 Material::DEFAULT_AMBIENT_COLOR(0.2f, 0.2f, 0.2f, 1.0f);
30 const Vector4 Material::DEFAULT_DIFFUSE_COLOR (0.8f, 0.8f, 0.8f, 1.0f);
31 const Vector4 Material::DEFAULT_SPECULAR_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
32 const Vector4 Material::DEFAULT_EMISSIVE_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
33 const Material::MappingMode  Material::DEFAULT_MAPPING_MODE = Material::MAPPING_MODE_WRAP;
34 const size_t  Material::DEFAULT_DIFFUSE_UV_INDEX = 0;
35 const size_t  Material::DEFAULT_OPACITY_UV_INDEX = 0;
36 const size_t  Material::DEFAULT_NORMAL_UV_INDEX  = 0;
37 const bool    Material::DEFAULT_HAS_HEIGHT_MAP   = false;
38
39
40 Material Material::New(const std::string& name)
41 {
42   Internal::Material* internal = Internal::Material::New(name);
43
44   return Material(internal);
45 }
46
47 Material Material::DownCast( BaseHandle handle )
48 {
49   return Material( dynamic_cast<Dali::Internal::Material*>(handle.GetObjectPtr()) );
50 }
51
52 Material::Material(Internal::Material* internal)
53 : BaseHandle(internal)
54 {
55 }
56
57 Material::Material()
58 {
59 }
60
61 Material::~Material()
62 {
63 }
64
65 Material::Material(const Material& handle)
66 : BaseHandle(handle)
67 {
68 }
69
70 Material& Material::operator=(const Material& rhs)
71 {
72   BaseHandle::operator=(rhs);
73   return *this;
74 }
75
76 void Material::SetName(const std::string& name)
77 {
78   GetImplementation(*this).SetName(name);
79 }
80
81 const std::string& Material::GetName() const
82 {
83   return GetImplementation(*this).GetName();
84 }
85
86 void Material::SetOpacity(const float opacity)
87 {
88   GetImplementation(*this).SetOpacity(opacity);
89 }
90
91 float Material::GetOpacity() const
92 {
93   return GetImplementation(*this).GetOpacity();
94 }
95
96 void Material::SetShininess(const float shininess)
97 {
98   GetImplementation(*this).SetShininess(shininess);
99 }
100
101 float Material::GetShininess() const
102 {
103   return GetImplementation(*this).GetShininess();
104 }
105
106 void Material::SetAmbientColor(const Vector4& color)
107 {
108   GetImplementation(*this).SetAmbientColor(color);
109 }
110
111 const Vector4& Material::GetAmbientColor() const
112 {
113   return GetImplementation(*this).GetAmbientColor();
114 }
115
116 void Material::SetDiffuseColor(const Vector4& color)
117 {
118   GetImplementation(*this).SetDiffuseColor(color);
119 }
120
121 const Vector4& Material::GetDiffuseColor() const
122 {
123   return GetImplementation(*this).GetDiffuseColor();
124 }
125
126 void Material::SetSpecularColor(const Vector4& color)
127 {
128   GetImplementation(*this).SetSpecularColor(color);
129 }
130
131 const Vector4& Material::GetSpecularColor() const
132 {
133   return GetImplementation(*this).GetSpecularColor();
134 }
135
136 void Material::SetEmissiveColor(const Vector4& color)
137 {
138   GetImplementation(*this).SetEmissiveColor(color);
139 }
140
141 const Vector4& Material::GetEmissiveColor() const
142 {
143   return GetImplementation(*this).GetEmissiveColor();
144 }
145
146 void Material::SetDiffuseTexture(Image image)
147 {
148   GetImplementation(*this).SetDiffuseTexture(image);
149 }
150
151 Image Material::GetDiffuseTexture() const
152 {
153   return GetImplementation(*this).GetDiffuseTexture();
154 }
155
156 void Material::SetOpacityTexture(Image image)
157 {
158   GetImplementation(*this).SetOpacityTexture(image);
159 }
160
161 Image Material::GetOpacityTexture() const
162 {
163   return GetImplementation(*this).GetOpacityTexture();
164 }
165
166 void Material::SetNormalMap(Image image)
167 {
168   GetImplementation(*this).SetNormalMap(image);
169 }
170
171 Image Material::GetNormalMap() const
172 {
173   return GetImplementation(*this).GetNormalMap();
174 }
175
176 void Material::SetMapU(const unsigned int map)
177 {
178   GetImplementation(*this).SetMapU(map);
179 }
180
181 unsigned int Material::GetMapU() const
182 {
183   return GetImplementation(*this).GetMapU();
184 }
185
186 void Material::SetMapV(const unsigned int map)
187 {
188   GetImplementation(*this).SetMapV(map);
189 }
190
191 unsigned int Material::GetMapV() const
192 {
193   return GetImplementation(*this).GetMapV();
194 }
195
196 void Material::SetDiffuseUVIndex(const int index)
197 {
198   GetImplementation(*this).SetDiffuseUVIndex(index);
199 }
200
201 unsigned int Material::GetDiffuseUVIndex() const
202 {
203   return GetImplementation(*this).GetDiffuseUVIndex();
204 }
205
206 void Material::SetOpacityUVIndex(const int index)
207 {
208   GetImplementation(*this).SetOpacityUVIndex(index);
209 }
210
211 unsigned int Material::GetOpacityUVIndex() const
212 {
213   return GetImplementation(*this).GetOpacityUVIndex();
214 }
215
216 void Material::SetNormalUVIndex(const int index)
217 {
218   GetImplementation(*this).SetNormalUVIndex(index);
219 }
220
221 unsigned int Material::GetNormalUVIndex() const
222 {
223   return GetImplementation(*this).GetNormalUVIndex();
224 }
225
226 void Material::SetHasHeightMap(const bool flag)
227 {
228   GetImplementation(*this).SetHasHeightMap(flag);
229 }
230
231 bool Material::GetHasHeightMap() const
232 {
233   return GetImplementation(*this).GetHasHeightMap();
234 }
235
236
237 void Material::SetDiffuseTextureFileName(const std::string filename)
238 {
239   GetImplementation(*this).SetDiffuseTextureFileName(filename);
240 }
241 const std::string& Material::GetDiffuseFileName() const
242 {
243   return GetImplementation(*this).GetDiffuseTextureFileName();
244 }
245 void Material::SetOpacityTextureFileName(const std::string filename)
246 {
247   GetImplementation(*this).SetOpacityTextureFileName(filename);
248 }
249 const std::string& Material::GetOpacityTextureFileName() const
250 {
251   return GetImplementation(*this).GetOpacityTextureFileName();
252 }
253 void Material::SetNormalMapFileName(const std::string filename)
254 {
255   GetImplementation(*this).SetNormalMapFileName(filename);
256 }
257 const std::string& Material::GetNormalMapFileName() const
258 {
259   return GetImplementation(*this).GetNormalMapFileName();
260 }
261
262 } // namespace Dali