Implement a new tileset atlas layout to allow for bigger tilesets

The atlas packing algorithm has been reworked to pack autotiles
and tileset very efficiently into a texture, splitting the tileset
in multiple ways and eliminating the previous duplication of image
data in the atlas across "frames". Animation, which these frames
were designed for, is now done via duplicated buffer frames,
ie. each animation frame has its own VBO and IBO data. This was
not done to save on VRAM (hardly less memory is used), but to
make place for the new atlas layout.
Thanks to this new layout, even with a max texture size of 2048,
one can use tilesets with up to 15000 height. Of course, such
a tileset couldn't be stored in a regular Bitmap to begin with,
which is why I also introduced a hack called "mega surfaces":
software surfaces stored in RAM and wrapped inside a Bitmap,
whose sole purpose is to be passed to a Tilemap as tilesets.

Various other minor changes and fixes are included.
This commit is contained in:
Jonas Kulla 2013-09-23 22:21:58 +02:00
parent 6b2c892280
commit 10ec55e39b
9 changed files with 637 additions and 177 deletions

View file

@ -31,6 +31,7 @@
class Font;
class ShaderBase;
struct TEXFBO;
struct SDL_Surface;
struct BitmapPrivate;
// FIXME make this class use proper RGSS classes again
@ -104,6 +105,8 @@ public:
/* <internal> */
void flush() const;
TEXFBO &getGLTypes();
SDL_Surface *megaSurface();
void ensureNonMega();
/* Binds the backing texture and sets the correct
* texture size uniform in shader */