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