Fitting many images on smallest possible texture..
Blitz3D Forums/Blitz3D Beginners Area/Fitting many images on smallest possible texture..
| ||
I want to fit images of "almost" the same size on a texture, as small as possible. So I create a "imaginary" texture with a surface (width*Height) that is greater than the combined surfaces of the images. Try and see if they fit. If not, use a larger texture... and so on. Now I can think of several methods of "fitting", but those ar all slow, messy and kind of smelly. So my question is: Does anyone know code that does more ore less what I'm looking for? I know, I saw code that did something similar, in a tutorial about C++, (had to do with fitting aircrafts on a flightdeck), but I can't find that anymore. (sorry for being a lazy bum) |
| ||
I'm pretty sure I based my texture-packing code on this : http://www.blackpawn.com/texts/lightmaps/default.html I'd post my code but it's not very readable and I really don't remember much about it, so it'd likely be more trouble than it was worth. |
| ||
Code archives: http://blitzbasic.com/codearcs/codearcs.php?code=1208 Box packing by fredborg. |
| ||
WOW! I'd like to kiss you both on all of your 4 cheeks each. (So I'm kinda glad I can't actually) ;P The box packing by fredborg is similar to what I was trying to do, but with a nice fragrance, and it's also about ten times faster. The Packing Lightmaps example is pretty much how I remember that C++ tutorial. So I will convert it to something more Blitzy and compare it with Fredborgs code. If I can brew it into something decent, I'll post it here. |