mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
Merge branch 'bloom_psprite_fix' into gzdoom
This commit is contained in:
commit
a46bbc81a0
4 changed files with 29 additions and 7 deletions
|
@ -161,12 +161,13 @@ void FGLRenderer::RenderScreenQuad()
|
|||
GLRenderer->mVBO->RenderArray(GL_TRIANGLE_STRIP, FFlatVertexBuffer::PRESENT_INDEX, 4);
|
||||
}
|
||||
|
||||
void FGLRenderer::PostProcessScene(int fixedcm)
|
||||
void FGLRenderer::PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D)
|
||||
{
|
||||
mBuffers->BlitSceneToTexture();
|
||||
UpdateCameraExposure();
|
||||
mCustomPostProcessShaders->Run("beforebloom");
|
||||
BloomScene(fixedcm);
|
||||
afterBloomDrawEndScene2D();
|
||||
TonemapScene();
|
||||
ColormapScene(fixedcm);
|
||||
LensDistortScene();
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "r_renderer.h"
|
||||
#include "r_data/matrix.h"
|
||||
#include "gl/dynlights/gl_shadowmap.h"
|
||||
#include <functional>
|
||||
|
||||
struct particle_t;
|
||||
class FCanvasTexture;
|
||||
|
@ -43,6 +44,7 @@ class F2DDrawer;
|
|||
class FHardwareTexture;
|
||||
class FShadowMapShader;
|
||||
class FCustomPostProcessShaders;
|
||||
class GLSceneDrawer;
|
||||
|
||||
inline float DEG2RAD(float deg)
|
||||
{
|
||||
|
@ -174,7 +176,7 @@ public:
|
|||
void RenderView(player_t* player);
|
||||
|
||||
void RenderScreenQuad();
|
||||
void PostProcessScene(int fixedcm);
|
||||
void PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D);
|
||||
void AmbientOccludeScene();
|
||||
void UpdateCameraExposure();
|
||||
void BloomScene(int fixedcm);
|
||||
|
|
|
@ -681,6 +681,25 @@ void GLSceneDrawer::EndDrawScene(sector_t * viewsector)
|
|||
|
||||
Reset3DViewport();
|
||||
|
||||
// Delay drawing psprites until after bloom has been applied, if enabled.
|
||||
if (!FGLRenderBuffers::IsEnabled() || !gl_bloom || FixedColormap != CM_DEFAULT)
|
||||
{
|
||||
DrawEndScene2D(viewsector);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Restore standard rendering state
|
||||
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl_RenderState.ResetColor();
|
||||
gl_RenderState.EnableTexture(true);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
void GLSceneDrawer::DrawEndScene2D(sector_t * viewsector)
|
||||
{
|
||||
const bool renderHUDModel = gl_IsHUDModelForPlayerAvailable(players[consoleplayer].camera->player);
|
||||
|
||||
// [BB] Only draw the sprites if we didn't render a HUD model before.
|
||||
if (renderHUDModel == false)
|
||||
{
|
||||
|
@ -706,7 +725,6 @@ void GLSceneDrawer::EndDrawScene(sector_t * viewsector)
|
|||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// R_RenderView - renders one view - either the screen or a camera texture
|
||||
|
@ -846,7 +864,7 @@ sector_t * GLSceneDrawer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, f
|
|||
if (mainview && toscreen) EndDrawScene(lviewsector); // do not call this for camera textures.
|
||||
if (mainview && FGLRenderBuffers::IsEnabled())
|
||||
{
|
||||
GLRenderer->PostProcessScene(FixedColormap);
|
||||
GLRenderer->PostProcessScene(FixedColormap, [&]() { if (gl_bloom && FixedColormap == CM_DEFAULT) DrawEndScene2D(lviewsector); });
|
||||
|
||||
// This should be done after postprocessing, not before.
|
||||
GLRenderer->mBuffers->BindCurrentFB();
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
void ProcessScene(bool toscreen = false);
|
||||
void DrawBlend(sector_t * viewsector);
|
||||
void EndDrawScene(sector_t * viewsector);
|
||||
void DrawEndScene2D(sector_t * viewsector);
|
||||
void RenderActorsInPortal(FGLLinePortal *glport);
|
||||
|
||||
void CheckViewArea(vertex_t *v1, vertex_t *v2, sector_t *frontsector, sector_t *backsector);
|
||||
|
|
Loading…
Reference in a new issue