Commit Graph

13 Commits

Author SHA1 Message Date
Jonas Kulla 32361e513a Track 'tainted' area of Bitmaps to optimize blit operations
The 'tainted' area of a Bitmap describes what parts are no
longer in a 'cleared' state. When we blit to a fully cleared
are of a Bitmap at full opacity, we can completely disregard
the existing pixels in the operation, meaning we can skip any
blending calculations and just blit / upload straight to the
texture. This greatly speeds up text message rendering.

In the process, pixman has become a new dependency for mkxp,
but the results of this optimization are well worth it!
2013-09-25 13:49:24 +02:00
Jonas Kulla a9454fdf9c Fix nullpointer deref 2013-09-24 22:42:10 +02:00
Jonas Kulla 10ec55e39b 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.
2013-09-24 19:35:38 +02:00
Jonas Kulla 9e63fb6b64 Remove the remaining bits of deprecated GL usage
The drawing is now completely shader based, which makes away
with all usage of the depracted matrix stack. This also allows
us to do things like simple translations and texture coordinate
translation directly instead of doing everything indirectly
through matrices.

Fixed vertex attributes ('vertexPointer()' etc) are also
replaced with user defined attribute arrays.
2013-09-23 07:50:22 +02:00
Jonas Kulla 051c939f8d Free SDL surface if 'TexPool::request' throws 2013-09-06 15:52:45 +02:00
Jonas Kulla 6c7d751dbd Remove 'Default' FBO binding (only allow 'Read' and 'Draw')
Also make code more verbose by removing default mode
parameter value to 'FBO::bind'
2013-09-06 14:56:30 +02:00
Jonas Kulla abc927c91d Use EXT version of gl functions 2013-09-06 14:37:28 +02:00
Jonas Kulla b151a22f6e Rename 'Tex' to 'TEX' for consistency 2013-09-06 12:26:41 +02:00
Jonas Kulla f89cd2d207 Provide general purpose Quad in GlobalState 2013-09-04 19:07:28 +02:00
Jonas Kulla efa55ce6c2 Raise exception on invalid bitmap sizes
A difference to RMXP is that negative height values
will result in exceptions too.
Also change Bitmap constructors to not allocate Private
struct before potential exceptions.
2013-09-04 18:14:29 +02:00
Jonas Kulla 84db116d0c Rename 'bound' to 'clamp' 2013-09-03 15:31:29 +02:00
Jonas Kulla 108392217f Remove empty line 2013-09-03 11:15:04 +02:00
Jonas Kulla ff25887f41 Initial commit 2013-09-01 16:27:21 +02:00