Commit Graph

583 Commits

Author SHA1 Message Date
Jonas Kulla 20e46a98dd Plane: Add fallback without GL_REPEAT texture wrapping
This isn't supported under GLES 2.0 for npot textures.
2014-07-17 10:09:58 +02:00
Jonas Kulla a17043f785 MRI-Binding: Bitmap#get_pixel always returns a Color object 2014-07-16 17:39:39 +02:00
Jonas Kulla 3a3ccf590e Plane: Don't set dirty flags when settings props to existing value 2014-07-16 13:43:13 +02:00
Jonas Kulla b878149f5c MRI-Binding: Properly init Bitmap in Graphics#snap_to_bitmap 2014-07-16 05:27:16 +02:00
Jonas Kulla b8d861b4cd gl-util.h: Remove wrappers for things abstracted via GLMeta 2014-07-16 05:22:43 +02:00
Jonas Kulla bae977d4ab GLMeta: "Finish" -> "End" 2014-07-16 04:53:08 +02:00
Jonas Kulla a26c73930d GLMeta: Add framebuffer blitting support 2014-07-16 04:48:40 +02:00
Jonas Kulla 7ad6b7b5df MRI-Binding: Add some RGSS2 Graphics bindings 2014-07-15 12:34:58 +02:00
Jonas Kulla 4a3a769b15 Graphics: Properly initialize uniform before drawing 2014-07-15 11:54:31 +02:00
Jonas Kulla 97f18beb91 Graphics: Remove dubious optimization 2014-07-15 11:53:34 +02:00
Jonas Kulla c5f18ee535 Print SDL error message if window creation fails 2014-07-14 06:22:49 +02:00
Jonas Kulla 35dbaab0c3 Shader: Use GetShader/Programiv instead of GetObjectParameterivARB
The former are core 2.0 while the latter is part of GL_ARB_shader_objects.
2014-07-14 04:13:15 +02:00
Jonas Kulla f7d63bafd0 Merge pull request #46 from BlackLotus/master
Added new source files to CMakeLists.txt
2014-07-13 23:54:10 +02:00
Thomas Schneider 20db1a7b39 Added some cmake deps 2014-07-13 22:18:27 +02:00
Jonas Kulla 97708d25b6 Tilemap: Reduce a few unnecessary blits
No need to replicate static autotiles if we're not animating
at all.
2014-07-13 14:05:56 +02:00
Jonas Kulla efb2fd2695 GLMeta: Add vertex array object support 2014-07-13 14:05:12 +02:00
Jonas Kulla dac1407120 Add some comments 2014-07-13 13:38:50 +02:00
Jonas Kulla b73461721c Add meta path with fallback for EXT_unpack_subimage parameters 2014-07-13 05:51:04 +02:00
Jonas Kulla a541cb1205 Some RGSS2/RGSS3 compile fixes 2014-07-13 05:34:18 +02:00
Jonas Kulla 91aefdc17a Tilemap: Fix map wrap around 2014-07-11 08:43:39 +02:00
Jonas Kulla d1bad9b45f Bitmap#get_pixel: Use cached client side copy of pixels
A very simplistic optimization for games that create a
Bitmap and then only ever query pixels from it.
2014-07-11 03:25:28 +02:00
Jonas Kulla caae9c5689 Wrap IBO index type into one definition
Makes it easier to switch between types (eg. 32 -> 16 bit).
2014-07-11 02:09:53 +02:00
Jonas Kulla 295e0e5b15 Tilemap: Rewrite to only process and render visible region
Previously, on creation, we would parse the entire map data,
translating it into and uploading vertices once, then rendering
the entire map on every draw (to keep the draw calls minimal).
This worked great for smaller and medium sized maps, but starting
with larger maps (200x200+) it doesn't scale as the GPUs vertex
processing/culling is overwhelmed by the amount of data each frame.

This rewrite instead changes the strategy to only processing and
uploading a small subregion of the map (the currently visible part)
and regenerating all buffers if this subregion changes. The amount
of data transferred is small enough that it can be done every frame
without causing lag.

The changes also have the convenient side effect that we no longer
require 32 bit indices in mkxp, easing the road to possible GLES2
support in the future.
2014-07-11 02:00:30 +02:00
Jonas Kulla 300e61c64b TileAtlas: Fix broken atlas generation
The stuff committed in 56226c40c6
was actually completely broken.. oops.
2014-07-10 21:48:33 +02:00
Jonas Kulla c0f25548bd CMakeLists.txt: Add new file "tilemap.vert" 2014-07-09 17:11:05 +02:00
Jonas Kulla 6bbdf7e183 Bitmap#blt: Clamp source rect to source bitmap bounds
RGSS allows the source rectangle in both `blt` and
`stretch_blt` to lie outside the source bitmap bounds
(treating the missing data as (0, 0, 0, 0)) and to be
inverted (in which case the blitted image is also inverted).

This commit only hanldes a corner case that
arises in the game "Last Scenario"; emulating the full
RGSS behavior is however desirable.
2014-07-09 03:06:43 +02:00
Jonas Kulla 527a372bd3 Window: Fix contents not being drawn if no windowskin is set 2014-07-09 02:47:32 +02:00
Jonas Kulla 56226c40c6 Tilemap: Use vertex shader based autotile animation strategy
Previously, we would just stuff the entire tilemap vertex data
four times into the buffers, with only the autotile vertices
offset according to the animation frame. This meant we could
prepare the buffers once, and then just bind a different offset
for each animation frame without any shader changes, but it also
lead to a huge amount of data being duplicated (and blowing up
the buffer sizes).

