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