1.[NUI 276] c# nui visual high level class refactorying.
[platform/core/csapi/nui.git] / Tizen.NUI / src / public / CameraActor.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 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 // Some have been manually changed
18
19 namespace Tizen.NUI
20 {
21
22     /// <summary>
23     /// This class will be deprecated.<br>
24     /// CameraActor controls a camera.<br>
25     /// Allows the developer to use actor semantics to control a camera.<br>
26     /// NUI has a concept of a camera to display its virtual 3D world to a 2D screen.<br>
27     /// There are 2 ways of using the camera in NUI:<br>
28     /// - For 2D applications, you do not need to care about the camera at all. The default camera is already best suited for 2D applications
29     /// (configured to have the origin of the coordinate system at the top-left corner of the screen, and unit 1 as 1 pixel of the screen). This is a typical way.<br>
30     /// - For 3D applications, you can change the view by manipulating the camera.You can translate or rotate the camera in this case.<br>
31     /// Note that the top-left corner of the screen and unit 1 no longer are (0,0,0) and 1 pixel after manipulating the camera.<br>
32     /// There are two types of camera actor, FreeLook and LookAtTarget. By default, the camera actor will be FreeLook.<br>
33     /// - A FreeLook camera uses actor's orientation to control where the camera is looking.<br>
34     /// If no additional rotations are specified, the camera looks in the negative Z direction.<br>
35     /// - For LookAtTarget, the actor's orientation is ignored, instead the camera looks at TargetPosition in world coordinates.<br>
36     /// /// </summary>
37     public class CameraActor : Actor
38     {
39         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
40
41         internal CameraActor(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.CameraActor_SWIGUpcast(cPtr), cMemoryOwn)
42         {
43             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
44         }
45
46         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CameraActor obj)
47         {
48             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
49         }
50
51         ~CameraActor()
52         {
53             DisposeQueue.Instance.Add(this);
54         }
55
56         /// <summary>
57         /// To make CameraActor instance be disposed.
58         /// </summary>
59         public override void Dispose()
60         {
61             if (!Stage.IsInstalled())
62             {
63                 DisposeQueue.Instance.Add(this);
64                 return;
65             }
66
67             lock (this)
68             {
69                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
70                 {
71                     if (swigCMemOwn)
72                     {
73                         swigCMemOwn = false;
74                         NDalicPINVOKE.delete_CameraActor(swigCPtr);
75                     }
76                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
77                 }
78                 global::System.GC.SuppressFinalize(this);
79                 base.Dispose();
80             }
81         }
82
83
84         internal class Property : global::System.IDisposable
85         {
86             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
87             protected bool swigCMemOwn;
88
89             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
90             {
91                 swigCMemOwn = cMemoryOwn;
92                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
93             }
94
95             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
96             {
97                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
98             }
99
100             ~Property()
101             {
102                 Dispose();
103             }
104
105             public virtual void Dispose()
106             {
107                 lock (this)
108                 {
109                     if (swigCPtr.Handle != global::System.IntPtr.Zero)
110                     {
111                         if (swigCMemOwn)
112                         {
113                             swigCMemOwn = false;
114                             NDalicPINVOKE.delete_CameraActor_Property(swigCPtr);
115                         }
116                         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
117                     }
118                     global::System.GC.SuppressFinalize(this);
119                 }
120             }
121
122             internal Property() : this(NDalicPINVOKE.new_CameraActor_Property(), true)
123             {
124                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125             }
126
127             internal static readonly int TYPE = NDalicPINVOKE.CameraActor_Property_TYPE_get();
128             internal static readonly int PROJECTION_MODE = NDalicPINVOKE.CameraActor_Property_PROJECTION_MODE_get();
129             internal static readonly int FIELD_OF_VIEW = NDalicPINVOKE.CameraActor_Property_FIELD_OF_VIEW_get();
130             internal static readonly int ASPECT_RATIO = NDalicPINVOKE.CameraActor_Property_ASPECT_RATIO_get();
131             internal static readonly int NEAR_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_NEAR_PLANE_DISTANCE_get();
132             internal static readonly int FAR_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_FAR_PLANE_DISTANCE_get();
133             internal static readonly int LEFT_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_LEFT_PLANE_DISTANCE_get();
134             internal static readonly int RIGHT_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_RIGHT_PLANE_DISTANCE_get();
135             internal static readonly int TOP_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_TOP_PLANE_DISTANCE_get();
136             internal static readonly int BOTTOM_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_BOTTOM_PLANE_DISTANCE_get();
137             internal static readonly int TARGET_POSITION = NDalicPINVOKE.CameraActor_Property_TARGET_POSITION_get();
138             internal static readonly int PROJECTION_MATRIX = NDalicPINVOKE.CameraActor_Property_PROJECTION_MATRIX_get();
139             internal static readonly int VIEW_MATRIX = NDalicPINVOKE.CameraActor_Property_VIEW_MATRIX_get();
140             internal static readonly int INVERT_Y_AXIS = NDalicPINVOKE.CameraActor_Property_INVERT_Y_AXIS_get();
141
142         }
143
144         /// <summary>
145         /// Creates an initialized CameraActor handle.
146         /// </summary>
147         public CameraActor() : this(NDalicPINVOKE.CameraActor_New__SWIG_0(), true)
148         {
149             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150
151         }
152
153         /// <summary>
154         /// Creates a CameraActor object.<br>
155         /// Sets the default camera perspective projection for the given canvas size.<br>
156         /// </summary>
157         /// <param name="size">The canvas size</param>
158         public CameraActor(Size2D size) : this(NDalicPINVOKE.CameraActor_New__SWIG_1(Size2D.getCPtr(size)), true)
159         {
160             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161
162         }
163
164         /// <summary>
165         /// Downcasts a handle to CameraActor handle.<br>
166         /// If handle points to a CameraActor, the downcast produces valid handle.<br>
167         /// If not, the returned handle is left uninitialized.<br>
168         /// </summary>
169         /// <param name="handle">to An object</param>
170         /// <returns>Handle to a CameraActor or an uninitialized handle</returns>
171         public new static CameraActor DownCast(BaseHandle handle)
172         {
173             CameraActor ret = new CameraActor(NDalicPINVOKE.CameraActor_DownCast(BaseHandle.getCPtr(handle)), true);
174             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175             return ret;
176         }
177
178         internal CameraActor(CameraActor copy) : this(NDalicPINVOKE.new_CameraActor__SWIG_1(CameraActor.getCPtr(copy)), true)
179         {
180             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181         }
182
183         internal CameraActor Assign(CameraActor rhs)
184         {
185             CameraActor ret = new CameraActor(NDalicPINVOKE.CameraActor_Assign(swigCPtr, CameraActor.getCPtr(rhs)), false);
186             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187             return ret;
188         }
189
190         internal void SetType(CameraType type)
191         {
192             NDalicPINVOKE.CameraActor_SetType(swigCPtr, (int)type);
193             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194         }
195
196         internal CameraType GetType()
197         {
198             CameraType ret = (CameraType)NDalicPINVOKE.CameraActor_GetType(swigCPtr);
199             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200             return ret;
201         }
202
203         internal void SetProjectionMode(ProjectionMode mode)
204         {
205             NDalicPINVOKE.CameraActor_SetProjectionMode(swigCPtr, (int)mode);
206             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207         }
208
209         internal ProjectionMode GetProjectionMode()
210         {
211             ProjectionMode ret = (ProjectionMode)NDalicPINVOKE.CameraActor_GetProjectionMode(swigCPtr);
212             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
213             return ret;
214         }
215
216         internal void SetFieldOfView(float fieldOfView)
217         {
218             NDalicPINVOKE.CameraActor_SetFieldOfView(swigCPtr, fieldOfView);
219             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
220         }
221
222         internal float GetFieldOfView()
223         {
224             float ret = NDalicPINVOKE.CameraActor_GetFieldOfView(swigCPtr);
225             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226             return ret;
227         }
228
229         internal void SetAspectRatio(float aspectRatio)
230         {
231             NDalicPINVOKE.CameraActor_SetAspectRatio(swigCPtr, aspectRatio);
232             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233         }
234
235         internal float GetAspectRatio()
236         {
237             float ret = NDalicPINVOKE.CameraActor_GetAspectRatio(swigCPtr);
238             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239             return ret;
240         }
241
242         internal void SetNearClippingPlane(float nearClippingPlane)
243         {
244             NDalicPINVOKE.CameraActor_SetNearClippingPlane(swigCPtr, nearClippingPlane);
245             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246         }
247
248         internal float GetNearClippingPlane()
249         {
250             float ret = NDalicPINVOKE.CameraActor_GetNearClippingPlane(swigCPtr);
251             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
252             return ret;
253         }
254
255         internal void SetFarClippingPlane(float farClippingPlane)
256         {
257             NDalicPINVOKE.CameraActor_SetFarClippingPlane(swigCPtr, farClippingPlane);
258             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259         }
260
261         internal float GetFarClippingPlane()
262         {
263             float ret = NDalicPINVOKE.CameraActor_GetFarClippingPlane(swigCPtr);
264             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265             return ret;
266         }
267
268         internal void SetTargetPosition(Vector3 targetPosition)
269         {
270             NDalicPINVOKE.CameraActor_SetTargetPosition(swigCPtr, Vector3.getCPtr(targetPosition));
271             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
272         }
273
274         internal Vector3 GetTargetPosition()
275         {
276             Vector3 ret = new Vector3(NDalicPINVOKE.CameraActor_GetTargetPosition(swigCPtr), true);
277             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
278             return ret;
279         }
280
281         internal void SetInvertYAxis(bool invertYAxis)
282         {
283             NDalicPINVOKE.CameraActor_SetInvertYAxis(swigCPtr, invertYAxis);
284             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
285         }
286
287         internal bool GetInvertYAxis()
288         {
289             bool ret = NDalicPINVOKE.CameraActor_GetInvertYAxis(swigCPtr);
290             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
291             return ret;
292         }
293
294         internal void SetPerspectiveProjection(Vector2 size)
295         {
296             NDalicPINVOKE.CameraActor_SetPerspectiveProjection(swigCPtr, Vector2.getCPtr(size));
297             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298         }
299
300         internal void SetOrthographicProjection(Vector2 size)
301         {
302             NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_0(swigCPtr, Vector2.getCPtr(size));
303             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304         }
305
306         internal void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
307         {
308             NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_1(swigCPtr, left, right, top, bottom, near, far);
309             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310         }
311
312         /// <summary>
313         /// Gets/Sets the camera type. The default type is FreeLook
314         /// </summary>
315         public CameraType Type
316         {
317             get
318             {
319                 string temp;
320                 if (GetProperty(CameraActor.Property.TYPE).Get(out temp) == false)
321                 {
322 #if DEBUG_ON
323                     Tizen.Log.Error("NUI", "CameraType get error!");
324 #endif
325                 }
326                 switch (temp)
327                 {
328                     case "LOOK_AT_TARGET":
329                         return CameraType.LookAtTarget;
330                     case "FREE_LOOK":
331                         return CameraType.FreeLook;
332                     default:
333                         return CameraType.FreeLook;
334                 }
335             }
336             set
337             {
338                 string valueToString = "";
339                 switch (value)
340                 {
341                     case CameraType.LookAtTarget:
342                     {
343                         valueToString = "LOOK_AT_TARGET";
344                         break;
345                     }
346                     case CameraType.FreeLook:
347                     {
348                         valueToString = "FREE_LOOK";
349                         break;
350                     }
351                     default:
352                     {
353                         valueToString = "FREE_LOOK";
354                         break;
355                     }
356                 }
357                 SetProperty(CameraActor.Property.TYPE, new Tizen.NUI.PropertyValue(valueToString));
358             }
359         }
360
361         /// <summary>
362         /// Gets/Sets the projection mode.
363         /// </summary>
364         public ProjectionMode ProjectionMode
365         {
366             get
367             {
368                 string temp;
369                 if (GetProperty(CameraActor.Property.PROJECTION_MODE).Get(out temp) == false)
370                 {
371 #if DEBUG_ON
372                     Tizen.Log.Error("NUI", "ProjectionMode get error!");
373 #endif
374                 }
375                 switch(temp)
376                 {
377                     case "PERSPECTIVE_PROJECTION":
378                         return ProjectionMode.PerspectiveProjection;
379                     case "ORTHOGRAPHIC_PROJECTION":
380                         return ProjectionMode.OrthographicProjection;
381                     default:
382                         return ProjectionMode.PerspectiveProjection;
383                 }
384             }
385             set
386             {
387                 string valueToString = "";
388                 switch (value)
389                 {
390                     case ProjectionMode.PerspectiveProjection:
391                     {
392                         valueToString = "PERSPECTIVE_PROJECTION";
393                         break;
394                     }
395                     case ProjectionMode.OrthographicProjection:
396                     {
397                         valueToString = "ORTHOGRAPHIC_PROJECTION";
398                         break;
399                     }
400                     default:
401                     {
402                         valueToString = "PERSPECTIVE_PROJECTION";
403                         break;
404                     }
405                 }
406                 SetProperty(CameraActor.Property.PROJECTION_MODE, new Tizen.NUI.PropertyValue(valueToString));
407             }
408         }
409
410         /// <summary>
411         /// Gets/Sets the field of view.
412         /// </summary>
413         public float FieldOfView
414         {
415             get
416             {
417                 float temp = 0.0f;
418                 GetProperty(CameraActor.Property.FIELD_OF_VIEW).Get(ref temp);
419                 return temp;
420             }
421             set
422             {
423                 SetProperty(CameraActor.Property.FIELD_OF_VIEW, new Tizen.NUI.PropertyValue(value));
424             }
425         }
426
427         /// <summary>
428         /// Gets/Sets the aspect ratio of the camera.
429         /// </summary>
430         public float AspectRatio
431         {
432             get
433             {
434                 float temp = 0.0f;
435                 GetProperty(CameraActor.Property.ASPECT_RATIO).Get(ref temp);
436                 return temp;
437             }
438             set
439             {
440                 SetProperty(CameraActor.Property.ASPECT_RATIO, new Tizen.NUI.PropertyValue(value));
441             }
442         }
443
444         /// <summary>
445         /// Gets/Sets near plane distance.
446         /// </summary>
447         public float NearPlaneDistance
448         {
449             get
450             {
451                 float temp = 0.0f;
452                 GetProperty(CameraActor.Property.NEAR_PLANE_DISTANCE).Get(ref temp);
453                 return temp;
454             }
455             set
456             {
457                 SetProperty(CameraActor.Property.NEAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
458             }
459         }
460
461         /// <summary>
462         /// Gets/Sets far plane distance.
463         /// </summary>
464         public float FarPlaneDistance
465         {
466             get
467             {
468                 float temp = 0.0f;
469                 GetProperty(CameraActor.Property.FAR_PLANE_DISTANCE).Get(ref temp);
470                 return temp;
471             }
472             set
473             {
474                 SetProperty(CameraActor.Property.FAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
475             }
476         }
477
478         /// <summary>
479         /// Gets/Sets left plane distance.
480         /// </summary>
481         public float LeftPlaneDistance
482         {
483             get
484             {
485                 float temp = 0.0f;
486                 GetProperty(CameraActor.Property.LEFT_PLANE_DISTANCE).Get(ref temp);
487                 return temp;
488             }
489             set
490             {
491                 SetProperty(CameraActor.Property.LEFT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
492             }
493         }
494
495         /// <summary>
496         /// Gets/Sets right plane distance.
497         /// </summary>
498         public float RightPlaneDistance
499         {
500             get
501             {
502                 float temp = 0.0f;
503                 GetProperty(CameraActor.Property.RIGHT_PLANE_DISTANCE).Get(ref temp);
504                 return temp;
505             }
506             set
507             {
508                 SetProperty(CameraActor.Property.RIGHT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
509             }
510         }
511
512         /// <summary>
513         /// Gets/Sets top plane distance.
514         /// </summary>
515         public float TopPlaneDistance
516         {
517             get
518             {
519                 float temp = 0.0f;
520                 GetProperty(CameraActor.Property.TOP_PLANE_DISTANCE).Get(ref temp);
521                 return temp;
522             }
523             set
524             {
525                 SetProperty(CameraActor.Property.TOP_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
526             }
527         }
528
529         /// <summary>
530         /// Gets/Sets bottom plane distance.
531         /// </summary>
532         public float BottomPlaneDistance
533         {
534             get
535             {
536                 float temp = 0.0f;
537                 GetProperty(CameraActor.Property.BOTTOM_PLANE_DISTANCE).Get(ref temp);
538                 return temp;
539             }
540             set
541             {
542                 SetProperty(CameraActor.Property.BOTTOM_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
543             }
544         }
545
546         /// <summary>
547         /// Gets/Sets the target position of the camera.
548         /// </summary>
549         public Position TargetPosition
550         {
551             get
552             {
553                 Position temp = new Position(0.0f, 0.0f, 0.0f);
554                 GetProperty(CameraActor.Property.TARGET_POSITION).Get(temp);
555                 return temp;
556             }
557             set
558             {
559                 SetProperty(CameraActor.Property.TARGET_POSITION, new Tizen.NUI.PropertyValue(value));
560             }
561         }
562         internal Matrix ProjectionMatrix
563         {
564             get
565             {
566                 Matrix temp = new Matrix();
567                 GetProperty(CameraActor.Property.PROJECTION_MATRIX).Get(temp);
568                 return temp;
569             }
570         }
571
572         internal Matrix ViewMatrix
573         {
574             get
575             {
576                 Matrix temp = new Matrix();
577                 GetProperty(CameraActor.Property.VIEW_MATRIX).Get(temp);
578                 return temp;
579             }
580         }
581
582         /// <summary>
583         /// Requests for an inversion on the Y axis on the projection calculation.
584         /// </summary>
585         public bool InvertYAxis
586         {
587             get
588             {
589                 bool temp = false;
590                 GetProperty(CameraActor.Property.INVERT_Y_AXIS).Get(ref temp);
591                 return temp;
592             }
593             set
594             {
595                 SetProperty(CameraActor.Property.INVERT_Y_AXIS, new Tizen.NUI.PropertyValue(value));
596             }
597         }
598
599     }
600 }