cables-gl / cables_docs

cables documentation docs.cables.gl
https://cables.gl/docs/docs
45 stars 16 forks source link

RectangleTexture - prevent rounded corners from skewing with aspect ratio #909

Closed pandrr closed 3 days ago

pandrr commented 1 week ago

Discussed in https://github.com/cables-gl/cables_docs/discussions/908

Originally posted by **mariomatasystems** November 12, 2024 I notice if the RectangleTexture is not 1:1 the rounded corners skew, Screenshot 2024-11-12 at 21 55 28 It would be more useful to keep the rounded corners consistent Might be wrong (chatgpt) but i think we can tweak the frag code to account for the aspect. changing this float roundn=roundness*min(size.x,size.y); to this vec2 aspectScale = vec2(1.0, size.y / size.x); float roundn = roundness * length(size * aspectScale);
marioepsley commented 20 hours ago

I see this is closed, just checked on dev (using Ops.Gl.ImageCompose.RectangleTexture_v5 -) and I think it's still feeding off the dimensions of the image compose. In dev I took these photos; fine when the image compose width and height are equal, if not equal you get skewed corners still. that said there seems to be some consistency compared to before.

Screenshot 2024-11-21 at 10 15 08 Screenshot 2024-11-21 at 10 15 00
pandrr commented 19 hours ago

i closed the issue, the discussion is still there. did you test this code you pasted ? it does not work, or am i not understanding? sorry, we have no interest in fixing/debugging ai generated code

marioepsley commented 19 hours ago

Sorry I didn't check it because every time I play with a frag file something goes wrong for me. I just mentioned it because i thought it might be useful for you guys. Sorry about that. Was just trying to help. I'll move over to the discussion. I think the idea of fixed rounded corners is useful anyway for this op though.