1 // Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 // Some have been manually changed
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>
37 public class CameraActor : Actor
39 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
41 internal CameraActor(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.CameraActor_SWIGUpcast(cPtr), cMemoryOwn)
43 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
46 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CameraActor obj)
48 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
53 DisposeQueue.Instance.Add(this);
57 /// To make CameraActor instance be disposed.
59 public override void Dispose()
61 if (!Stage.IsInstalled())
63 DisposeQueue.Instance.Add(this);
69 if (swigCPtr.Handle != global::System.IntPtr.Zero)
74 NDalicPINVOKE.delete_CameraActor(swigCPtr);
76 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
78 global::System.GC.SuppressFinalize(this);
84 internal class Property : global::System.IDisposable
86 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
87 protected bool swigCMemOwn;
89 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
91 swigCMemOwn = cMemoryOwn;
92 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
95 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
97 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
105 public virtual void Dispose()
109 if (swigCPtr.Handle != global::System.IntPtr.Zero)
114 NDalicPINVOKE.delete_CameraActor_Property(swigCPtr);
116 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
118 global::System.GC.SuppressFinalize(this);
122 internal Property() : this(NDalicPINVOKE.new_CameraActor_Property(), true)
124 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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();
145 /// Creates an initialized CameraActor handle.
147 public CameraActor() : this(NDalicPINVOKE.CameraActor_New__SWIG_0(), true)
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154 /// Creates a CameraActor object.<br>
155 /// Sets the default camera perspective projection for the given canvas size.<br>
157 /// <param name="size">The canvas size</param>
158 public CameraActor(Size2D size) : this(NDalicPINVOKE.CameraActor_New__SWIG_1(Size2D.getCPtr(size)), true)
160 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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>
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)
173 CameraActor ret = new CameraActor(NDalicPINVOKE.CameraActor_DownCast(BaseHandle.getCPtr(handle)), true);
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178 internal CameraActor(CameraActor copy) : this(NDalicPINVOKE.new_CameraActor__SWIG_1(CameraActor.getCPtr(copy)), true)
180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183 internal CameraActor Assign(CameraActor rhs)
185 CameraActor ret = new CameraActor(NDalicPINVOKE.CameraActor_Assign(swigCPtr, CameraActor.getCPtr(rhs)), false);
186 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190 internal void SetType(CameraType type)
192 NDalicPINVOKE.CameraActor_SetType(swigCPtr, (int)type);
193 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 internal CameraType GetType()
198 CameraType ret = (CameraType)NDalicPINVOKE.CameraActor_GetType(swigCPtr);
199 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203 internal void SetProjectionMode(ProjectionMode mode)
205 NDalicPINVOKE.CameraActor_SetProjectionMode(swigCPtr, (int)mode);
206 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209 internal ProjectionMode GetProjectionMode()
211 ProjectionMode ret = (ProjectionMode)NDalicPINVOKE.CameraActor_GetProjectionMode(swigCPtr);
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216 internal void SetFieldOfView(float fieldOfView)
218 NDalicPINVOKE.CameraActor_SetFieldOfView(swigCPtr, fieldOfView);
219 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222 internal float GetFieldOfView()
224 float ret = NDalicPINVOKE.CameraActor_GetFieldOfView(swigCPtr);
225 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
229 internal void SetAspectRatio(float aspectRatio)
231 NDalicPINVOKE.CameraActor_SetAspectRatio(swigCPtr, aspectRatio);
232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235 internal float GetAspectRatio()
237 float ret = NDalicPINVOKE.CameraActor_GetAspectRatio(swigCPtr);
238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
242 internal void SetNearClippingPlane(float nearClippingPlane)
244 NDalicPINVOKE.CameraActor_SetNearClippingPlane(swigCPtr, nearClippingPlane);
245 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
248 internal float GetNearClippingPlane()
250 float ret = NDalicPINVOKE.CameraActor_GetNearClippingPlane(swigCPtr);
251 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
255 internal void SetFarClippingPlane(float farClippingPlane)
257 NDalicPINVOKE.CameraActor_SetFarClippingPlane(swigCPtr, farClippingPlane);
258 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
261 internal float GetFarClippingPlane()
263 float ret = NDalicPINVOKE.CameraActor_GetFarClippingPlane(swigCPtr);
264 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
268 internal void SetTargetPosition(Vector3 targetPosition)
270 NDalicPINVOKE.CameraActor_SetTargetPosition(swigCPtr, Vector3.getCPtr(targetPosition));
271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
274 internal Vector3 GetTargetPosition()
276 Vector3 ret = new Vector3(NDalicPINVOKE.CameraActor_GetTargetPosition(swigCPtr), true);
277 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
281 internal void SetInvertYAxis(bool invertYAxis)
283 NDalicPINVOKE.CameraActor_SetInvertYAxis(swigCPtr, invertYAxis);
284 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
287 internal bool GetInvertYAxis()
289 bool ret = NDalicPINVOKE.CameraActor_GetInvertYAxis(swigCPtr);
290 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
294 internal void SetPerspectiveProjection(Vector2 size)
296 NDalicPINVOKE.CameraActor_SetPerspectiveProjection(swigCPtr, Vector2.getCPtr(size));
297 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300 internal void SetOrthographicProjection(Vector2 size)
302 NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_0(swigCPtr, Vector2.getCPtr(size));
303 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
306 internal void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
308 NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_1(swigCPtr, left, right, top, bottom, near, far);
309 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
313 /// Gets/Sets the camera type. The default type is FreeLook
315 public CameraType Type
320 if (GetProperty(CameraActor.Property.TYPE).Get(out temp) == false)
323 Tizen.Log.Error("NUI", "CameraType get error!");
328 case "LOOK_AT_TARGET":
329 return CameraType.LookAtTarget;
331 return CameraType.FreeLook;
333 return CameraType.FreeLook;
338 string valueToString = "";
341 case CameraType.LookAtTarget:
343 valueToString = "LOOK_AT_TARGET";
346 case CameraType.FreeLook:
348 valueToString = "FREE_LOOK";
353 valueToString = "FREE_LOOK";
357 SetProperty(CameraActor.Property.TYPE, new Tizen.NUI.PropertyValue(valueToString));
362 /// Gets/Sets the projection mode.
364 public ProjectionMode ProjectionMode
369 if (GetProperty(CameraActor.Property.PROJECTION_MODE).Get(out temp) == false)
372 Tizen.Log.Error("NUI", "ProjectionMode get error!");
377 case "PERSPECTIVE_PROJECTION":
378 return ProjectionMode.PerspectiveProjection;
379 case "ORTHOGRAPHIC_PROJECTION":
380 return ProjectionMode.OrthographicProjection;
382 return ProjectionMode.PerspectiveProjection;
387 string valueToString = "";
390 case ProjectionMode.PerspectiveProjection:
392 valueToString = "PERSPECTIVE_PROJECTION";
395 case ProjectionMode.OrthographicProjection:
397 valueToString = "ORTHOGRAPHIC_PROJECTION";
402 valueToString = "PERSPECTIVE_PROJECTION";
406 SetProperty(CameraActor.Property.PROJECTION_MODE, new Tizen.NUI.PropertyValue(valueToString));
411 /// Gets/Sets the field of view.
413 public float FieldOfView
418 GetProperty(CameraActor.Property.FIELD_OF_VIEW).Get(ref temp);
423 SetProperty(CameraActor.Property.FIELD_OF_VIEW, new Tizen.NUI.PropertyValue(value));
428 /// Gets/Sets the aspect ratio of the camera.
430 public float AspectRatio
435 GetProperty(CameraActor.Property.ASPECT_RATIO).Get(ref temp);
440 SetProperty(CameraActor.Property.ASPECT_RATIO, new Tizen.NUI.PropertyValue(value));
445 /// Gets/Sets near plane distance.
447 public float NearPlaneDistance
452 GetProperty(CameraActor.Property.NEAR_PLANE_DISTANCE).Get(ref temp);
457 SetProperty(CameraActor.Property.NEAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
462 /// Gets/Sets far plane distance.
464 public float FarPlaneDistance
469 GetProperty(CameraActor.Property.FAR_PLANE_DISTANCE).Get(ref temp);
474 SetProperty(CameraActor.Property.FAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
479 /// Gets/Sets left plane distance.
481 public float LeftPlaneDistance
486 GetProperty(CameraActor.Property.LEFT_PLANE_DISTANCE).Get(ref temp);
491 SetProperty(CameraActor.Property.LEFT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
496 /// Gets/Sets right plane distance.
498 public float RightPlaneDistance
503 GetProperty(CameraActor.Property.RIGHT_PLANE_DISTANCE).Get(ref temp);
508 SetProperty(CameraActor.Property.RIGHT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
513 /// Gets/Sets top plane distance.
515 public float TopPlaneDistance
520 GetProperty(CameraActor.Property.TOP_PLANE_DISTANCE).Get(ref temp);
525 SetProperty(CameraActor.Property.TOP_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
530 /// Gets/Sets bottom plane distance.
532 public float BottomPlaneDistance
537 GetProperty(CameraActor.Property.BOTTOM_PLANE_DISTANCE).Get(ref temp);
542 SetProperty(CameraActor.Property.BOTTOM_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
547 /// Gets/Sets the target position of the camera.
549 public Position TargetPosition
553 Position temp = new Position(0.0f, 0.0f, 0.0f);
554 GetProperty(CameraActor.Property.TARGET_POSITION).Get(temp);
559 SetProperty(CameraActor.Property.TARGET_POSITION, new Tizen.NUI.PropertyValue(value));
562 internal Matrix ProjectionMatrix
566 Matrix temp = new Matrix();
567 GetProperty(CameraActor.Property.PROJECTION_MATRIX).Get(temp);
572 internal Matrix ViewMatrix
576 Matrix temp = new Matrix();
577 GetProperty(CameraActor.Property.VIEW_MATRIX).Get(temp);
583 /// Requests for an inversion on the Y axis on the projection calculation.
585 public bool InvertYAxis
590 GetProperty(CameraActor.Property.INVERT_Y_AXIS).Get(ref temp);
595 SetProperty(CameraActor.Property.INVERT_Y_AXIS, new Tizen.NUI.PropertyValue(value));