This commit changes a bunch of internal rendering logic to
use FBOs in a way that doesn't violate the GL spec.
The water surface FBO's output texture was bound for reading
while at the same time rendering the water surface back into the
same FBO! Depending on the card/driver/load/zoom factor/moon phase,
this could lead to water surface flickering, chessboard effects,
and other visual glitches.
In order to fix this an extra FBO is needed.
In theory this is a simple fix but in practice this is the Aquaria
codebase and everything is more complicated than it has any right to be.
Couple other things:
- FBOs no longer have a depth renderbuffer. Aquaria never uses the depth
buffer for anything, so this can go to save some memory.
Also remove renderbuffer GL function pointers.
- Make FBOs multi-"paged". This is supposedly more efficient on desktop GL,
if glDrawBuffer() supports GL_COLOR_ATTACHMENTn. This is currently checked
via the presence of glDrawBuffersARB().
- Main core FBO now has 2 pages becaus it's needed for the water surface.
The same 2 pages are later used by the after effect manager to ping-pong
postprocessing shaders. Remove private after effect FBO.
TODO:
- There's still a bug in the one-fbo-multiple-binding-points code path.
-> for now glDrawBuffersARB must be NULL to work properly.
class Element is completely gone.
(The files are still there but no longer compiled in. Will delete later)
Broken still:
- support for vertical flip
- the editor
- culling
This takes out the last of the RenderObject mutables.
This also fixes the long-standing editor bug that map tiles
that are once moved to parallax layers and then back to a
normal layer keep their scroll factor until the tile is deleted
or the map saved and reloaded.
Observations:
- Entity::renderPass was never set to RENDER_ALL -> can simplify some things
- The initial pass check in RenderObject::render() was constant for each pass
-> All logic that is per-pass-constant can be moved to a renderability pre-check
- Core::overrideStartLayer, Core::overrideEndLayer, Core::rlayer were never used
- Should be possible eventually to prepare & render layers in parallel
I am not sure if the changes in this commit are 100% correct, but layer passes
are still working and the hug looks like it should.
Thinking about it, the overrideRenderPass functionality should never have existed.
The game scripts don't actually use entity_setRenderPass
(which in turn calls Entity::setOverrideRenderPass())
so I might remove that function in a future commit,
together with the rest of the "override" functionality.
This untangles some of the gigantic kitchen sink headers
in an attempt to split things into smaller files.
Also don't include gl.h, glext.h, windows.h,
and other such nonsense *everywhere*.
Lots of cleanups on the way too. More dead/unused code removal.
Remove incrFlag(), decrFlag() Lua functions.
Because of wrongly set firstFreeIdx some pointers were NULL, where they
shouldn't be, which caused hard to track down crashes.
This is an addition to af04d0c37698.