2016-07-26 19:27:02 +00:00
|
|
|
#ifndef __GL_RENDERBUFFERS_H
|
|
|
|
#define __GL_RENDERBUFFERS_H
|
|
|
|
|
|
|
|
#include "gl/shaders/gl_shader.h"
|
|
|
|
|
2016-07-27 19:50:30 +00:00
|
|
|
class FGLBloomTextureLevel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GLuint VTexture = 0;
|
|
|
|
GLuint VFramebuffer = 0;
|
|
|
|
GLuint HTexture = 0;
|
|
|
|
GLuint HFramebuffer = 0;
|
|
|
|
GLuint Width = 0;
|
|
|
|
GLuint Height = 0;
|
|
|
|
};
|
|
|
|
|
2016-07-26 19:27:02 +00:00
|
|
|
class FGLRenderBuffers
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FGLRenderBuffers();
|
|
|
|
~FGLRenderBuffers();
|
|
|
|
|
|
|
|
void Setup(int width, int height);
|
2016-07-30 13:33:30 +00:00
|
|
|
void BlitSceneToTexture();
|
2016-07-26 19:27:02 +00:00
|
|
|
void BindSceneFB();
|
2016-07-30 13:33:30 +00:00
|
|
|
void BindSceneTextureFB();
|
2016-07-28 22:36:43 +00:00
|
|
|
void BindHudFB();
|
2016-07-26 19:27:02 +00:00
|
|
|
void BindOutputFB();
|
|
|
|
void BindSceneTexture(int index);
|
2016-07-28 22:36:43 +00:00
|
|
|
void BindHudTexture(int index);
|
2016-07-26 19:27:02 +00:00
|
|
|
|
2016-07-27 19:50:30 +00:00
|
|
|
enum { NumBloomLevels = 4 };
|
|
|
|
FGLBloomTextureLevel BloomLevels[NumBloomLevels];
|
|
|
|
|
2016-07-29 19:31:20 +00:00
|
|
|
static bool IsEnabled();
|
|
|
|
|
2016-07-31 14:23:21 +00:00
|
|
|
int GetWidth() const { return mWidth; }
|
|
|
|
int GetHeight() const { return mHeight; }
|
|
|
|
|
2016-07-26 19:27:02 +00:00
|
|
|
private:
|
2016-07-30 13:33:30 +00:00
|
|
|
void ClearScene();
|
|
|
|
void ClearHud();
|
|
|
|
void ClearBloom();
|
|
|
|
void CreateScene(int width, int height, int samples);
|
|
|
|
void CreateHud(int width, int height);
|
|
|
|
void CreateBloom(int width, int height);
|
2016-07-29 19:31:20 +00:00
|
|
|
GLuint Create2DTexture(GLuint format, int width, int height);
|
|
|
|
GLuint CreateRenderBuffer(GLuint format, int width, int height);
|
2016-07-30 13:33:30 +00:00
|
|
|
GLuint CreateRenderBuffer(GLuint format, int samples, int width, int height);
|
2016-07-29 19:31:20 +00:00
|
|
|
GLuint CreateFrameBuffer(GLuint colorbuffer);
|
2016-07-31 01:16:48 +00:00
|
|
|
GLuint CreateFrameBuffer(GLuint colorbuffer, GLuint depthstencil, bool colorIsARenderBuffer);
|
|
|
|
GLuint CreateFrameBuffer(GLuint colorbuffer, GLuint depth, GLuint stencil, bool colorIsARenderBuffer);
|
2016-07-30 13:33:30 +00:00
|
|
|
void CheckFrameBufferCompleteness();
|
2016-07-29 19:31:20 +00:00
|
|
|
void DeleteTexture(GLuint &handle);
|
|
|
|
void DeleteRenderBuffer(GLuint &handle);
|
|
|
|
void DeleteFrameBuffer(GLuint &handle);
|
2016-07-27 19:50:30 +00:00
|
|
|
|
2016-07-30 13:33:30 +00:00
|
|
|
int GetCvarSamples();
|
|
|
|
GLuint GetHdrFormat();
|
|
|
|
|
2016-07-26 19:27:02 +00:00
|
|
|
int mWidth = 0;
|
|
|
|
int mHeight = 0;
|
2016-07-30 13:33:30 +00:00
|
|
|
int mSamples = 0;
|
2016-07-26 19:27:02 +00:00
|
|
|
|
|
|
|
GLuint mSceneTexture = 0;
|
2016-07-30 13:33:30 +00:00
|
|
|
GLuint mSceneMultisample = 0;
|
2016-07-26 19:27:02 +00:00
|
|
|
GLuint mSceneDepthStencil = 0;
|
2016-07-29 19:31:20 +00:00
|
|
|
GLuint mSceneDepth = 0;
|
|
|
|
GLuint mSceneStencil = 0;
|
2016-07-26 19:27:02 +00:00
|
|
|
GLuint mSceneFB = 0;
|
2016-07-30 13:33:30 +00:00
|
|
|
GLuint mSceneTextureFB = 0;
|
2016-07-28 22:36:43 +00:00
|
|
|
GLuint mHudTexture = 0;
|
|
|
|
GLuint mHudFB = 0;
|
2016-07-26 19:27:02 +00:00
|
|
|
GLuint mOutputFB = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|