[global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_delete_Model")]
public static extern void DeleteModel(global::System.Runtime.InteropServices.HandleRef model);
- [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_Assign")]
- public static extern global::System.IntPtr ModelAssign(global::System.Runtime.InteropServices.HandleRef model, global::System.Runtime.InteropServices.HandleRef sourceModel);
-
[global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_GetModelRoot")]
public static extern global::System.IntPtr GetModelRoot(global::System.Runtime.InteropServices.HandleRef model);
--- /dev/null
+/*
+ * Copyright(c) 2024 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+namespace Tizen.NUI.Scene3D
+{
+ internal static partial class Interop
+ {
+ internal static partial class Panel
+ {
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_New_SWIG_0")]
+ public static extern global::System.IntPtr PanelNew();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_delete_Panel")]
+ public static extern void DeletePanel(global::System.Runtime.InteropServices.HandleRef panel);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_SetPanelResolution")]
+ public static extern void SetPanelResolution(global::System.Runtime.InteropServices.HandleRef panel, global::System.Runtime.InteropServices.HandleRef resolution);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_GetPanelResolution")]
+ public static extern global::System.IntPtr GetPanelResolution(global::System.Runtime.InteropServices.HandleRef panel);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_SetContent")]
+ public static extern void SetContent(global::System.Runtime.InteropServices.HandleRef panel, global::System.Runtime.InteropServices.HandleRef resolution);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_GetContent")]
+ public static extern global::System.IntPtr GetContent(global::System.Runtime.InteropServices.HandleRef panel);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_CastShadow")]
+ public static extern void CastShadow(global::System.Runtime.InteropServices.HandleRef panel, bool castShadow);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_IsShadowCasting")]
+ [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
+ public static extern bool IsShadowCasting(global::System.Runtime.InteropServices.HandleRef panel);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_ReceiveShadow")]
+ public static extern void ReceiveShadow(global::System.Runtime.InteropServices.HandleRef panel, bool receiveShadow);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_IsShadowReceiving")]
+ [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
+ public static extern bool IsShadowReceiving(global::System.Runtime.InteropServices.HandleRef panel);
+
+
+ // For Property index
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_property_TRANSPARENT_get")]
+ public static extern int PropertyTransparentIndexGet();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_property_DOUBLE_SIDED_get")]
+ public static extern int PropertyDoubleSidedIndexGet();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_property_USE_BACK_FACE_PLANE_get")]
+ public static extern int PropertyUseBackFacePlaneIndexGet();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Panel_property_BACK_FACE_PLANE_COLOR_get")]
+ public static extern int PropertyBackFacePlaneColorIndexGet();
+ }
+ }
+}
this.PositionUsesPivotPoint = model.PositionUsesPivotPoint;
}
- /// <summary>
- /// Assignment operator.
- /// </summary>
- /// <param name="model">Source object to be assigned.</param>
- /// <returns>Reference to this.</returns>
- internal Model Assign(Model model)
- {
- Model ret = new Model(Interop.Model.ModelAssign(SwigCPtr, Model.getCPtr(model)), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- ret.PositionUsesPivotPoint = model.PositionUsesPivotPoint;
- return ret;
- }
-
/// <summary>
/// Get The original pivot point of the model
/// </summary>
}
}
+ /// <summary>
+ /// Whether this Model casts shadow or not by directional light.
+ /// If it is true, this Model is drawn on Shadow Map.
+ /// Default value is true.
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool ShadowCast
+ {
+ get
+ {
+ return IsShadowCasting();
+ }
+ set
+ {
+ CastShadow(value);
+ }
+ }
+
+ /// <summary>
+ /// Whether this Model receives shadow or not by directional light.
+ /// If it is true, shadows are drawn on this Model.
+ /// Default value is true.
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool ShadowReceive
+ {
+ get
+ {
+ return IsShadowReceiving();
+ }
+ set
+ {
+ ReceiveShadow(value);
+ }
+ }
+
/// <summary>
/// Adds modelNode to this Model.
/// </summary>
/// However, same property of each child ModelNode can be changed respectively and it not changes parent's property.
/// </summary>
/// <param name="castShadow">Whether this Model casts shadow or not.</param>
- // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void CastShadow(bool castShadow)
+ private void CastShadow(bool castShadow)
{
Interop.Model.CastShadow(SwigCPtr, castShadow);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
/// Note: IBL does not cast any shadow.
/// </summary>
/// <returns>True if this model casts shadow.</returns>
- // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
- [EditorBrowsable(EditorBrowsableState.Never)]
- public bool IsShadowCasting()
+ private bool IsShadowCasting()
{
var isShadowCasting = Interop.Model.IsShadowCasting(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
/// However, same property of each child ModelNode can be changed respectively and it not changes parent's property.
/// </summary>
/// <param name="receiveShadow">Whether this Model receives shadow or not.</param>
- // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void ReceiveShadow(bool receiveShadow)
+ private void ReceiveShadow(bool receiveShadow)
{
Interop.Model.ReceiveShadow(SwigCPtr, receiveShadow);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
/// If it is true, this model is drawn on Shadow Map.
/// </summary>
/// <returns>True if this model receives shadow.</returns>
- // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
- [EditorBrowsable(EditorBrowsableState.Never)]
- public bool IsShadowReceiving()
+ private bool IsShadowReceiving()
{
var isShadowReceiving = Interop.Model.IsShadowReceiving(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
/// Retrieves model root Actor.
/// </summary>
/// <returns>Root View of the model.</returns>
- // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
- [EditorBrowsable(EditorBrowsableState.Never)]
private ModelNode GetModelRoot()
{
global::System.IntPtr cPtr = Interop.Model.GetModelRoot(SwigCPtr);
--- /dev/null
+/*
+ * Copyright(c) 2024 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.Binding;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Scene3D
+{
+ /// <summary>
+ /// Panel is a control to show 2D UI on 3D Scene.
+ /// 2D UI contents set on this Panel are rendered on a screen panel that is placed on 3D scene.
+ /// Each Panel has a single plane with defined resolution.
+ /// The plane is always placed at center to fit within the boundaries of the panel while maintaining the aspect ratio of the resolution.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// 2D UI Content can be added on Panel, but the result that another 3D SceneView is added on Panel is not guaranteed.
+ /// </remarks>
+ ///
+ /// <example>
+ /// <code>
+ /// View contentRoot = CreateUIContent(); // Create 2D UI Scene
+ /// Panel panel = new Panel()
+ /// {
+ /// Size = new Size(width, height),
+ /// };
+ /// panel.PanelResolution = new Vector2(resolutionWidth, resolutionHeight));
+ /// panel.Content = contentRoot;
+ /// </code>
+ /// </example>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public partial class Panel : View
+ {
+ internal Panel(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
+ {
+ }
+
+ internal Panel(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, true, cRegister)
+ {
+ }
+
+ /// <summary>
+ /// Create an initialized Panel.
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Panel() : this(Interop.Panel.PanelNew(), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ this.PositionUsesPivotPoint = true;
+ }
+
+ /// <summary>
+ /// Resolution of the Panel.
+ /// The resolution is independent from the Panel size property.
+ /// The resolution defines a plane that the 2D UI scene will be rendered.
+ /// And the shape of the panel plane is defined by aspect ratio of the input resolution.
+ /// The plane is cleared by white color.
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 PanelResolution
+ {
+ get
+ {
+ return GetPanelResolution();
+ }
+ set
+ {
+ SetPanelResolution(value);
+ }
+ }
+
+ /// <summary>
+ /// Root View of 2D UI content.
+ /// The content is rendered on the plane of the Panel by using off screen rendering.
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View Content
+ {
+ get
+ {
+ return GetContent();
+ }
+ set
+ {
+ SetContent(value);
+ }
+ }
+
+ /// <summary>
+ /// Whether Transparent background is used or not. Default value is false
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Transparent
+ {
+ get
+ {
+ bool transparent = false;
+ using var pValue = GetProperty(Interop.Panel.PropertyTransparentIndexGet());
+ pValue?.Get(out transparent);
+ pValue?.Dispose();
+ return transparent;
+ }
+ set
+ {
+ using var transparent = new Tizen.NUI.PropertyValue(value);
+ SetProperty(Interop.Panel.PropertyTransparentIndexGet(), transparent);
+ transparent.Dispose();
+ }
+ }
+
+ /// <summary>
+ /// Whether the content is rendered as double sided or not.
+ /// Default value is false.
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool DoubleSided
+ {
+ get
+ {
+ bool doubleSided = false;
+ using var pValue = GetProperty(Interop.Panel.PropertyDoubleSidedIndexGet());
+ pValue?.Get(out doubleSided);
+ pValue?.Dispose();
+ return doubleSided;
+ }
+ set
+ {
+ using var doubleSided = new Tizen.NUI.PropertyValue(value);
+ SetProperty(Interop.Panel.PropertyDoubleSidedIndexGet(), doubleSided);
+ doubleSided.Dispose();
+ }
+ }
+
+ /// <summary>
+ /// Whether to use back face plane or not.
+ /// If this property is true, an opaque plane will be displayed when viewed from behind the Panel.
+ /// Default value is true.
+ /// Default back face plane color is white.
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool UsingBackFacePlane
+ {
+ get
+ {
+ bool isUsingBackFacePlane = true;
+ using var pValue = GetProperty(Interop.Panel.PropertyUseBackFacePlaneIndexGet());
+ pValue?.Get(out isUsingBackFacePlane);
+ pValue?.Dispose();
+ return isUsingBackFacePlane;
+ }
+ set
+ {
+ using var isUsingBackFacePlane = new Tizen.NUI.PropertyValue(value);
+ SetProperty(Interop.Panel.PropertyUseBackFacePlaneIndexGet(), isUsingBackFacePlane);
+ isUsingBackFacePlane.Dispose();
+ }
+ }
+
+ /// <summary>
+ /// Color of back face plane.
+ /// Default color is white.
+ /// </summary>
+ /// <remarks>
+ /// Because back face plane is always opaque, alpha channel is ignored.
+ /// </remarks>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color BackFacePlaneColor
+ {
+ get
+ {
+ Vector3 backFacePlaneColorVector3 = new Vector3(1.0f, 1.0f, 1.0f);
+ using var pValue = GetProperty(Interop.Panel.PropertyBackFacePlaneColorIndexGet());
+ pValue?.Get(backFacePlaneColorVector3);
+ pValue?.Dispose();
+ Color backFacePlaneColor = new Vector4(backFacePlaneColorVector3);
+ backFacePlaneColor.A = 1.0f;
+ return backFacePlaneColor;
+ }
+ set
+ {
+ Vector3 backFacePlaneColorVector3 = new Vector3(value.R, value.G, value.B);
+ using var backFacePlaneColor = new Tizen.NUI.PropertyValue(backFacePlaneColorVector3);
+ SetProperty(Interop.Panel.PropertyBackFacePlaneColorIndexGet(), backFacePlaneColor);
+ backFacePlaneColor.Dispose();
+ }
+ }
+
+ /// <summary>
+ /// Whether this Panel casts shadow or not by directional light.
+ /// If it is true, this panel is drawn on Shadow Map.
+ /// Default value is true.
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool ShadowCast
+ {
+ get
+ {
+ return IsShadowCasting();
+ }
+ set
+ {
+ CastShadow(value);
+ }
+ }
+
+ /// <summary>
+ /// Whether this Panel receives shadow or not by directional light.
+ /// If it is true, shadows are drawn on this panel.
+ /// Default value is true.
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool ShadowReceive
+ {
+ get
+ {
+ return IsShadowReceiving();
+ }
+ set
+ {
+ ReceiveShadow(value);
+ }
+ }
+
+ /// <summary>
+ /// Sets whether this Panel casts shadow or not.
+ /// If it is true, this panels is drawn on Shadow Map.
+ /// </summary>
+ /// <param name="castShadow">Whether this Panel casts shadow or not.</param>
+ private void CastShadow(bool castShadow)
+ {
+ Interop.Panel.CastShadow(SwigCPtr, castShadow);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Retrieves whether the Panel casts shadow or not for Light.
+ /// Note: IBL does not cast any shadow.
+ /// </summary>
+ /// <returns>True if this model casts shadow.</returns>
+ private bool IsShadowCasting()
+ {
+ var isShadowCasting = Interop.Panel.IsShadowCasting(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return isShadowCasting;
+ }
+
+ /// <summary>
+ /// Sets whether this Panel receives shadow or not.
+ /// If it is true, shadows are drawn on this panel.
+ /// </summary>
+ /// <param name="receiveShadow">Whether this Panel receives shadow or not.</param>
+ private void ReceiveShadow(bool receiveShadow)
+ {
+ Interop.Panel.ReceiveShadow(SwigCPtr, receiveShadow);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Retrieves whether the Panel receives shadow or not for Light
+ /// If it is true, this model is drawn on Shadow Map.
+ /// </summary>
+ /// <returns>True if this model receives shadow.</returns>
+ private bool IsShadowReceiving()
+ {
+ var isShadowReceiving = Interop.Panel.IsShadowReceiving(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return isShadowReceiving;
+ }
+
+ /// <summary>
+ /// Sets defined resolution to the Panel.
+ /// The resolution is independent from the Panel size property.
+ /// The resolution defines a plane that the 2D UI scene will be rendered.
+ /// And the shape of the panel plane is defined by aspect ratio of the input resolution.
+ /// </summary>
+ /// <param name="resolution">The resolution defines panel plane.</param>
+ /// <returns>True if this model receives shadow.</returns>
+ private void SetPanelResolution(Vector2 resolution)
+ {
+ Interop.Panel.SetPanelResolution(SwigCPtr, Vector2.getCPtr(resolution));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Retrieves panel resolution.
+ /// </summary>
+ /// <returns>Resolution of the panel plane.</returns>
+ private Vector2 GetPanelResolution()
+ {
+ Vector2 resolution = new Vector2(Interop.Panel.GetPanelResolution(SwigCPtr), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return resolution;
+ }
+
+ /// <summary>
+ /// Sets root Actor of 2D UI content.
+ /// The content is rendered on the plane of the Panel by using off screen rendering.
+ /// </summary>
+ /// <param name="content">Root View of 2D UI content.</param>
+ private void SetContent(View content)
+ {
+ Interop.Panel.SetContent(SwigCPtr, content.SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Retrieves root View of 2D UI content.
+ /// </summary>
+ /// <returns>Root View of 2D UI content.</returns>
+ private View GetContent()
+ {
+ IntPtr cPtr = Interop.Panel.GetContent(SwigCPtr);
+ View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View;
+ if (ret != null)
+ {
+ NUI.Interop.BaseHandle.DeleteBaseHandle(new HandleRef(this, cPtr));
+ }
+ else
+ {
+ ret = new View(cPtr, true);
+ }
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ return ret;
+ }
+
+ /// <summary>
+ /// To make transitionSet instance be disposed.
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// Release swigCPtr.
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ Interop.Panel.DeletePanel(swigCPtr);
+ }
+ }
+}
--- /dev/null
+using System.Numerics;
+using System.Reflection.Metadata.Ecma335;
+using global::System;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Scene3D;
+
+namespace Tizen.NUI.Samples
+{
+ using log = Tizen.Log;
+ public class Scene3DPanelTest : IExample
+ {
+ private Window window;
+ private SceneView sceneView;
+ private static readonly string resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+ private Color[] backFaceColors;
+ private int colorIndex;
+ private Animation animation;
+ private Panel panel;
+ private TextLabel guideText;
+ public void Activate()
+ {
+ window = NUIApplication.GetDefaultWindow();
+ window.BackgroundColor = Color.White;
+ Size2D windowSize = window.Size;
+
+ backFaceColors = new Color[3];
+ backFaceColors[0] = Color.Red;
+ backFaceColors[1] = Color.Green;
+ backFaceColors[2] = Color.Blue;
+
+ colorIndex = 0;
+
+ sceneView = new SceneView()
+ {
+ Size = new Size(windowSize.Width, windowSize.Height),
+ PivotPoint = PivotPoint.Center,
+ ParentOrigin = ParentOrigin.Center,
+ PositionUsesPivotPoint = true,
+ BackgroundColor = Color.Beige,
+ UseFramebuffer = true,
+ };
+ window.Add(sceneView);
+
+ View parent = new View()
+ {
+ BackgroundColor = Color.Blue,
+ PivotPoint = PivotPoint.Center,
+ ParentOrigin = ParentOrigin.Center,
+ PositionUsesPivotPoint = true,
+ Size = new Size(100, 100),
+ };
+
+ View child = new View()
+ {
+ BackgroundColor = Color.Red,
+ PivotPoint = PivotPoint.Center,
+ ParentOrigin = ParentOrigin.Center,
+ PositionUsesPivotPoint = true,
+ Size = new Size(100, 100),
+ Position = new Position(25, 100),
+ };
+ parent.Add(child);
+
+ panel = new Panel()
+ {
+ Position = new Position(0.0f, 0.0f, 0.5f),
+ Size = new Size(2.0f, 1.0f),
+ PanelResolution = new Vector2(400, 500),
+ Content = parent,
+ BackFacePlaneColor = backFaceColors[colorIndex],
+ };
+ sceneView.Add(panel);
+
+ SetGuide();
+
+ animation = new Animation(15000);
+ animation.AnimateTo(panel, "orientation", new Rotation(new Radian(new Degree(180.0f)), Vector3.YAxis));
+ animation.AnimateTo(panel, "size", new Vector3(1.0f, 2.0f, 0.0f));
+ animation.Looping = true;
+ animation.LoopingMode = Animation.LoopingModes.AutoReverse;
+ animation.Play();
+
+ window.KeyEvent += WindowKeyEvent;
+ }
+
+ void SetGuide()
+ {
+ if(guideText == null)
+ {
+ guideText = new TextLabel()
+ {
+ PositionUsesPivotPoint = true,
+ PivotPoint = PivotPoint.BottomLeft,
+ ParentOrigin = ParentOrigin.BottomLeft,
+ PointSize = 30.0f,
+ MultiLine = true,
+ };
+ }
+ window.Add(guideText);
+
+ string backFaceColor = string.Format($"({panel.BackFacePlaneColor.R}, {panel.BackFacePlaneColor.G}, {panel.BackFacePlaneColor.B})");
+ string guide = string.Format($"Press 1 to convert transparency - Current value : {panel.Transparent}\nPress 2 to convert double sided - Current value : {panel.DoubleSided}\nPress 3 to convert back face - Current value : {panel.UsingBackFacePlane}\nPress 4 to convert back face color - Current value : {backFaceColor}\n");
+ guideText.Text = guide;
+ }
+
+ private void WindowKeyEvent(object sender, Window.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+ if (e.Key.KeyPressedName == "1")
+ {
+ panel.Transparent = !panel.Transparent;
+ }
+ else if (e.Key.KeyPressedName == "2")
+ {
+ panel.DoubleSided = !panel.DoubleSided;
+ }
+ else if (e.Key.KeyPressedName == "3")
+ {
+ panel.UsingBackFacePlane = !panel.UsingBackFacePlane;
+ }
+ else if (e.Key.KeyPressedName == "4")
+ {
+ colorIndex = ((colorIndex + 1) % 3);
+ panel.BackFacePlaneColor = backFaceColors[colorIndex];
+ }
+ SetGuide();
+ }
+ }
+
+ public void Deactivate()
+ {
+ window.KeyEvent -= WindowKeyEvent;
+ sceneView?.DisposeRecursively();
+ }
+ }
+}