Commit Graph

71 Commits

Author SHA1 Message Date
Jonas Kulla 05b32d76ca Minor cleanup 2014-10-25 23:38:19 +02:00
Jonas Kulla c9d5059238 Pass value object attributes by reference (instead of pointer)
This underlines that no reference inside the setter is taken,
and that these attributes are non-nullable.

Also removes a couple of superfluous attribute macros.
2014-10-25 23:33:41 +02:00
Jonas Kulla 4a015c6397 Bitmap: Add font shadow rendering 2014-09-29 10:30:41 +02:00
Jonas Kulla 9e64dff01c Bitmap: Fix mem leak 2014-09-29 10:30:16 +02:00
Jonas Kulla 81ac0780f8 Revert Disposable concept back into core
Pretty much a revert of
e858bbdcf5.

We need this in core to properly implement F12 reset.
2014-09-23 21:12:58 +02:00
Jonas Kulla 673a25f811 Bitmap: Don't use 'pixman_region_clear'
It's not included in older pixman versions.
2014-09-07 19:11:20 +02:00
Jonas Kulla f8c26fc515 Core/MRI: Fix handling of Etc/Font properties
The gist of it is that for Etc and Font props, the assignment
operator (eg. 'sprite.color=') does not take a reference of the
right hand parameter and replaces its previous one with it (this
was the old behavior). Rather, it keeps its internal property
object and copies the parameter object into it by value.
The getter is unchanged; it still returns a reference to the
internal property object.

s = Sprite.new
c = Color.new
s.color = c
p s.color == c # => true
p s.color.object_id == c.object_id # => false (true before)
c = s.color
p s.color.object_id == c.object_id # => true
2014-09-05 01:58:41 +02:00
Jonas Kulla 55f1542c76 Merge separate RGSS version build configs into one
Setup active RGSS version at runtime. Desired version can be
specified via config, or as default, auto detected from the game
files. This removes the need to build specifically for each
version, which should help packaging a lot.

This also greatly reduces the danger of introducing code that
wouldn't compile on all RGSS version paths (as certain code paths
were completely ifdef'd out).

This can be optimized more, eg. not compiling shaders that aren't
needed in the active version.
2014-08-28 23:22:05 +02:00
Jonas Kulla b1981055e1 Core: Remove ifdefs that don't influence RGSS specific behavior
This is the first step in eliminating the build time RGSS
versioning.
2014-08-28 19:43:13 +02:00
Jonas Kulla c88b4b03d6 Bitmap: Fix blitshader draw_text path not taking squeezing into account 2014-08-28 14:53:28 +02:00
Jonas Kulla 7452331e04 Bitmap: Normalize rect passed to glState.scissorBox
glScissorBox doesn't like negative values.
2014-08-17 15:43:03 +02:00
Jonas Kulla 9311aff017 Bitmap: Draw line feed and carriage return as whitespace 2014-08-17 03:07:53 +02:00
Jonas Kulla bdd60291a7 Bitmap: Fix vertical gradient direction 2014-08-16 06:04:02 +02:00
Jonas Kulla e858bbdcf5 Lift 'Disposable' concept from core into bindings
Instead of replicating the RGSS Disposable interface in C++
and merely binding it, redefine the 'disposed' state as the
entire core object being deleted (and the binding object's
private pointer being null).

This makes the behavior more accurate in regard to RMXP.
It is now for example possible to subclass disposable classes
and access their 'dispose'/'disposed?' methods without
initializing the base class first (because the internal pointer
is simply null before initialization). Accessing any other
base methods will still raise an exception.

