scallyw4g / bonsai

A voxel engine in a pot
Do What The F*ck You Want To Public License
170 stars 10 forks source link

PushTexturedQuad clips and stretches weird #31

Closed scallyw4g closed 4 months ago

scallyw4g commented 6 months ago

If you open the textures window and drag it such that it clips against the game window (os window) bounds, the textures warp in a weird way like. IIRC this happens because the UVs are wrong.

scallyw4g commented 4 months ago

I'm fairly sure the offending code is in stdilb/src/ui/ui.cpp -- look at BufferTexturedQuad.

What's happening here is the dimensions (MinP, Dim) get clipped against three different rects; the window rect (the system window and problem child), then the bonsai window (called Clip), then a third, optional clip rect (useful for clipping text inside other boxes, like graphs, but unused in the texture window).

The problem happens in the case when the first call to ClipRect3AgainstRect2 returns ClipStatus_PartialClipping. It seems to me the UVs are getting clipped twice .. or something? I'm not quite sure what the issue is, but it's something wacky with the UVs.