2 * Copyright(c) 2022 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 using System.Runtime.InteropServices;
20 using System.ComponentModel;
22 using Tizen.NUI.Binding;
23 using Tizen.NUI.BaseComponents;
25 namespace Tizen.NUI.Scene3D
28 /// SceneView is a Class to show multiple 3D objects in a single 2D screen.
29 /// Each SceneView has its own 3D space, and 3D objects added to SceneView are positioned in the space.
30 /// SceneView uses left-handed coordinate system same as NUI. X as right, Y as down, and Z as forward.
32 /// SceneView has internal root container to control inner rendering process like depth test.
33 /// When a View is added to the SceneView with <see cref="View.Add(View)"/> method, it is actually added on the root container.
34 /// Therefore, the added Views exist in the sub tree of SceneView, but are not direct children.
35 /// The sub tree of Views will be rendered with the SceneView's own Camera.
37 /// SceneView has one built-in camera by default.
38 /// The default Camera is not removed by using <see cref="RemoveCamera(Camera)"/> method.
39 /// <see cref="GetCamera(uint)"/> method with index "0" returns the default camera,
40 /// and the minimum value returned by <see cref="GetCameraCount()"/> method is 1.
42 /// SceneView also provides multiple Camera and one of them can be used to render multiple objects.
43 /// <see cref="AddCamera(Camera)"/>, <see cref="RemoveCamera(Camera)"/>, <see cref="GetCamera(uint)"/>,
44 /// and <see cref="SelectCamera(uint)"/> are methods to manage Cameras of the SceneView.
45 /// User can place multiple cameras in a scene to display the entire scene or to display individual objects.
46 /// User can use the <see cref="SelectCamera(uint)"/> method to select the currently required camera.
48 /// When the SceneView's size changes, some camera properties that depend on its size may also change.
49 /// The changing properties are as follows: AspectRatio, LeftPlaneDistance, RightPlaneDistance, TopPlaneDistance, and BottomPlaneDistance.
50 /// The Camera's FieldOfView is vertical fov. The horizontal fov is updated internally according to the SceneView size.
52 /// The <see cref="SetImageBasedLightSource(string, string, float)"/> method sets the same IBL to all Model objects added to the SceneView.
53 /// For the IBL, two cube map textures(diffuse and specular) are required.
54 /// SceneView supports 4 types layout for Cube Map: Vertical/Horizontal Cross layouts, and Vertical/Horizontal Array layouts.
55 /// And also, ktx format with cube map is supported.
56 /// If a model already has an IBL, it is batch overridden with the IBL of the SceneView.
57 /// If the SceneView has IBL, the IBL of newly added models is also overridden.
59 /// The IBL textures start to be loaded asynchronously when <see cref="SetImageBasedLightSource(string, string, float)"/> method is called.
60 /// ResourcesLoaded signal notifies that the loading of the IBL resources have been completed.
62 /// If FBO is used, the rendering result of SceneView is drawn on the FBO and it is mapped on the plane of the SceneView.
63 /// It could decreases performance slightly, but it is useful to show SceneView according to the rendering order with other Views.
65 /// And since SceneView is a View, it can be placed together with other 2D UI components in the NUI window.
67 /// <since_tizen> 10 </since_tizen>
68 public class SceneView : View
70 private bool inCameraTransition = false;
71 private Animation cameraTransition;
72 private string skyboxUrl;
74 internal SceneView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
79 /// Create an initialized SceneView.
81 /// <since_tizen> 10 </since_tizen>
82 public SceneView() : this(Interop.SceneView.SceneNew(), true)
84 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90 /// <param name="sceneView">The source object.</param>
91 /// <since_tizen> 10 </since_tizen>
92 public SceneView(SceneView sceneView) : this(Interop.SceneView.NewScene(SceneView.getCPtr(sceneView)), true)
94 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98 /// Assignment operator.
100 /// <param name="sceneView">Handle to an object.</param>
101 /// <returns>Reference to this.</returns>
102 internal SceneView Assign(SceneView sceneView)
104 SceneView ret = new SceneView(Interop.SceneView.SceneAssign(SwigCPtr, SceneView.getCPtr(sceneView)), false);
105 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110 /// An event emitted when Camera Transition is finished.
112 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
113 [EditorBrowsable(EditorBrowsableState.Never)]
114 public event EventHandler CameraTransitionFinished;
117 /// Set/Get the ImageBasedLight ScaleFactor.
118 /// Scale factor controls light source intensity in [0.0f, 1.0f]
120 /// <since_tizen> 10 </since_tizen>
121 public float ImageBasedLightScaleFactor
125 SetImageBasedLightScaleFactor(value);
129 return GetImageBasedLightScaleFactor();
134 /// Set/Get the UseFramebuffer.
135 /// If this property is true, rendering result of SceneView is drawn on FBO and it is mapping on this SceneView plane.
136 /// If this property is false, each item in SceneView is rendered on window directly.
137 /// Default is false.
140 /// If UseFramebuffer is true, it could decrease performance but entire rendering order is satisfied.
141 /// If UseFramebuffer is false, the performance becomes better but SceneView is rendered on the top of the other 2D components regardless tree order.
143 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
144 [EditorBrowsable(EditorBrowsableState.Never)]
145 public bool UseFramebuffer
149 SetUseFramebuffer(value);
153 return IsUsingFramebuffer();
158 /// Set/Get the Framebuffer's MultiSamplingLevel.
159 /// Only has effects if UseFramebuffer is true, and Framebuffer MultiSampling is supported.
163 /// Getter didn't consider Framebuffer MultiSampling is supported or not.
165 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
166 [EditorBrowsable(EditorBrowsableState.Never)]
167 public uint FramebufferMultiSamplingLevel
171 SetFramebufferMultiSamplingLevel(value);
175 return GetFramebufferMultiSamplingLevel();
180 /// Set/Get SkyboxUrl.
181 /// If SkyboxUrl is set, the cube map image is loaded and skybox is attached on scene.
182 /// Skybox texture is asynchronously loaded. When loading is finished, ResourcesLoaded is emitted.
184 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
185 [EditorBrowsable(EditorBrowsableState.Never)]
186 public string SkyboxUrl
199 /// Set/Get Skybox intensity.
200 /// The skybox intensity is multiplied to the color of skybox texture.
201 /// Default value is 1.0f.
203 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
204 [EditorBrowsable(EditorBrowsableState.Never)]
205 public float SkyboxIntensity
209 SetSkyboxIntensity(value);
213 return GetSkyboxIntensity();
218 /// Set/Get angle of orientation of the skybox.
219 /// If orientation is set, the skybox will be rotate by the Radian orientation along YAxis.
220 /// Default value is 0.0f.
222 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
223 [EditorBrowsable(EditorBrowsableState.Never)]
224 public Rotation SkyboxOrientation
228 SetSkyboxOrientation(value);
232 return GetSkyboxOrientation();
237 /// Adds a Camera to the SceneView at the end of the camera list of SceneView.
238 /// The Camera can be used as a selected camera to render the scene by using <see cref="SelectCamera(uint)"/> or <see cref="SelectCamera(string)"/>
240 /// <param name="camera">Camera added on this SceneView.</param>
242 /// Some properties of the Camera will be change depending on the Size of this SceneView.
243 /// Those properties are as follows:
244 /// AspectRatio, LeftPlaneDistance, RightPlaneDistance, TopPlaneDistance, and BottomPlaneDistance.
246 /// The FieldOfView of Camera is for vertical fov.
247 /// When the size of the SceneView is changed, the vertical fov is maintained
248 /// and the horizontal fov is automatically calculated according to the SceneView's AspectRatio.
250 /// <since_tizen> 10 </since_tizen>
251 public void AddCamera(Camera camera)
255 Interop.SceneView.AddCamera(SwigCPtr, camera.SwigCPtr);
256 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
261 /// Removes a Camera from this SceneView.
262 /// If removed Camera is selected Camera,
263 /// first camera in the list becomes the selected Camera.
265 /// <param name="camera"> camera Camera to be removed from this Camera.</param>
267 /// When Camera.Dispose() is called, the NUI object is disposed, but camera information is maintained internally.
268 /// Therefore, even if Camera.Dispose() is called, RemoveCamera() or RemoveCamera() methods can be used.
269 /// If RemoveCamera() is called too, all information is deleted together.
271 /// <since_tizen> 10 </since_tizen>
272 public void RemoveCamera(Camera camera)
276 Interop.SceneView.RemoveCamera(SwigCPtr, camera.SwigCPtr);
277 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
282 /// Retrieves the number of cameras.
284 /// <returns>The number of Cameras.</returns>
285 /// <since_tizen> 10 </since_tizen>
286 public uint GetCameraCount()
288 uint count = Interop.SceneView.GetCameraCount(SwigCPtr);
289 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
294 /// Retrieves a Camera of the index.
296 /// <param name="index"> Index of Camera to be retrieved.</param>
297 /// <returns>Camera of the index.</returns>
298 /// <since_tizen> 10 </since_tizen>
299 public Camera GetCamera(uint index)
301 global::System.IntPtr cPtr = Interop.SceneView.GetCamera(SwigCPtr, index);
302 Camera camera = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Camera;
305 // Register new camera into Registry.
306 camera = new Camera(cPtr, true);
310 // We found matched NUI camera. Reduce cPtr reference count.
311 HandleRef handle = new HandleRef(this, cPtr);
312 Interop.Camera.DeleteCameraProperty(handle);
313 handle = new HandleRef(null, IntPtr.Zero);
315 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
320 /// Retrieves a Camera of the input name.
322 /// <param name="name"> string keyword of Camera to be retrieved.</param>
323 /// <returns>Camera that has the name as a View.Name property</returns>
324 /// <since_tizen> 10 </since_tizen>
325 public Camera GetCamera(string name)
327 global::System.IntPtr cPtr = Interop.SceneView.GetCamera(SwigCPtr, name);
328 Camera camera = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Camera;
331 // Register new camera into Registry.
332 camera = new Camera(cPtr, true);
336 // We found matched NUI camera. Reduce cPtr reference count.
337 HandleRef handle = new HandleRef(this, cPtr);
338 Interop.Camera.DeleteCameraProperty(handle);
339 handle = new HandleRef(null, IntPtr.Zero);
341 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
346 /// Makes SceneView use a Camera of index as a selected camera.
348 /// <param name="index"> Index of Camera to be used as a selected camera.</param>
349 /// <since_tizen> 10 </since_tizen>
350 public void SelectCamera(uint index)
352 if(inCameraTransition)
356 Interop.SceneView.SelectCamera(SwigCPtr, index);
357 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
361 /// Makes SceneView use a Camera of a name as a selected camera.
363 /// <param name="name"> string keyword of Camera to be used as a selected camera.</param>
364 /// <since_tizen> 10 </since_tizen>
365 public void SelectCamera(string name)
367 if(inCameraTransition)
371 Interop.SceneView.SelectCamera(SwigCPtr, name);
372 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
376 /// Starts camera transition from currently selected camera to a camera of index.
377 /// Camera Position, Orientation and FieldOfView are smoothly animated.
380 /// The selected camera is switched to the Camera of the index when the transition is started.
381 /// During camera transition, Selected Camera should not be changed by using SelectCamera() or CameraTransition() method.
382 /// During camera transition, Camera properties of Selected Camera should not be changed.
384 /// <param name="index"> Index of destination Camera of Camera transition.</param>
385 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
386 /// <param name="alphaFunction">The alpha function to apply.</param>
387 /// <since_tizen> 10 </since_tizen>
388 public void CameraTransition(uint index, int durationMilliSeconds, AlphaFunction alphaFunction = null)
390 if(inCameraTransition || GetSelectedCamera() == GetCamera(index))
394 Camera source = GetSelectedCamera();
396 Camera destination = GetSelectedCamera();
397 CameraTransition(source, destination, durationMilliSeconds, alphaFunction);
401 /// Starts camera transition from currently selected camera to a camera of input name.
402 /// Camera Position, Orientation and FieldOfView are smoothly animated.
405 /// The selected camera is switched to the Camera of the input name when the transition is started.
406 /// During camera transition, Selected Camera should not be changed by using SelectCamera() or CameraTransition() method.
407 /// During camera transition, Camera properties of Selected Camera should not be changed.
409 /// <param name="name"> string keyword of destination Camera of Camera transition.</param>
410 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
411 /// <param name="alphaFunction">The alpha function to apply.</param>
412 /// <since_tizen> 10 </since_tizen>
413 public void CameraTransition(string name, int durationMilliSeconds, AlphaFunction alphaFunction = null)
415 if(inCameraTransition || GetSelectedCamera() == GetCamera(name))
419 Camera source = GetSelectedCamera();
421 Camera destination = GetSelectedCamera();
422 CameraTransition(source, destination, durationMilliSeconds, alphaFunction);
426 /// Retrieves selected Camera.
428 /// <returns> Camera currently used in SceneView as a selected Camera.</returns>
429 /// <since_tizen> 10 </since_tizen>
430 public Camera GetSelectedCamera()
432 global::System.IntPtr cPtr = Interop.SceneView.GetSelectedCamera(SwigCPtr);
433 Camera camera = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Camera;
436 // Register new camera into Registry.
437 camera = new Camera(cPtr, true);
441 // We found matched NUI camera. Reduce cPtr reference count.
442 HandleRef handle = new HandleRef(this, cPtr);
443 Interop.Camera.DeleteCameraProperty(handle);
444 handle = new HandleRef(null, IntPtr.Zero);
446 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
451 /// Changes Image Based Light as the input textures.
453 /// <param name="diffuseUrl">The path of Cube map image that can be used as a diffuse IBL source.</param>
454 /// <param name="specularUrl">The path of Cube map image that can be used as a specular IBL source.</param>
455 /// <param name="scaleFactor">Scale factor that controls light source intensity in [0.0f, 1.0f]. Default value is 1.0f.</param>
457 /// http://tizen.org/privilege/mediastorage for local files in media storage.
458 /// http://tizen.org/privilege/externalstorage for local files in external storage.
460 /// <since_tizen> 10 </since_tizen>
461 public void SetImageBasedLightSource(string diffuseUrl, string specularUrl, float scaleFactor = 1.0f)
463 Interop.SceneView.SetImageBasedLightSource(SwigCPtr, diffuseUrl, specularUrl, scaleFactor);
464 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
467 internal void SetUseFramebuffer(bool useFramebuffer)
469 Interop.SceneView.UseFramebuffer(SwigCPtr, useFramebuffer);
470 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
473 internal bool IsUsingFramebuffer()
475 bool result = Interop.SceneView.IsUsingFramebuffer(SwigCPtr);
476 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
480 internal void SetFramebufferMultiSamplingLevel(uint multiSamplingLevel)
482 Interop.SceneView.SetFramebufferMultiSamplingLevel(SwigCPtr, multiSamplingLevel);
483 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
486 internal uint GetFramebufferMultiSamplingLevel()
488 uint result = Interop.SceneView.GetFramebufferMultiSamplingLevel(SwigCPtr);
489 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
494 /// Set the ImageBasedLight ScaleFactor.
496 /// <param name="scaleFactor">Scale factor that controls light source intensity in [0.0f, 1.0f].</param>
497 private void SetImageBasedLightScaleFactor(float scaleFactor)
499 Interop.SceneView.SetImageBasedLightScaleFactor(SwigCPtr, scaleFactor);
500 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
504 /// Get the ImageBasedLight ScaleFactor.
506 /// <returns>ImageBasedLightScaleFactor that controls light source intensity.</returns>
507 private float GetImageBasedLightScaleFactor()
509 float scaleFactor = Interop.SceneView.GetImageBasedLightScaleFactor(SwigCPtr);
510 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
515 /// Set the Skybox from cube map image.
516 /// Skybox texture is asynchronously loaded. When loading is finished, ResourcesLoaded is emitted.
518 /// <param name="skyboxUrl">Cube map image url for skybox.</param>
519 private void SetSkybox(string skyboxUrl)
521 this.skyboxUrl = skyboxUrl;
522 Interop.SceneView.SetSkybox(SwigCPtr, skyboxUrl);
523 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
527 /// Sets Skybox intensity.
528 /// The skybox intensity is multiplied to the color of skybox texture.
529 /// Default value is 1.0f.
531 /// <param name="intensity">Intensity value to be multiplied to the cube map color.</param>
532 private void SetSkyboxIntensity(float intensity)
534 Interop.SceneView.SetSkyboxIntensity(SwigCPtr, intensity);
535 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
539 /// Gets Skybox intensity.
540 /// Default value is 1.0f.
542 /// <returns>skybox intensity.</returns>
543 private float GetSkyboxIntensity()
545 float intensity = Interop.SceneView.GetSkyboxIntensity(SwigCPtr);
546 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
551 /// Sets orientation of the skybox.
553 /// <param name="orientation">Rotation angle of the skybox along YAxis.</param>
554 private void SetSkyboxOrientation(Rotation orientation)
556 Interop.SceneView.SetSkyboxOrientation(SwigCPtr, Rotation.getCPtr(orientation));
557 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
561 /// Gets Skybox orientation.
563 /// <returns>skybox orientation.</returns>
564 private Rotation GetSkyboxOrientation()
566 global::System.IntPtr cPtr = Interop.SceneView.GetSkyboxOrientation(SwigCPtr);
567 Rotation ret = (cPtr == global::System.IntPtr.Zero) ? null : new Rotation(cPtr, true);
568 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
572 private void CameraTransition(Camera sourceCamera, Camera destinationCamera, int durationMilliSeconds, AlphaFunction alphaFunction)
574 inCameraTransition = true;
576 Position sourcePosition = sourceCamera.Position;
577 Rotation sourceOrientation = sourceCamera.Orientation;
579 Position destinationPosition = destinationCamera.Position;
580 Rotation destinationOrientation = destinationCamera.Orientation;
582 cameraTransition = new Animation(durationMilliSeconds);
584 KeyFrames positionKeyFrames = new KeyFrames();
585 positionKeyFrames.Add(0.0f, sourcePosition);
586 positionKeyFrames.Add(1.0f, destinationPosition);
588 KeyFrames orientationKeyFrames = new KeyFrames();
589 orientationKeyFrames.Add(0.0f, sourceOrientation);
590 orientationKeyFrames.Add(1.0f, destinationOrientation);
592 cameraTransition.AnimateBetween(destinationCamera, "Position", positionKeyFrames, Animation.Interpolation.Linear, alphaFunction);
593 cameraTransition.AnimateBetween(destinationCamera, "Orientation", orientationKeyFrames, Animation.Interpolation.Linear, alphaFunction);
595 if(destinationCamera.ProjectionMode == Camera.ProjectionModeType.Perspective)
597 Radian sourceFieldOfView = sourceCamera.FieldOfView;
598 Radian destinationFieldOfView = destinationCamera.FieldOfView;
600 // If ProjectionDirection is not equal, match the value.
601 if (sourceCamera.ProjectionDirection != destinationCamera.ProjectionDirection)
603 float aspect = destinationCamera.AspectRatio;
604 if (destinationCamera.ProjectionDirection == Camera.ProjectionDirectionType.Vertical)
606 sourceFieldOfView = Camera.ConvertFovFromHorizontalToVertical(aspect, sourceFieldOfView);
610 sourceFieldOfView = Camera.ConvertFovFromVerticalToHorizontal(aspect, sourceFieldOfView);
614 KeyFrames fieldOfViewKeyFrames = new KeyFrames();
615 fieldOfViewKeyFrames.Add(0.0f, sourceFieldOfView.ConvertToFloat());
616 fieldOfViewKeyFrames.Add(1.0f, destinationFieldOfView.ConvertToFloat());
617 cameraTransition.AnimateBetween(destinationCamera, "FieldOfView", fieldOfViewKeyFrames, Animation.Interpolation.Linear, alphaFunction);
619 sourceFieldOfView.Dispose();
620 destinationFieldOfView.Dispose();
621 fieldOfViewKeyFrames.Dispose();
625 float sourceOrthographicSize = sourceCamera.OrthographicSize;
626 float destinationOrthographicSize = destinationCamera.OrthographicSize;
628 // If ProjectionDirection is not equal, match the value.
629 if (sourceCamera.ProjectionDirection != destinationCamera.ProjectionDirection)
631 float aspect = destinationCamera.AspectRatio;
632 if (destinationCamera.ProjectionDirection == Camera.ProjectionDirectionType.Vertical)
634 sourceOrthographicSize = sourceOrthographicSize / aspect;
638 sourceOrthographicSize = sourceOrthographicSize * aspect;
642 KeyFrames orthographicSizeKeyFrames = new KeyFrames();
643 orthographicSizeKeyFrames.Add(0.0f, sourceOrthographicSize);
644 orthographicSizeKeyFrames.Add(1.0f, destinationOrthographicSize);
645 cameraTransition.AnimateBetween(destinationCamera, "OrthographicSize", orthographicSizeKeyFrames, Animation.Interpolation.Linear, alphaFunction);
647 orthographicSizeKeyFrames.Dispose();
650 float destinationNearPlaneDistance = destinationCamera.NearPlaneDistance;
651 float destinationFarPlaneDistance = destinationCamera.FarPlaneDistance;
652 destinationCamera.NearPlaneDistance = Math.Min(sourceCamera.NearPlaneDistance, destinationCamera.NearPlaneDistance);
653 destinationCamera.FarPlaneDistance = Math.Max(sourceCamera.FarPlaneDistance, destinationCamera.FarPlaneDistance);
655 cameraTransition.Finished += (s, e) =>
657 this.GetSelectedCamera().NearPlaneDistance = destinationNearPlaneDistance;
658 this.GetSelectedCamera().FarPlaneDistance = destinationFarPlaneDistance;
659 inCameraTransition = false;
660 CameraTransitionFinished?.Invoke(this, EventArgs.Empty);
662 cameraTransition.Play();
664 positionKeyFrames.Dispose();
665 orientationKeyFrames.Dispose();
669 /// Release swigCPtr.
671 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
672 [EditorBrowsable(EditorBrowsableState.Never)]
673 protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
675 Interop.SceneView.DeleteScene(swigCPtr);