From 415119a09f0c4da1053f8786f12819f599e4f089 Mon Sep 17 00:00:00 2001 From: seungho baek Date: Thu, 30 Nov 2023 11:18:55 +0900 Subject: [PATCH] [NUI] Add SetResolution method to SceneView Signed-off-by: seungho baek --- .../src/internal/Interop/Interop.SceneView.cs | 12 +++++ .../src/public/Controls/SceneView.cs | 60 ++++++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.SceneView.cs b/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.SceneView.cs index 3eeba19..59e4f86 100755 --- a/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.SceneView.cs +++ b/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.SceneView.cs @@ -79,6 +79,18 @@ namespace Tizen.NUI.Scene3D [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)] public static extern bool IsUsingFramebuffer(global::System.Runtime.InteropServices.HandleRef sceneView); + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_SceneView_SetResolution")] + public static extern void SetResolution(global::System.Runtime.InteropServices.HandleRef sceneView, uint width, uint height); + + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_SceneView_GetResolutionWidth")] + public static extern uint GetResolutionWidth(global::System.Runtime.InteropServices.HandleRef sceneView); + + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_SceneView_GetResolutionHeight")] + public static extern uint GetResolutionHeight(global::System.Runtime.InteropServices.HandleRef sceneView); + + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_SceneView_ResetResolution")] + public static extern void ResetResolution(global::System.Runtime.InteropServices.HandleRef sceneView); + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_SceneView_SetFramebufferMultiSamplingLevel")] public static extern void SetFramebufferMultiSamplingLevel(global::System.Runtime.InteropServices.HandleRef sceneView, uint multiSamplingLevel); diff --git a/src/Tizen.NUI.Scene3D/src/public/Controls/SceneView.cs b/src/Tizen.NUI.Scene3D/src/public/Controls/SceneView.cs index 82fa71b..217a7a1 100755 --- a/src/Tizen.NUI.Scene3D/src/public/Controls/SceneView.cs +++ b/src/Tizen.NUI.Scene3D/src/public/Controls/SceneView.cs @@ -473,6 +473,66 @@ namespace Tizen.NUI.Scene3D if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Sets SceneView's resolution manually. + /// + /// The input width. + /// The input height. + /// + /// This manual resolution is only available when the SceneView uses FBO for rendering by using FBO (UseFrameBuffer is true). + /// If the aspect ratio of input width/height is different with SceneView's aspect ratio, the rendered result is stretched to fill SceneView's area. + /// + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetResolution(uint width, uint height) + { + Interop.SceneView.SetResolution(SwigCPtr, width, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves width of resolution of the SceneView. + /// + /// + /// If the SceneView not uses FBO, this method returns SceneView's width. + /// + /// Camera currently used in SceneView as a selected Camera. + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + [EditorBrowsable(EditorBrowsableState.Never)] + public uint GetResolutionWidth() + { + uint result = Interop.SceneView.GetResolutionWidth(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return result; + } + + /// + /// Retrieves height of resolution of the SceneView. + /// + /// + /// If the SceneView not uses FBO, this method returns SceneView's height. + /// + /// Camera currently used in SceneView as a selected Camera. + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + [EditorBrowsable(EditorBrowsableState.Never)] + public uint GetResolutionHeight() + { + uint result = Interop.SceneView.GetResolutionHeight(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return result; + } + + /// + /// Resets SceneView's resolution to the current size of SceneView. + /// + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + [EditorBrowsable(EditorBrowsableState.Never)] + public void ResetResolution() + { + Interop.SceneView.ResetResolution(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + internal void SetUseFramebuffer(bool useFramebuffer) { Interop.SceneView.UseFramebuffer(SwigCPtr, useFramebuffer); -- 2.7.4