Gum icon indicating copy to clipboard operation
Gum copied to clipboard

[Gum] "Clips Children" doesn't work properly with rotation

Open Arcnor opened this issue 10 months ago • 4 comments

  1. Create a Parent and Text object, make Text child of Parent
  2. Add a lot of text to Text
  3. Enable "Clips Children" on Parent
  4. Rotate Parent

Clipping will ignore the rotation so it will look broken.

Arcnor avatar Oct 08 '23 16:10 Arcnor

Do you need clipping to respect rotation at 90 degree increments, or arbitrary angles? If 90i can implement a very quick fix. If any angle, it will take a little longer

vchelaru avatar Oct 09 '23 00:10 vchelaru

I'm animating something (or trying to :D), so angles will be random. Better to wait until the proper solution is in place, for sure :).

Arcnor avatar Oct 09 '23 07:10 Arcnor

I started on this by working on needing render targets to do rendering. This will allow an object to render itself to a render target and then to render that render target with rotation.

This is currently being worked on in Renderer.cs in this block of code:

if (renderable.ClipsChildren)
{
    var userRenderTarget = false;

    if(userRenderTarget)
    {
        var renderTarget = new RenderTarget2D(GraphicsDevice, 64, 64);
        renderState.RenderTarget = renderTarget;
        GraphicsDevice.SetRenderTarget(renderTarget);
        GraphicsDevice.Clear(Color.Transparent);
        shouldResetStates = true;
    }

vchelaru avatar Oct 14 '23 19:10 vchelaru

This work is in RenderTargetObjects branch.

vchelaru avatar Oct 15 '23 12:10 vchelaru