2019-12-28 17:20:47 +00:00
|
|
|
#ifndef __GL_RENDERER_H
|
|
|
|
#define __GL_RENDERER_H
|
|
|
|
|
|
|
|
#include "v_video.h"
|
|
|
|
#include "vectors.h"
|
|
|
|
#include "matrix.h"
|
2020-04-26 21:17:54 +00:00
|
|
|
#include "gl_renderbuffers.h"
|
2019-12-28 17:20:47 +00:00
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(disable:4244)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct particle_t;
|
|
|
|
class FCanvasTexture;
|
|
|
|
class FFlatVertexBuffer;
|
|
|
|
class FSkyVertexBuffer;
|
|
|
|
class HWPortal;
|
|
|
|
class FLightBuffer;
|
|
|
|
class DPSprite;
|
|
|
|
class FGLRenderBuffers;
|
|
|
|
class FGL2DDrawer;
|
|
|
|
class SWSceneDrawer;
|
|
|
|
class HWViewpointBuffer;
|
|
|
|
struct FRenderViewpoint;
|
|
|
|
|
|
|
|
namespace OpenGLRenderer
|
|
|
|
{
|
2020-05-31 08:53:11 +00:00
|
|
|
class FHardwareTexture;
|
2020-04-26 21:17:54 +00:00
|
|
|
class FShaderManager;
|
2019-12-28 17:20:47 +00:00
|
|
|
class FSamplerManager;
|
|
|
|
class OpenGLFrameBuffer;
|
|
|
|
class FPresentShaderBase;
|
|
|
|
class FPresentShader;
|
|
|
|
class FPresent3DCheckerShader;
|
|
|
|
class FPresent3DColumnShader;
|
|
|
|
class FPresent3DRowShader;
|
2020-04-26 21:17:54 +00:00
|
|
|
class FShadowMapShader;
|
2019-12-28 17:20:47 +00:00
|
|
|
|
|
|
|
class FGLRenderer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
OpenGLFrameBuffer *framebuffer;
|
|
|
|
int mMirrorCount = 0;
|
|
|
|
int mPlaneMirrorCount = 0;
|
2020-04-26 21:17:54 +00:00
|
|
|
FShaderManager *mShaderManager = nullptr;
|
2020-05-28 23:03:01 +00:00
|
|
|
FSamplerManager *mSamplerManager = nullptr;
|
2019-12-28 17:20:47 +00:00
|
|
|
unsigned int mFBID;
|
|
|
|
unsigned int mVAOID;
|
|
|
|
unsigned int mStencilValue = 0;
|
|
|
|
|
|
|
|
int mOldFBID;
|
|
|
|
|
|
|
|
FGLRenderBuffers *mBuffers = nullptr;
|
|
|
|
FGLRenderBuffers *mScreenBuffers = nullptr;
|
|
|
|
FGLRenderBuffers *mSaveBuffers = nullptr;
|
|
|
|
FPresentShader *mPresentShader = nullptr;
|
|
|
|
FPresent3DCheckerShader *mPresent3dCheckerShader = nullptr;
|
|
|
|
FPresent3DColumnShader *mPresent3dColumnShader = nullptr;
|
|
|
|
FPresent3DRowShader *mPresent3dRowShader = nullptr;
|
2020-04-26 21:17:54 +00:00
|
|
|
FShadowMapShader *mShadowMapShader = nullptr;
|
2019-12-28 17:20:47 +00:00
|
|
|
|
|
|
|
//FRotator mAngles;
|
|
|
|
|
|
|
|
FGLRenderer(OpenGLFrameBuffer *fb);
|
|
|
|
~FGLRenderer() ;
|
|
|
|
|
|
|
|
void Initialize(int width, int height);
|
|
|
|
|
|
|
|
void ClearBorders();
|
|
|
|
|
|
|
|
void PresentStereo();
|
|
|
|
void RenderScreenQuad();
|
|
|
|
void PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D);
|
|
|
|
void AmbientOccludeScene(float m5);
|
|
|
|
void ClearTonemapPalette();
|
|
|
|
void BlurScene(float gameinfobluramount);
|
|
|
|
void CopyToBackbuffer(const IntRect *bounds, bool applyGamma);
|
|
|
|
void DrawPresentTexture(const IntRect &box, bool applyGamma);
|
|
|
|
void Flush();
|
|
|
|
void BeginFrame();
|
|
|
|
|
|
|
|
bool StartOffscreen();
|
|
|
|
void EndOffscreen();
|
|
|
|
|
2020-05-25 21:59:07 +00:00
|
|
|
void BindToFrameBuffer(FGameTexture* tex);
|
2019-12-28 17:20:47 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2020-04-26 21:17:54 +00:00
|
|
|
bool QuadStereoCheckInitialRenderContextState();
|
|
|
|
void PresentAnaglyph(bool r, bool g, bool b);
|
|
|
|
void PresentSideBySide();
|
|
|
|
void PresentTopBottom();
|
|
|
|
void prepareInterleavedPresent(FPresentShaderBase& shader);
|
|
|
|
void PresentColumnInterleaved();
|
|
|
|
void PresentRowInterleaved();
|
|
|
|
void PresentCheckerInterleaved();
|
|
|
|
void PresentQuadStereo();
|
2019-12-28 17:20:47 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TexFilter_s
|
|
|
|
{
|
|
|
|
int minfilter;
|
|
|
|
int magfilter;
|
|
|
|
bool mipmapping;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
extern FGLRenderer *GLRenderer;
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|