From bd718f0c4a6de5ccafdfc3f185069c307e9d08b4 Mon Sep 17 00:00:00 2001 From: seungho baek Date: Tue, 22 Nov 2022 16:37:46 +0900 Subject: [PATCH] [NUI] Use smaller NearPlaneDistance and bigger FarPlaneDistance during CameraTransition of SceneView - To do not cull fragments during camera transition Signed-off-by: seungho baek --- .../src/public/Controls/SceneView.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Tizen.NUI.Scene3D/src/public/Controls/SceneView.cs b/src/Tizen.NUI.Scene3D/src/public/Controls/SceneView.cs index 6525a00..3042f6c 100755 --- a/src/Tizen.NUI.Scene3D/src/public/Controls/SceneView.cs +++ b/src/Tizen.NUI.Scene3D/src/public/Controls/SceneView.cs @@ -355,8 +355,9 @@ namespace Tizen.NUI.Scene3D /// Camera Position, Orientation and FieldOfView are smoothly animated. /// /// - /// The selected camera is switched when the transition is started. - /// During camera transition, Selected Camera cannot be changed by using SelectCamera() or CameraTransition() method. + /// The selected camera is switched to the Camera of the index when the transition is started. + /// During camera transition, Selected Camera should not be changed by using SelectCamera() or CameraTransition() method. + /// During camera transition, Camera properties of Selected Camera should not be changed. /// /// Index of destination Camera of Camera transition. /// The duration in milliseconds. @@ -364,7 +365,7 @@ namespace Tizen.NUI.Scene3D /// 10 public void CameraTransition(uint index, int durationMilliSeconds, AlphaFunction alphaFunction = null) { - if(inCameraTransition) + if(inCameraTransition || GetSelectedCamera() == GetCamera(index)) { return; } @@ -381,8 +382,9 @@ namespace Tizen.NUI.Scene3D /// Camera Position, Orientation and FieldOfView are smoothly animated. /// /// - /// The selected camera is switched when the transition is started. - /// During camera transition, Selected Camera cannot be changed by using SelectCamera() or CameraTransition() method. + /// The selected camera is switched to the Camera of the input name when the transition is started. + /// During camera transition, Selected Camera should not be changed by using SelectCamera() or CameraTransition() method. + /// During camera transition, Camera properties of Selected Camera should not be changed. /// /// string keyword of destination Camera of Camera transition. /// The duration in milliseconds. @@ -390,7 +392,7 @@ namespace Tizen.NUI.Scene3D /// 10 public void CameraTransition(string name, int durationMilliSeconds, AlphaFunction alphaFunction = null) { - if(inCameraTransition) + if(inCameraTransition || GetSelectedCamera() == GetCamera(name)) { return; } @@ -614,8 +616,15 @@ namespace Tizen.NUI.Scene3D orthographicSizeKeyFrames.Dispose(); } + float destinationNearPlaneDistance = destinationCamera.NearPlaneDistance; + float destinationFarPlaneDistance = destinationCamera.FarPlaneDistance; + destinationCamera.NearPlaneDistance = Math.Min(sourceCamera.NearPlaneDistance, destinationCamera.NearPlaneDistance); + destinationCamera.FarPlaneDistance = Math.Max(sourceCamera.FarPlaneDistance, destinationCamera.FarPlaneDistance); + cameraTransition.Finished += (s, e) => { + this.GetSelectedCamera().NearPlaneDistance = destinationNearPlaneDistance; + this.GetSelectedCamera().FarPlaneDistance = destinationFarPlaneDistance; inCameraTransition = false; CameraTransitionFinished?.Invoke(this, EventArgs.Empty); }; -- 2.7.4