PurpleKingdomGames / indigo

An FP game engine for Scala.
https://indigoengine.io/
MIT License
611 stars 56 forks source link

9-Slice Shader / Material #455

Open davesmith00000 opened 1 year ago

davesmith00000 commented 1 year ago

Try and reuse some of the shader library shaders to make, say, a 9-slice shader and test reusability.

davesmith00000 commented 1 year ago

Duplicate of #425, suggested by @hobnob - closing that one down and keeping this one.

davesmith00000 commented 1 week ago

9 slicing is just specifying some margins on an image to control how it is stretched to fill the space.

The difficulty here is that we don't support render targets, so we can't stack n' store shader passes. Therefore, making a 9-slice that works for a Bitmap-like material is easy, but extending it work with all the other material types would mean custom variations of all the types. Maybe a Bitmap-like one is good enough though for UI building? Or at least, better than nothing?

davesmith00000 commented 1 week ago

That said... we have the notion of "Stretch modes". I wonder if that could be extended to support another 9-slice case? It is re-implemented in every shader (somehow), but it's just adding a new case to an existing mechanism, which seems... ok?