Facepunch / garrysmod-requests

Feature requests for Garry's Mod
86 stars 24 forks source link

Add Poly() object, which behaves like IMesh to mesh library, but for surface.DrawPoly #2356

Closed Jaffies closed 4 months ago

Jaffies commented 7 months ago

The problem is that the only way you can cache polygons and draw some rounded shapes (roundedbox/circle) is to use textured polyfills, or use mesh generation and then drawing it by surface.DrawPoly(tab) or IMesh/mesh library. The problem is that if you cache IMesh, then it would work really fast, but it won't work with vgui library (it doesn't respond to vgui clipping nor vgui viewport manipulations. So you always need to make render.SetScissorRect() with absolute screen poses and draw meshes with panel:LocalToScreen(0, 0) as start coordinates, instead of 0, 0.

** surface.DrawPoly does work with vgui descently and it responds to viewport changes, unlike IMesh/mesh

If you would add Poly object which would work exactly like IMesh, but for surface.DrawPoly, then it will be really cheap to draw RoundedBoxes and make stencil work for them (for an example to make blur for them)

Jaffies commented 7 months ago

Here's a comparison: pic1 pic2 code

garryspins commented 5 months ago

Having this with a vb so polygons can be insanely fast would be phenomenal.

robotboy655 commented 5 months ago

This request sounds like another workaround for the same issue, just like https://github.com/Facepunch/garrysmod-requests/issues/2394