pokepetter / ursina

A game engine powered by python and panda3d.
https://pokepetter.github.io/ursina/
MIT License
2.23k stars 328 forks source link

Add a NineSlice from Mesh class, to create scalable textures #728

Closed PaologGithub closed 1 month ago

PaologGithub commented 1 month ago

A NineSlice texture is to cut the texture in nine, like this: 4 Corners 4 Borders 1 Middle

With this, you can use one 32x32 texture, to make buttons that have the same texture, but not streched or squeeshed.

This pull request add a new NineSlice class, that is based from the Mesh class. It adds too a nine_sliced texture, so we can see the nine cuts.

pokepetter commented 1 month ago

I already have a work in progress for nine-slice, that also supports 3D. I guess you could call it 27-slice. However, this could be nice to have right now. Needs one small change though. The script should be in ursina/models/procedural/ alongside the other procedural models.

PaologGithub commented 1 month ago

Okay, I will change the location

PaologGithub commented 1 month ago

Did it

PaologGithub commented 1 month ago

Thanks :,)