Merge remote-tracking branch 'sensor/tizen'
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Model3dView.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16
17 using Tizen.NUI.BaseComponents;
18
19 namespace Tizen.NUI
20 {
21
22     internal class Model3dView : View
23     {
24         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
25
26         internal Model3dView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Model3dView_SWIGUpcast(cPtr), cMemoryOwn)
27         {
28             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
29         }
30
31         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Model3dView obj)
32         {
33             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
34         }
35
36         protected override void Dispose(DisposeTypes type)
37         {
38             if (disposed)
39             {
40                 return;
41             }
42
43             if (type == DisposeTypes.Explicit)
44             {
45                 //Called by User
46                 //Release your own managed resources here.
47                 //You should release all of your own disposable objects here.
48
49             }
50
51             //Release your own unmanaged resources here.
52             //You should not access any managed member here except static instance.
53             //because the execution order of Finalizes is non-deterministic.
54
55             if (swigCPtr.Handle != global::System.IntPtr.Zero)
56             {
57                 if (swigCMemOwn)
58                 {
59                     swigCMemOwn = false;
60                     NDalicPINVOKE.delete_Model3dView(swigCPtr);
61                 }
62                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
63             }
64
65             base.Dispose(type);
66         }
67
68         public class Property : global::System.IDisposable
69         {
70             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
71             protected bool swigCMemOwn;
72
73             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
74             {
75                 swigCMemOwn = cMemoryOwn;
76                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
77             }
78
79             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
80             {
81                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
82             }
83
84             //A Flag to check who called Dispose(). (By User or DisposeQueue)
85             private bool isDisposeQueued = false;
86             //A Flat to check if it is already disposed.
87             protected bool disposed = false;
88
89
90             ~Property()
91             {
92                 if (!isDisposeQueued)
93                 {
94                     isDisposeQueued = true;
95                     DisposeQueue.Instance.Add(this);
96                 }
97             }
98
99             public void Dispose()
100             {
101                 //Throw excpetion if Dispose() is called in separate thread.
102                 if (!Window.IsInstalled())
103                 {
104                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
105                 }
106
107                 if (isDisposeQueued)
108                 {
109                     Dispose(DisposeTypes.Implicit);
110                 }
111                 else
112                 {
113                     Dispose(DisposeTypes.Explicit);
114                     System.GC.SuppressFinalize(this);
115                 }
116             }
117
118             protected virtual void Dispose(DisposeTypes type)
119             {
120                 if (disposed)
121                 {
122                     return;
123                 }
124
125                 if (type == DisposeTypes.Explicit)
126                 {
127                     //Called by User
128                     //Release your own managed resources here.
129                     //You should release all of your own disposable objects here.
130
131                 }
132
133                 //Release your own unmanaged resources here.
134                 //You should not access any managed member here except static instance.
135                 //because the execution order of Finalizes is non-deterministic.
136
137                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
138                 {
139                     if (swigCMemOwn)
140                     {
141                         swigCMemOwn = false;
142                         NDalicPINVOKE.delete_Model3dView_Property(swigCPtr);
143                     }
144                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
145                 }
146
147                 disposed = true;
148             }
149
150             public Property() : this(NDalicPINVOKE.new_Model3dView_Property(), true)
151             {
152                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153             }
154
155             public static readonly int GEOMETRY_URL = NDalicPINVOKE.Model3dView_Property_GEOMETRY_URL_get();
156             public static readonly int MATERIAL_URL = NDalicPINVOKE.Model3dView_Property_MATERIAL_URL_get();
157             public static readonly int IMAGES_URL = NDalicPINVOKE.Model3dView_Property_IMAGES_URL_get();
158             public static readonly int ILLUMINATION_TYPE = NDalicPINVOKE.Model3dView_Property_ILLUMINATION_TYPE_get();
159             public static readonly int TEXTURE0_URL = NDalicPINVOKE.Model3dView_Property_TEXTURE0_URL_get();
160             public static readonly int TEXTURE1_URL = NDalicPINVOKE.Model3dView_Property_TEXTURE1_URL_get();
161             public static readonly int TEXTURE2_URL = NDalicPINVOKE.Model3dView_Property_TEXTURE2_URL_get();
162             public static readonly int LIGHT_POSITION = NDalicPINVOKE.Model3dView_Property_LIGHT_POSITION_get();
163
164         }
165
166         public Model3dView() : this(NDalicPINVOKE.Model3dView_New__SWIG_0(), true)
167         {
168             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169
170         }
171         public Model3dView(string objUrl, string mtlUrl, string imagesUrl) : this(NDalicPINVOKE.Model3dView_New__SWIG_1(objUrl, mtlUrl, imagesUrl), true)
172         {
173             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174
175         }
176         public Model3dView(Model3dView model3dView) : this(NDalicPINVOKE.new_Model3dView__SWIG_1(Model3dView.getCPtr(model3dView)), true)
177         {
178             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179         }
180
181         public Model3dView Assign(Model3dView model3dView)
182         {
183             Model3dView ret = new Model3dView(NDalicPINVOKE.Model3dView_Assign(swigCPtr, Model3dView.getCPtr(model3dView)), false);
184             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185             return ret;
186         }
187
188         public new static Model3dView DownCast(BaseHandle handle)
189         {
190             Model3dView ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as Model3dView;
191             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192             return ret;
193         }
194
195         public enum IluminationTypeEnum
196         {
197             DIFFUSE,
198             DIFFUSE_WITH_TEXTURE,
199             DIFFUSE_WITH_NORMAL_MAP
200         }
201
202         public string GeometryUrl
203         {
204             get
205             {
206                 string temp;
207                 GetProperty(Model3dView.Property.GEOMETRY_URL).Get(out temp);
208                 return temp;
209             }
210             set
211             {
212                 SetProperty(Model3dView.Property.GEOMETRY_URL, new Tizen.NUI.PropertyValue(value));
213             }
214         }
215         public string MaterialUrl
216         {
217             get
218             {
219                 string temp;
220                 GetProperty(Model3dView.Property.MATERIAL_URL).Get(out temp);
221                 return temp;
222             }
223             set
224             {
225                 SetProperty(Model3dView.Property.MATERIAL_URL, new Tizen.NUI.PropertyValue(value));
226             }
227         }
228         public string ImagesUrl
229         {
230             get
231             {
232                 string temp;
233                 GetProperty(Model3dView.Property.IMAGES_URL).Get(out temp);
234                 return temp;
235             }
236             set
237             {
238                 SetProperty(Model3dView.Property.IMAGES_URL, new Tizen.NUI.PropertyValue(value));
239             }
240         }
241         public int IlluminationType
242         {
243             get
244             {
245                 int temp = 0;
246                 GetProperty(Model3dView.Property.ILLUMINATION_TYPE).Get(out temp);
247                 return temp;
248             }
249             set
250             {
251                 SetProperty(Model3dView.Property.ILLUMINATION_TYPE, new Tizen.NUI.PropertyValue(value));
252             }
253         }
254         public string Texture0Url
255         {
256             get
257             {
258                 string temp;
259                 GetProperty(Model3dView.Property.TEXTURE0_URL).Get(out temp);
260                 return temp;
261             }
262             set
263             {
264                 SetProperty(Model3dView.Property.TEXTURE0_URL, new Tizen.NUI.PropertyValue(value));
265             }
266         }
267         public string Texture1Url
268         {
269             get
270             {
271                 string temp;
272                 GetProperty(Model3dView.Property.TEXTURE1_URL).Get(out temp);
273                 return temp;
274             }
275             set
276             {
277                 SetProperty(Model3dView.Property.TEXTURE1_URL, new Tizen.NUI.PropertyValue(value));
278             }
279         }
280         public string Texture2Url
281         {
282             get
283             {
284                 string temp;
285                 GetProperty(Model3dView.Property.TEXTURE2_URL).Get(out temp);
286                 return temp;
287             }
288             set
289             {
290                 SetProperty(Model3dView.Property.TEXTURE2_URL, new Tizen.NUI.PropertyValue(value));
291             }
292         }
293         public Vector3 LightPosition
294         {
295             get
296             {
297                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
298                 GetProperty(Model3dView.Property.LIGHT_POSITION).Get(temp);
299                 return temp;
300             }
301             set
302             {
303                 SetProperty(Model3dView.Property.LIGHT_POSITION, new Tizen.NUI.PropertyValue(value));
304             }
305         }
306
307     }
308
309 }