[NUI][DirectRenderingGLView] Add RenderCallbackInput include WorldColor
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 16 Apr 2025 10:24:42 +0000 (19:24 +0900)
committerSangHyeon Jade Lee <dltkdgus1764@gmail.com>
Thu, 17 Apr 2025 07:55:55 +0000 (16:55 +0900)
Let we include `RenderCallbackInput` world color infomation.
It will be useful when DRGLView itself (or it's parent's) opacity changed.

Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI/src/internal/Interop/Interop.GLView.cs
src/Tizen.NUI/src/public/BaseComponents/DirectRenderingGLView.cs
test/NUIGLView/NUIDirectRenderingGLViewSample/DirectRenderingGLViewSample.cs
test/NUIGLView/NUIDirectRenderingGLViewSample/lib/libNUIDirectRenderingGLView-callbacks.so

index e58b52e8eda89574c89b04d5dcf21e34e3827ce6..1c2561229ed7f754625e95a7fe4448591315498a 100644 (file)
@@ -68,6 +68,9 @@ namespace Tizen.NUI
 
             [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_RenderCallbackInput_TextureBindings_get")]
             public static extern global::System.IntPtr GlViewGetRednerCallbackInputTextureBindings(global::System.IntPtr renderInput, ref int size);
+
+            [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_RenderCallbackInput_WorldColor_get")]
+            public static extern global::System.IntPtr GlViewGetRednerCallbackInputWorldColor(global::System.IntPtr renderInput);
         }
     }
 }
index 06ef287ecabbfd0515aa32320f6d3c9dd4d3484f..8f26de0f1cc41329eb84596ee9b96eb5c8dd1f51 100644 (file)
@@ -25,14 +25,16 @@ namespace Tizen.NUI.BaseComponents
             Matrix mvp;
             Matrix projection;
             Size2D size;
+            Color worldColor;
             Rectangle clippingBox;
             ReadOnlyCollection<int> textureBindings;
 
-            public RenderCallbackInput(Matrix mvp, Matrix projection, Size2D size, Rectangle clippingBox, int[] textureBindings)
+            public RenderCallbackInput(Matrix mvp, Matrix projection, Size2D size, Color worldColor, Rectangle clippingBox, int[] textureBindings)
             {
                 this.mvp = mvp;
                 this.projection = projection;
                 this.size = size;
+                this.worldColor = worldColor;
                 this.clippingBox = clippingBox;
                 this.textureBindings = new ReadOnlyCollection<int>(textureBindings);
             }
@@ -61,6 +63,14 @@ namespace Tizen.NUI.BaseComponents
                 get { return size; }
             }
 
+            /// <summary>
+            /// The World color of the DirectRenderingGLView
+            /// </summary>
+            public Color WorldColor
+            {
+                get { return worldColor; }
+            }
+
             /// <summary>
             /// The area of DirectRenderingGLView. You can use this for glScissor()
             /// </summary>
@@ -328,10 +338,11 @@ namespace Tizen.NUI.BaseComponents
                 Matrix mvp = Matrix.GetMatrixFromPtr(Interop.GLView.GlViewGetRednerCallbackInputMvp(cPtr));
                 Matrix projection = Matrix.GetMatrixFromPtr(Interop.GLView.GlViewGetRednerCallbackInputProjection(cPtr));
                 Size2D size = Size2D.GetSize2DFromPtr(Interop.GLView.GlViewGetRednerCallbackInputSize(cPtr), false);
+                Color worldColor = Color.GetColorFromPtr(Interop.GLView.GlViewGetRednerCallbackInputWorldColor(cPtr));
                 Rectangle clippingBox = Rectangle.GetRectangleFromPtr(Interop.GLView.GlViewGetRednerCallbackInputClipplingBox(cPtr), false);
                 int[] textureBindings = GetTextureBindings(cPtr);
 
