OpenGL2: Some FBO cleanup, and add non-depth blur to blur shader.
This commit is contained in:
parent
60f56670d6
commit
1f6703821f
8 changed files with 148 additions and 125 deletions
|
@ -980,11 +980,11 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
if (tr.hdrDepthFbo)
|
||||
{
|
||||
// need the depth in a texture we can do GL_LINEAR sampling on, so copy it to an HDR image
|
||||
ivec4_t srcBox;
|
||||
vec4_t srcTexCoords;
|
||||
|
||||
VectorSet4(srcBox, 0, tr.renderDepthImage->height, tr.renderDepthImage->width, -tr.renderDepthImage->height);
|
||||
VectorSet4(srcTexCoords, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
|
||||
FBO_BlitFromTexture(tr.renderDepthImage, srcBox, NULL, tr.hdrDepthFbo, NULL, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.renderDepthImage, srcTexCoords, NULL, tr.hdrDepthFbo, NULL, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
if (r_sunlightMode->integer && backEnd.viewParms.flags & VPF_USESUNLIGHT)
|
||||
|
@ -1584,6 +1584,71 @@ const void *RB_PostProcess(const void *data)
|
|||
else
|
||||
RB_GaussianBlur(backEnd.refdef.blurFactor);
|
||||
|
||||
#if 0
|
||||
if (0)
|
||||
{
|
||||
vec4_t quadVerts[4];
|
||||
vec2_t texCoords[4];
|
||||
ivec4_t iQtrBox;
|
||||
vec4_t box;
|
||||
vec4_t viewInfo;
|
||||
static float scale = 5.0f;
|
||||
|
||||
scale -= 0.005f;
|
||||
if (scale < 0.01f)
|
||||
scale = 5.0f;
|
||||
|
||||
FBO_FastBlit(NULL, NULL, tr.quarterFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
|
||||
iQtrBox[0] = backEnd.viewParms.viewportX * tr.quarterImage[0]->width / (float)glConfig.vidWidth;
|
||||
iQtrBox[1] = backEnd.viewParms.viewportY * tr.quarterImage[0]->height / (float)glConfig.vidHeight;
|
||||
iQtrBox[2] = backEnd.viewParms.viewportWidth * tr.quarterImage[0]->width / (float)glConfig.vidWidth;
|
||||
iQtrBox[3] = backEnd.viewParms.viewportHeight * tr.quarterImage[0]->height / (float)glConfig.vidHeight;
|
||||
|
||||
qglViewport(iQtrBox[0], iQtrBox[1], iQtrBox[2], iQtrBox[3]);
|
||||
qglScissor(iQtrBox[0], iQtrBox[1], iQtrBox[2], iQtrBox[3]);
|
||||
|
||||
VectorSet4(box, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
|
||||
texCoords[0][0] = box[0]; texCoords[0][1] = box[3];
|
||||
texCoords[1][0] = box[2]; texCoords[1][1] = box[3];
|
||||
texCoords[2][0] = box[2]; texCoords[2][1] = box[1];
|
||||
texCoords[3][0] = box[0]; texCoords[3][1] = box[1];
|
||||
|
||||
VectorSet4(box, -1.0f, -1.0f, 1.0f, 1.0f);
|
||||
|
||||
VectorSet4(quadVerts[0], box[0], box[3], 0, 1);
|
||||
VectorSet4(quadVerts[1], box[2], box[3], 0, 1);
|
||||
VectorSet4(quadVerts[2], box[2], box[1], 0, 1);
|
||||
VectorSet4(quadVerts[3], box[0], box[1], 0, 1);
|
||||
|
||||
GL_State(GLS_DEPTHTEST_DISABLE);
|
||||
|
||||
|
||||
VectorSet4(viewInfo, backEnd.viewParms.zFar / r_znear->value, backEnd.viewParms.zFar, 0.0, 0.0);
|
||||
|
||||
viewInfo[2] = scale / (float)(tr.quarterImage[0]->width);
|
||||
viewInfo[3] = scale / (float)(tr.quarterImage[0]->height);
|
||||
|
||||
FBO_Bind(tr.quarterFbo[1]);
|
||||
GLSL_BindProgram(&tr.depthBlurShader[2]);
|
||||
GL_BindToTMU(tr.quarterImage[0], TB_COLORMAP);
|
||||
GLSL_SetUniformVec4(&tr.depthBlurShader[2], UNIFORM_VIEWINFO, viewInfo);
|
||||
RB_InstantQuad2(quadVerts, texCoords);
|
||||
|
||||
FBO_Bind(tr.quarterFbo[0]);
|
||||
GLSL_BindProgram(&tr.depthBlurShader[3]);
|
||||
GL_BindToTMU(tr.quarterImage[1], TB_COLORMAP);
|
||||
GLSL_SetUniformVec4(&tr.depthBlurShader[3], UNIFORM_VIEWINFO, viewInfo);
|
||||
RB_InstantQuad2(quadVerts, texCoords);
|
||||
|
||||
SetViewportAndScissor();
|
||||
|
||||
FBO_FastBlit(tr.quarterFbo[1], NULL, NULL, NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
FBO_Bind(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (0 && r_sunlightMode->integer)
|
||||
{
|
||||
ivec4_t dstBox;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue