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 /// 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.
36 public class CameraActor : Actor
38 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
40 internal CameraActor(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.CameraActor_SWIGUpcast(cPtr), cMemoryOwn)
42 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
45 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CameraActor obj)
47 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
52 DisposeQueue.Instance.Add(this);
56 /// To make CameraActor instance be disposed.
58 public override void Dispose()
60 if (!Stage.IsInstalled())
62 DisposeQueue.Instance.Add(this);
68 if (swigCPtr.Handle != global::System.IntPtr.Zero)
73 NDalicPINVOKE.delete_CameraActor(swigCPtr);
75 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
77 global::System.GC.SuppressFinalize(this);
83 internal class Property : global::System.IDisposable
85 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
86 protected bool swigCMemOwn;
88 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
90 swigCMemOwn = cMemoryOwn;
91 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
94 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
96 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
104 public virtual void Dispose()
108 if (swigCPtr.Handle != global::System.IntPtr.Zero)
113 NDalicPINVOKE.delete_CameraActor_Property(swigCPtr);
115 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
117 global::System.GC.SuppressFinalize(this);
121 internal Property() : this(NDalicPINVOKE.new_CameraActor_Property(), true)
123 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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();
144 /// Creates an initialized CameraActor handle.
146 public CameraActor() : this(NDalicPINVOKE.CameraActor_New__SWIG_0(), true)
148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153 /// Creates a CameraActor object.
154 /// Sets the default camera perspective projection for the given canvas size
156 /// <param name="size">The canvas size</param>
157 public CameraActor(Size2D size) : this(NDalicPINVOKE.CameraActor_New__SWIG_1(Size2D.getCPtr(size)), true)
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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.
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)
172 CameraActor ret = new CameraActor(NDalicPINVOKE.CameraActor_DownCast(BaseHandle.getCPtr(handle)), true);
173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177 internal CameraActor(CameraActor copy) : this(NDalicPINVOKE.new_CameraActor__SWIG_1(CameraActor.getCPtr(copy)), true)
179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182 internal CameraActor Assign(CameraActor rhs)
184 CameraActor ret = new CameraActor(NDalicPINVOKE.CameraActor_Assign(swigCPtr, CameraActor.getCPtr(rhs)), false);
185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189 internal void SetType(CameraType type)
191 NDalicPINVOKE.CameraActor_SetType(swigCPtr, (int)type);
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195 internal CameraType GetType()
197 CameraType ret = (CameraType)NDalicPINVOKE.CameraActor_GetType(swigCPtr);
198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 internal void SetProjectionMode(ProjectionMode mode)
204 NDalicPINVOKE.CameraActor_SetProjectionMode(swigCPtr, (int)mode);
205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208 internal ProjectionMode GetProjectionMode()
210 ProjectionMode ret = (ProjectionMode)NDalicPINVOKE.CameraActor_GetProjectionMode(swigCPtr);
211 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215 internal void SetFieldOfView(float fieldOfView)
217 NDalicPINVOKE.CameraActor_SetFieldOfView(swigCPtr, fieldOfView);
218 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221 internal float GetFieldOfView()
223 float ret = NDalicPINVOKE.CameraActor_GetFieldOfView(swigCPtr);
224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 internal void SetAspectRatio(float aspectRatio)
230 NDalicPINVOKE.CameraActor_SetAspectRatio(swigCPtr, aspectRatio);
231 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234 internal float GetAspectRatio()
236 float ret = NDalicPINVOKE.CameraActor_GetAspectRatio(swigCPtr);
237 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241 internal void SetNearClippingPlane(float nearClippingPlane)
243 NDalicPINVOKE.CameraActor_SetNearClippingPlane(swigCPtr, nearClippingPlane);
244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 internal float GetNearClippingPlane()
249 float ret = NDalicPINVOKE.CameraActor_GetNearClippingPlane(swigCPtr);
250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
254 internal void SetFarClippingPlane(float farClippingPlane)
256 NDalicPINVOKE.CameraActor_SetFarClippingPlane(swigCPtr, farClippingPlane);
257 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
260 internal float GetFarClippingPlane()
262 float ret = NDalicPINVOKE.CameraActor_GetFarClippingPlane(swigCPtr);
263 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 internal void SetTargetPosition(Vector3 targetPosition)
269 NDalicPINVOKE.CameraActor_SetTargetPosition(swigCPtr, Vector3.getCPtr(targetPosition));
270 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273 internal Vector3 GetTargetPosition()
275 Vector3 ret = new Vector3(NDalicPINVOKE.CameraActor_GetTargetPosition(swigCPtr), true);
276 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
280 internal void SetInvertYAxis(bool invertYAxis)
282 NDalicPINVOKE.CameraActor_SetInvertYAxis(swigCPtr, invertYAxis);
283 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286 internal bool GetInvertYAxis()
288 bool ret = NDalicPINVOKE.CameraActor_GetInvertYAxis(swigCPtr);
289 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
293 internal void SetPerspectiveProjection(Vector2 size)
295 NDalicPINVOKE.CameraActor_SetPerspectiveProjection(swigCPtr, Vector2.getCPtr(size));
296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
299 internal void SetOrthographicProjection(Vector2 size)
301 NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_0(swigCPtr, Vector2.getCPtr(size));
302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
305 internal void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
307 NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_1(swigCPtr, left, right, top, bottom, near, far);
308 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312 /// Gets/Sets the camera type. The default type is FreeLook
319 GetProperty(CameraActor.Property.TYPE).Get(out temp);
324 SetProperty(CameraActor.Property.TYPE, new Tizen.NUI.PropertyValue(value));
329 /// Gets/Sets the projection mode.
331 public string ProjectionMode
336 GetProperty(CameraActor.Property.PROJECTION_MODE).Get(out temp);
341 SetProperty(CameraActor.Property.PROJECTION_MODE, new Tizen.NUI.PropertyValue(value));
346 /// Gets/Sets the field of view.
348 public float FieldOfView
353 GetProperty(CameraActor.Property.FIELD_OF_VIEW).Get(ref temp);
358 SetProperty(CameraActor.Property.FIELD_OF_VIEW, new Tizen.NUI.PropertyValue(value));
363 /// Gets/Sets the aspect ratio of the camera.
365 public float AspectRatio
370 GetProperty(CameraActor.Property.ASPECT_RATIO).Get(ref temp);
375 SetProperty(CameraActor.Property.ASPECT_RATIO, new Tizen.NUI.PropertyValue(value));
380 /// Gets/Sets near plane distance
382 public float NearPlaneDistance
387 GetProperty(CameraActor.Property.NEAR_PLANE_DISTANCE).Get(ref temp);
392 SetProperty(CameraActor.Property.NEAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
397 /// Gets/Sets far plane distance
399 public float FarPlaneDistance
404 GetProperty(CameraActor.Property.FAR_PLANE_DISTANCE).Get(ref temp);
409 SetProperty(CameraActor.Property.FAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
414 /// Gets/Sets left plane distance
416 public float LeftPlaneDistance
421 GetProperty(CameraActor.Property.LEFT_PLANE_DISTANCE).Get(ref temp);
426 SetProperty(CameraActor.Property.LEFT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
431 /// Gets/Sets right plane distance
433 public float RightPlaneDistance
438 GetProperty(CameraActor.Property.RIGHT_PLANE_DISTANCE).Get(ref temp);
443 SetProperty(CameraActor.Property.RIGHT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
448 /// Gets/Sets top plane distance
450 public float TopPlaneDistance
455 GetProperty(CameraActor.Property.TOP_PLANE_DISTANCE).Get(ref temp);
460 SetProperty(CameraActor.Property.TOP_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
465 /// Gets/Sets bottom plane distance
467 public float BottomPlaneDistance
472 GetProperty(CameraActor.Property.BOTTOM_PLANE_DISTANCE).Get(ref temp);
477 SetProperty(CameraActor.Property.BOTTOM_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
482 /// Gets/Sets the target position of the camera.
484 public Position TargetPosition
488 Position temp = new Position(0.0f, 0.0f, 0.0f);
489 GetProperty(CameraActor.Property.TARGET_POSITION).Get(temp);
494 SetProperty(CameraActor.Property.TARGET_POSITION, new Tizen.NUI.PropertyValue(value));
497 internal Matrix ProjectionMatrix
501 Matrix temp = new Matrix();
502 GetProperty(CameraActor.Property.PROJECTION_MATRIX).Get(temp);
507 internal Matrix ViewMatrix
511 Matrix temp = new Matrix();
512 GetProperty(CameraActor.Property.VIEW_MATRIX).Get(temp);
518 /// Requests for an inversion on the Y axis on the projection calculation.
520 public bool InvertYAxis
525 GetProperty(CameraActor.Property.INVERT_Y_AXIS).Get(ref temp);
530 SetProperty(CameraActor.Property.INVERT_Y_AXIS, new Tizen.NUI.PropertyValue(value));
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
541 public enum CameraType
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
552 public enum ProjectionMode
554 PerspectiveProjection,
555 OrthographicProjection