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