-                RenderCallbackInput input = new RenderCallbackInput(mvp, projection, size, clippingBox, textureBindings);
+                RenderCallbackInput input = new RenderCallbackInput(mvp, projection, size, worldColor, clippingBox, textureBindings);
 
                 return glRenderFrameCallback(input);
             }
index 8578517f6495101261b0d96b324f01b4ea89d38b..5c9a45bc2a787064f5e71ac7e84455c3ee24a039 100644 (file)
@@ -47,6 +47,9 @@ namespace DRGLApplication
         [global::System.Runtime.InteropServices.DllImport(lib, EntryPoint = "getAngle")]
         public static extern int getAngle();
 
+        [global::System.Runtime.InteropServices.DllImport(lib, EntryPoint = "setWorldColor")]
+        public static extern int setWorldColor(float r, float g, float b, float a);
+
         private string TAG = "NUIDRGLVIEW";
 
         private DirectRenderingGLView glView;
@@ -61,6 +64,8 @@ namespace DRGLApplication
 
         private int mNumTouched = 0;
 
+        private Animation opacityAnimation;
+
         protected override void OnCreate()
         {
             base.OnCreate();
@@ -177,6 +182,12 @@ namespace DRGLApplication
             layoutView.Add(glViewLayout);
             layoutView.Add(textButton);
 
+            opacityAnimation = new Animation(10000);
+            opacityAnimation.LoopingMode = Animation.LoopingModes.AutoReverse;
+            opacityAnimation.Looping = true;
+            opacityAnimation.AnimateTo(layoutView, "Opacity", 0.25f, new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseInOutSine));
+            opacityAnimation.Play();
+
             LoadTexture();
 
             TextLabel labelz = new TextLabel("Hello World!");
@@ -297,11 +308,13 @@ namespace DRGLApplication
             log.Error(TAG, $"  Window Rotated? : {isRotated}\n");
             log.Error(TAG, $"  Window PositionSize : {localWindowPositionSize.X},{localWindowPositionSize.Y} : {localWindowPositionSize.Width}x{localWindowPositionSize.Height}\n");
             log.Error(TAG, $"  Size : {input.Size.Width}, {input.Size.Height}\n");
+            log.Error(TAG, $"  WorldColor : {input.WorldColor.R}, {input.WorldColor.G} {input.WorldColor.B} {input.WorldColor.A}\n");
             log.Error(TAG, $"  Clipping : {input.ClippingBox.X},{input.ClippingBox.Y} : {input.ClippingBox.Width}x{input.ClippingBox.Height}\n");
 
             // Note that we should use view port position always (0,0), since it depend on window size
             setViewport(0, 0, localWindowPositionSize.Width, localWindowPositionSize.Height);
             setSize(input.Size.Width, input.Size.Height);
+            setWorldColor(input.WorldColor.R, input.WorldColor.G, input.WorldColor.B, input.WorldColor.A);
 
             // Note that input.ClippingBox's (0,0) is left-bottom of window (not include rotation!).
             // And glScissor need to (0,0) is left-bottom of window (not include rotation!).
@@ -354,11 +367,13 @@ namespace DRGLApplication
             {
                 textButton.TextLabel.Text = "Start";
                 glView.RenderingMode = GLRenderingMode.OnDemand;
+                opacityAnimation.Pause();
             }
             else
             {
                 textButton.TextLabel.Text = "Stop";
                 glView.RenderingMode = GLRenderingMode.Continuous;
+                opacityAnimation.Play();
             }
         }
 
index eb4dbe940d113ee2ffcb69121b72e84d14a467de..e15d33df93ed9a700bb2f296bf03ef1288088791 100755 (executable)
Binary files a/test/NUIGLView/NUIDirectRenderingGLViewSample/lib/libNUIDirectRenderingGLView-callbacks.so and b/test/NUIGLView/NUIDirectRenderingGLViewSample/lib/libNUIDirectRenderingGLView-callbacks.so differ