There are some quirks and irregular behavior in RMXP; eg.
most nullable bitmap attributes of disposable classes
(Sprite, Plane etc.) can still be queried afterwards, but
some cannot (Tilemap#tileset), and disposing certain
attributes crashes RMXP entirely (Tilemap#autotiles[n]).
mkxp tries to behave as close possible, but will be more
lenient some circumstances.

To the core, disposed bitmap attributes will look
identically to null, which slightly diverges from RMXP
(where they're treated as still existing, but aren't drawn).
The Disposable interface has been retained containing a
single signal, for the binding to inform core when
objects are disposed (so active attributes can be set to null).
2014-08-09 21:21:38 +02:00
Jonas Kulla 6c9fbc1465 Bitmap: Clip dest rect when blitting from mega surface 2014-08-09 21:21:38 +02:00
Jonas Kulla bdcf1503bd Bitmap: Normalize rectangle passed to pixman 2014-08-09 21:21:38 +02:00
Jonas Kulla ca9f83c6de Bitmap: Always upload data in GL_RGBA format 2014-07-21 01:38:22 +00:00
Jonas Kulla 27b7815f52 GLState: Remove 'BlendNone' mode in favor of disabling blending alltogether 2014-07-20 13:17:12 +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 b73461721c Add meta path with fallback for EXT_unpack_subimage parameters 2014-07-13 05:51:04 +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 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 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 58d86039d5 Merge branch 'dev' 2014-04-17 08:19:24 +02:00
Jonas Kulla 51c5ca1410 Graphics: Taint entire Bitmap in #snap_to_bitmap 2014-04-15 19:05:36 +02:00
Jonas Kulla bb8f2351cc Bitmap: Remove leftover 'flush()' calls 2014-02-02 23:36:01 +01:00
Jonas Kulla e0a4dfe372 Bitmap: Make #get_pixel/#set_pixel more accurate
This gets rid of the "batch/flush" semantics for #set_pixel
and instead just directly uploads the pixel color to the
texture, circumventing the float conversion entirely.
Also makes a lot of code simpler in many places as calling
'flush()' is no longer required for bitmaps.
2014-01-31 10:19:16 +01:00
Jonas Kulla b6a299541f Bitmap: Fix #get_pixel returning bogus values
We never bound the Bitmap FBO to the READ binding point,
so glReadPixels was blindly reading data off of whatever
was last bound there.
2014-01-28 16:38:10 +01:00
Jonas Kulla 96d2707edb Bitmap: Fix #get_pixel returning bogus values
We never bound the Bitmap FBO to the READ binding point,
so glReadPixels was blindly reading data off of whatever
was last bound there.
2014-01-28 16:34:28 +01:00
Jonas Kulla f3572f5ba4 Bitmap: Don't unbind shader after render op
Since all rendering is now shader based, there's normally
no reason to ever unbind a shader program.
2014-01-20 00:53:58 +01:00
Jonas Kulla 19dc83a5d5 Bitmap: Supply image filename on loading error 2014-01-05 10:28:35 +01:00
Edward Rudd eacc143ea0 update extension usage..
nearly all of the previous required extensions are CORE in OpenGL 2.0
the remaining ones need to have fallback checks for ARB vs EXT vs APPLE 
variants..
2013-12-31 16:31:03 -05:00
Jonas Kulla 2adf8ab265 Transition from QtCore to stdc++ / STL / boost
This looks like a pretty major change, but in reality,
80% of it is just renames of types and corresponding
methods.

The config parsing code has been completely replaced
with a boost::program_options based version. This
means that the config file format slightly changed
(checkout the updated README).

I still expect there to be bugs / unforseen events.
Those should be fixed in follow up commits.

Also, finally reverted back to using pkg-config to
locate and link libruby. Yay for less hacks!
2013-12-29 13:59:26 +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 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 226e860c38 Bitmap: Fix renaming issue in RGSS2 code 2013-12-04 15:53:42 +01:00
Jonas Kulla a65956818f Bitmap: Feed image extension into SDL2_image for faster loading 2013-11-30 14:28:50 +01:00
Jonas Kulla 28ff5cd33c Bitmap: Ensure cloned bitmap is non-mega 2013-10-31 10:26:39 +01:00
Jonas Kulla dcdfea55f1 Bitmap: Make 'Bitmap::textSize()' work with multibyte characters 2013-10-20 22:14:38 +02:00
Jonas Kulla d63c8cdc19 Bitmap: Add FIXME 2013-10-20 21:05:48 +02:00
Jonas Kulla 7236ca0515 Spacing 2013-10-19 01:47:12 +02:00
Jonas Kulla 9e3d7f579c Bitmap: Use PixelStore to avoid aux clip surface 2013-10-16 22:54:05 +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 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 49e7b66a53 Bitmap: s/tex/gl 2013-10-06 08:54:16 +02:00
Jonas Kulla d20b652155 No point in drawing spaces 2013-10-03 00:48:12 +02:00
Jonas Kulla d8dab9c429 Start ifdef'ing out RGSS2 functionality 2013-10-02 22:40:09 +02:00