Commit Graph

27 Commits

Author SHA1 Message Date
Jonas Kulla fbf02cf2ce Remove Qt style forloop 2013-12-27 06:19:30 +01:00
Jonas Kulla f3def32461 Constify 2013-12-27 06:11:18 +01:00
Jonas Kulla 231e38ae8e Replace QVector, QList with std::vector, std::list
An exception is made of TexPool, which will need a
bit more testing before transitioning to std containers.

Also replace 'int' with 'size_t' where it is used only
as an array index.
2013-12-26 20:18:33 +01:00
Jonas Kulla 0035c23641 Shader: Group all shaders in one collective struct
Makes sharedstate.{cpp|h} a lot easier to read, and
adding new shaders a one liner.
2013-12-11 05:22:13 +01:00
Jonas Kulla 8c6648f47e Use std algorithm functions 2013-12-08 13:19:22 +01:00
Jonas Kulla ef2430e0c3 Sanitize #include statements
The general rule I'm aiming for is to <> include
system wide / installed paths / generally everything
that's outside the git managed source tree (this means
mruby paths too!), and "" include everything else,
ie. local mkxp headers.

The only current exception are the mri headers, which
all have './' at their front as to not clash with
system wide ruby headers. I'm leaving them be for now
until I can come up with a better general solution.
2013-12-04 17:48:37 +01:00
Jonas Kulla 765fd55bce Tilemap: Use simple "TexPool" replacement for atlas allocation
Releasing a Tilemap atlas into the pool on every map switch
will blow out tons of smaller textures for very little gain,
as atlas textures are already pretty much impossible to
recycle anywhere but in new Tilemaps.
2013-10-22 06:36:13 +02:00
Jonas Kulla 397856089d Tilemap: Optimize atlas assembly from mega surface tileset
Use 'glPixelStorei()' parameters to upload sub images
directly from the same surface instead of creating
helper surfaces to upload from.
2013-10-16 19:20:36 +02:00
Jonas Kulla 39436ad231 Fix up SDL2 include paths
Using "SDL2/SDL_xxx.h" instead of "SDL_xxx.h" caused
the include paths provided by pkg-config to be ignored,
and headers from a standard include path to be used instead.
2013-10-13 23:21:34 +02:00
Jonas Kulla 23e712a730 Tilemap: Draw consecutive scanrows in one draw call
If consecutive scanrows in the scene list have no foreign
elements in between them, we batch them up and draw them
in one glDrawElements() call.

This should reduce the Tilemap induced draw calls on
average by at least 50 percent.
2013-10-13 22:00:38 +02:00
Jonas Kulla 99cfe9aefd Tilemap: Optimize scanrow z ordering 2013-10-13 12:58:56 +02:00
Jonas Kulla 4af4f5bd6b Ensure attached autotiles aren't mega surfaces 2013-10-09 18:08:44 +02:00
Jonas Kulla cb6f73f7df Rename 'GlobalState' to 'SharedState' to avoid confusion with GLState
This was particularly nasty with the shorthand macros
'gState' and 'glState'. The former is now 'shState'.
2013-10-09 12:30:33 +02:00
Jonas Kulla ba304feb54 Minor code move
Move animation based state data together and add comments
2013-10-09 11:52:39 +02:00
Jonas Kulla dd25323cdd Ifdef out more RGSS2 functionality 2013-10-06 10:28:03 +02:00
Jonas Kulla 20ec560145 Wrap color clear in 'FBO::clear()' convenience function 2013-10-01 13:10:14 +02:00
Jonas Kulla 9d34fc966b Tilemap: Clamp sampled tileset height to multiple of 32 2013-09-30 01:38:46 +02:00
Jonas Kulla 12c92d6dd0 Fix Tilemap's scanrow z sorting for good
Also make it a tad faster.
2013-09-27 04:42:22 +02:00
Jonas Kulla 0fc6022dd0 Use BlitSurface instead of UpperBlit (for forward-compat) 2013-09-25 17:07:26 +02:00
Jonas Kulla 4f08382c69 Replace 'tiles.bufferCount' with function 2013-09-24 20:11:55 +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 7a6c05bba0 Implement animated flash tiles in Tilemap
Flash tiles start with an alpha of 60, which ramps up to 120
in 16 frames and 4 steps, then ramps down again over the same period.
2013-09-23 08:27:28 +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 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 b151a22f6e Rename 'Tex' to 'TEX' for consistency 2013-09-06 12:26:41 +02:00
Jonas Kulla 0253b6ed2b Use C99 integer types instead of Qt's 2013-09-04 13:30:14 +02:00
Jonas Kulla ff25887f41 Initial commit 2013-09-01 16:27:21 +02:00