Skip to content

Commit

Permalink
[NUI] Add SetResolution method to SceneView
Browse files Browse the repository at this point in the history
Signed-off-by: seungho baek <[email protected]>
  • Loading branch information
bshsqa authored and hinohie committed Dec 4, 2023
1 parent 216e2eb commit 10f8a00
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.SceneView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ internal static partial class SceneView
[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);

Expand Down
60 changes: 60 additions & 0 deletions src/Tizen.NUI.Scene3D/src/public/Controls/SceneView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,66 @@ public void SetImageBasedLightSource(string diffuseUrl, string specularUrl, floa
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}

/// <summary>
/// Sets SceneView's resolution manually.
/// </summary>
/// <param name="width">The input width.</param>
/// <param name="height">The input height.</param>
/// <remarks>
/// 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.
/// </remarks>
// 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();
}

/// <summary>
/// Retrieves width of resolution of the SceneView.
/// </summary>
/// <remarks>
/// If the SceneView not uses FBO, this method returns SceneView's width.
/// </remarks>
/// <returns> Camera currently used in SceneView as a selected Camera.</returns>
// 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;
}

/// <summary>
/// Retrieves height of resolution of the SceneView.
/// </summary>
/// <remarks>
/// If the SceneView not uses FBO, this method returns SceneView's height.
/// </remarks>
/// <returns> Camera currently used in SceneView as a selected Camera.</returns>
// 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;
}

/// <summary>
/// Resets SceneView's resolution to the current size of SceneView.
/// </summary>
// 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);
Expand Down

0 comments on commit 10f8a00

Please sign in to comment.