From: huiyu <35286162+huiyueun@users.noreply.github.com> Date: Wed, 13 Mar 2024 01:14:45 +0000 (+0900) Subject: [NUI.Scene3D] Add CastShadow and ReceiveShadow for Model and ModelNode (#5987) X-Git-Tag: accepted/tizen/unified/20240321.142403~1^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74eae787a4d1dbd8ce3f17966cbd49c14c3a3091;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI.Scene3D] Add CastShadow and ReceiveShadow for Model and ModelNode (#5987) - CastShadow can be used to make an object cast shadow or not. - ReceiveShadow can be used to make an object be not drawn any shadow on its surface. - Model and ModelNode have the methods. - If Model's method is called, it is inherited to its current child ModelNode. - If ModelNode's method is called, it is only affects the ModelNode itself. - The ModelNode's property changes do not affect its parent Model's property. Signed-off-by: huiyu.eun --- diff --git a/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.Model.cs b/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.Model.cs index 3296bf8..9786dda 100755 --- a/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.Model.cs +++ b/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.Model.cs @@ -96,6 +96,21 @@ namespace Tizen.NUI.Scene3D [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_LoadFacialAnimation_2")] public static extern global::System.IntPtr LoadBlendShapeAnimationFromBuffer(global::System.Runtime.InteropServices.HandleRef model, string jsonBuffer, int jsonBufferLength); + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_CastShadow")] + public static extern void CastShadow(global::System.Runtime.InteropServices.HandleRef model, bool castShadow); + + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_IsShadowCasting")] + [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)] + public static extern bool IsShadowCasting(global::System.Runtime.InteropServices.HandleRef model); + + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_ReceiveShadow")] + public static extern void ReceiveShadow(global::System.Runtime.InteropServices.HandleRef model, bool receiveShadow); + + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_IsShadowReceiving")] + [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)] + public static extern bool IsShadowReceiving(global::System.Runtime.InteropServices.HandleRef model); + + // Signals [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_MeshHitSignal_Connect")] public static extern void MeshHitSignalConnect(global::System.Runtime.InteropServices.HandleRef model, global::System.Runtime.InteropServices.HandleRef handler); diff --git a/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.ModelNode.cs b/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.ModelNode.cs index 9cb5026..b3f287d 100755 --- a/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.ModelNode.cs +++ b/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.ModelNode.cs @@ -75,7 +75,21 @@ namespace Tizen.NUI.Scene3D [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_ModelNode_SetColliderMesh")] public static extern global::System.IntPtr SetColliderMesh(global::System.Runtime.InteropServices.HandleRef modelNode, Vec3[] vPtr, - Vec3[] nPtr, int vLength, int[] iPtr, int iLength); + Vec3[] nPtr, int vLength, int[] iPtr, int iLength); + + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_ModelNode_CastShadow")] + public static extern void CastShadow(global::System.Runtime.InteropServices.HandleRef model, bool castShadow); + + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_ModelNode_IsShadowCasting")] + [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)] + public static extern bool IsShadowCasting(global::System.Runtime.InteropServices.HandleRef model); + + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_ModelNode_ReceiveShadow")] + public static extern void ReceiveShadow(global::System.Runtime.InteropServices.HandleRef model, bool receiveShadow); + + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_ModelNode_IsShadowReceiving")] + [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)] + public static extern bool IsShadowReceiving(global::System.Runtime.InteropServices.HandleRef model); } } } diff --git a/src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs b/src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs index 7083221..18cbf05 100755 --- a/src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs +++ b/src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs @@ -595,6 +595,64 @@ namespace Tizen.NUI.Scene3D } /// + /// Sets whether this Model casts shadow or not. + /// If it is true, this model is drawn on Shadow Map. + /// Note: This method affects all of the child ModelNode. + /// However, same property of each child ModelNode can be changed respectively and it not changes parent's property. + /// + /// Whether this Model casts shadow or not. + // 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) + { + Interop.Model.CastShadow(SwigCPtr, castShadow); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves whether the Model casts shadow or not for Light. + /// Note: IBL does not cast any shadow. + /// + /// True if this model casts shadow. + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsShadowCasting() + { + var isShadowCasting = Interop.Model.IsShadowCasting(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return isShadowCasting; + } + + /// + /// Sets whether this Model receives shadow or not. + /// If it is true, shadows are drawn on this model. + /// Note: This method affects all of the child ModelNode. + /// However, same property of each child ModelNode can be changed respectively and it not changes parent's property. + /// + /// Whether this Model receives shadow or not. + // 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) + { + Interop.Model.ReceiveShadow(SwigCPtr, receiveShadow); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves whether the Model receives shadow or not for Light + /// If it is true, this model is drawn on Shadow Map. + /// + /// True if this model receives shadow. + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsShadowReceiving() + { + var isShadowReceiving = Interop.Model.IsShadowReceiving(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return isShadowReceiving; + } + + /// /// Retrieves model root Actor. /// /// Root View of the model. diff --git a/src/Tizen.NUI.Scene3D/src/public/ModelComponents/ModelNode.cs b/src/Tizen.NUI.Scene3D/src/public/ModelComponents/ModelNode.cs index 6f739c7..3c90609 100755 --- a/src/Tizen.NUI.Scene3D/src/public/ModelComponents/ModelNode.cs +++ b/src/Tizen.NUI.Scene3D/src/public/ModelComponents/ModelNode.cs @@ -238,6 +238,64 @@ namespace Tizen.NUI.Scene3D } /// + /// Sets whether this Model casts shadow or not. + /// If it is true, this model is drawn on Shadow Map. + /// Note: This method affects all of the child ModelNode. + /// However, same property of each child ModelNode can be changed respectively and it not changes parent's property. + /// + /// Whether this Model casts shadow or not. + // 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) + { + Interop.ModelNode.CastShadow(SwigCPtr, castShadow); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves whether the Model casts shadow or not for Light. + /// Note: IBL does not cast any shadow. + /// + /// True if this model casts shadow. + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsShadowCasting() + { + var isShadowCasting = Interop.ModelNode.IsShadowCasting(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return isShadowCasting; + } + + /// + /// Sets whether this Model receives shadow or not. + /// If it is true, shadows are drawn on this model. + /// Note: This method affects all of the child ModelNode. + /// However, same property of each child ModelNode can be changed respectively and it not changes parent's property. + /// + /// Whether this Model receives shadow or not. + // 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) + { + Interop.ModelNode.ReceiveShadow(SwigCPtr, receiveShadow); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves whether the Model receives shadow or not for Light + /// If it is true, this model is drawn on Shadow Map. + /// + /// True if this model receives shadow. + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsShadowReceiving() + { + var isShadowReceiving = Interop.ModelNode.IsShadowReceiving(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return isShadowReceiving; + } + + /// /// Gets the number of ModelPrimitive objects in the ModelNode object. /// /// The number of ModelPrimitive objects in the ModelNode object.