aphadeon / OpenGame.exe

A custom Ruby-powered game engine that supports RPG Maker games.
24 stars 11 forks source link

Added deferred Actions for Graphics RGSS class, any GPU commands done… #24

Closed felixjones closed 8 years ago

felixjones commented 8 years ago

… through fiber should be added as a deferred Action. See Bitmap.cs for exmaples. This lets text rendering happen on the GL context thread.

This fixes text rendering; win_tint

The way deferred Actions works may need revising as any dependency on the results of SyncBitmap in the Bitmap class is not taken into account (SyncBitmap is presumed to be entirely on the GL upload side of things).

EDIT: Changed from stack to queue because stack was a dumb choice from the start (wtf was I thinking)

This also means there could be 1 frame latency difference compared with the original RGSS implementation; this could be a problem in the future but at the moment it seems to work fine.

TODO: Get rid of the stupid mutex by using a thread safe queue. Apparently these exist as part of the concurrent collection.

felixjones commented 8 years ago

Latest commit also include Window tinting. Turns out the "gray" value is not used for window skins, so the colour tone can be easily done with fixed function pipeline and no need for shaders. Sweet.

It did highlight some parts of the GL renderer that I am not comfortable; there seems to be global states being set, this makes the renderer very rigid and tracking global states would eventually be required.

I added a series of TODO comments at the GL start up point to highlight what needs to be removed.

felixjones commented 8 years ago

Managed to get the blend equations the same as the original;

blend_test Left half is original RPG Maker, right half is OpenGame.exe

Background 1 is drawn with back_opacity as the alpha, then background 2 is tiled adding its own alpha to the background 1 alpha (glBlendFuncSeperate was used for this), then the tint additive is applied, then the tint subtractive is applied.

I've also separated the frame from the back_opacity as back_opacity is supposed to only affect background 1 and 2 together.

I've also noticed a bug, the title screen window for me is always full back opacity. This seems to have always been the case.

aphadeon commented 8 years ago

Amazing work. And you've earned yourself a bug bounty. I'll PM you on hbgames for details.