- route the BlurScene call in the menu through DFrameBuffer.

Game code should never ever call the renderer directly. This must be done through the video interface so that it can also work with other framebuffers later.
This commit is contained in:
Christoph Oelckers 2018-05-18 00:22:57 +02:00
parent 2962fe9f08
commit 1656bbf9ec
5 changed files with 9 additions and 5 deletions

View file

@ -382,6 +382,11 @@ void OpenGLFrameBuffer::ResetFixedColormap()
}
}
void OpenGLFrameBuffer::BlurScene(float amount)
{
GLRenderer->BlurScene(amount);
}
bool OpenGLFrameBuffer::RenderBuffersEnabled()
{
return FGLRenderBuffers::IsEnabled();

View file

@ -43,6 +43,7 @@ public:
void BeginFrame() override;
bool RenderBuffersEnabled() override;
void SetOutputViewport(IntRect *bounds) override;
void BlurScene(float amount) override;
// Retrieves a buffer containing image data for a screenshot.
// Hint: Pitch can be negative for upside-down images, in which case buffer

View file

@ -96,7 +96,7 @@ void FSkyDomeCreator::SkyVertex(int r, int c, bool zflip)
static const float scale = 10000.;
FAngle topAngle = (c / (float)mColumns * 360.f);
FAngle sideAngle = maxSideAngle * (mRows - r) / mRows;
FAngle sideAngle = maxSideAngle * float(mRows - r) / float(mRows);
float height = sideAngle.Sin();
float realRadius = scale * sideAngle.Cos();
FVector2 pos = topAngle.ToVector(realRadius);

View file

@ -51,7 +51,6 @@
#include "menu/menu.h"
#include "vm.h"
#include "events.h"
#include "gl/renderer/gl_renderer.h" // for menu blur
#include "scripting/types.h"
//
@ -823,8 +822,7 @@ void M_Drawer (void)
if (CurrentMenu != nullptr && menuactive != MENU_Off)
{
if (GLRenderer)
GLRenderer->BlurScene(gameinfo.bluramount);
screen->BlurScene(gameinfo.bluramount);
if (!CurrentMenu->DontDim)
{
M_Dim();

View file

@ -411,7 +411,7 @@ public:
virtual int GetClientWidth() = 0;
virtual int GetClientHeight() = 0;
virtual bool RenderBuffersEnabled() { return false; };
virtual void BlurScene(float amount) {}
// Begin 2D drawing operations.
// Returns true if hardware-accelerated 2D has been entered, false if not.