The new method only requires one buffer, and instead animates by
recognizing vertices belonging to autotiles in a custom vertex
shader, which offsets them on the fly according to the animation
index.

With giant tilemaps, this method would turn out to be a little
less efficient, but considering the Tilemap is planned to be
rewritten to only hold the range of tiles visible on the screen
in its buffers, the on the fly offsetting will become neglient,
while at the same time the amount of data we have to send to the
GPU everytime the tilemap is updated is greatly reduced; so a
net win in the end.
2014-07-06 19:44:19 +02:00
Jonas Kulla 033d46a293 Window: Use bilinear filtering for drawing controls
See #44
2014-07-03 14:32:03 +02:00
Jonas Kulla 4a0084801e Graphics: Respect non-default initial window size 2014-07-03 02:48:28 +02:00
Jonas Kulla 843a7bf571 gl-fun.h: Fix KHR_debug function signatures 2014-06-24 23:56:13 +02:00
Jonas Kulla 902a5e8c76 README: Clarify SDL_sound version 2014-06-21 17:01:05 +02:00
Jonas Kulla a4615fb8cc Add copyright notice to gl-fun.{cpp,h} 2014-06-15 07:52:26 +02:00
Jonas Kulla 6808b9a6dd SoundEmitter: Optimize source allocation strategy
Before, we would blindly rotate through the sources (like a
revolver through its chambers), which worked great if one
assumed all sounds to be relatively short and therefore oldest
use == most likely to be free, but breaks if there is one long
sound playing, which would be stopped and overtaken if we rotated
back to it even though there might be other free sources available.

Instead, keep an ascending priority list of sources with last
used == highest priorty that is iterated through for the first
free one, and only if none is found overtake the one with lowest
priority. This also ensures we're always able to play 'SE_SOURCES'
sounds at once independently of their length.

Fixes #37.
2014-06-15 06:26:34 +02:00
Jonas Kulla 282d547ad4 Remove Perftimer classes
Performance can still be crudely measured by turning off
the framelimit and observing the FPS count. For everything
else, there's always callgrind / apitrace.
2014-06-13 19:01:15 +02:00
Jonas Kulla 6c481e5eb8 Eliminate GLEW dependency
GL entrypoint resolution is now done manually. This has a couple
immediate benefits, such as not having to retrieve hundreds of
functions pointers that we'll never use. It's also nice to have
an exact overview of all the entrypoints used by mkxp.

This change allows mkxp to run fine with core contexts, not sure
how relevant that is going to be in the future.

What's noteworthy is that  _all_ entrypoints, even the ones core
in 1.1 and guaranteed to be in every libGL, are resolved
dynamically.
This has the added benefit of not having to link directly against
libGL anymore, which also cleans up the output of `ldd` quite
a bit (SDL2 loads most system deps dynamically at runtime).

GL headers are still required at build time.
2014-06-13 18:46:45 +02:00
Jonas Kulla 640b01e518 Graphics: Fix double calculation being a fixed point division 2014-06-12 14:31:29 +02:00
Jonas Kulla 3ac8f1e8aa Actually, don't disable that on Windows 2014-06-12 12:54:10 +02:00
Jonas Kulla aed7ba6672 Graphics: Check for nanosleep errors, disable on Windows (for now) 2014-06-12 10:40:17 +02:00
Jonas Kulla 06b218d5d7 Don't rely on non-standard typedef (thanks @ntzrmtthihu777) 2014-06-08 06:59:35 +02:00
Jonas Kulla 013437074b gitignore: Add codeblocks files 2014-06-08 06:55:37 +02:00
Jonas Kulla 2cc2ebca31 GLState: Get rid of GL_TEXTURE_2D enable/disable
This bit was deprecated/removed in core GL.

There was only one place where this was used (flash tiles
in Tilemap), and since the full shader rewrite, it was
effectively a no-op anyway (flash shader doesn't sample texture).
2014-05-30 23:13:58 +02:00
Jonas Kulla 7b1f599dd6 mkxp.pro: Add 'BOOST_LIB_SUFFIX'
Boost being boost.
2014-05-30 23:13:58 +02:00
Jonas Kulla 5ba40369cc Don't unnecessarily expose internal constant 2014-05-30 23:13:58 +02:00
Jonas Kulla ad63c962c6 Merge pull request #32 from cremno/use-rb_funcall2-instead-of-rb_funcallv
use `rb_funcall2` instead of `rb_funcallv`
2014-05-25 13:28:31 +02:00
cremno e6a116f43f use `rb_funcall2` instead of `rb_funcallv`
In 2.1 `rb_funcall2`  was renamed to `rb_funcallv` and
a macro for backward compatibility was added.
2014-05-25 12:57:04 +02:00
Jonas Kulla 0ef68a2eb7 Audio: Remove unused float helper code
Let's us get rid of 'alext.h' include,
which doesn't exist on OSX.
2014-05-24 18:26:04 +02:00
Jonas Kulla ce0fee0641 Spacing 2014-05-24 18:24:51 +02:00
Jonas Kulla 70279f0fdc mkxp.pro: Remove stray linker parameter 2014-05-24 18:24:10 +02:00
Jonas Kulla ea20154978 Spacing 2014-05-22 05:49:06 +02:00