Fix ssao no longer working

This commit is contained in:
Magnus Norddahl 2020-01-04 09:54:47 +01:00
parent ed813562eb
commit 0714155e3a
3 changed files with 11 additions and 14 deletions

View file

@ -437,7 +437,7 @@ void videoShowFrame(int32_t w)
if (gl_ssao) if (gl_ssao)
{ {
glDrawBuffers(1, buffers); glDrawBuffers(1, buffers);
OpenGLRenderer::GLRenderer->AmbientOccludeScene(GLInterface.GetMatrix(Matrix_Projection).get()[5]); OpenGLRenderer::GLRenderer->AmbientOccludeScene(GLInterface.GetProjectionM5());
glViewport(screen->mSceneViewport.left, screen->mSceneViewport.top, screen->mSceneViewport.width, screen->mSceneViewport.height); glViewport(screen->mSceneViewport.left, screen->mSceneViewport.top, screen->mSceneViewport.width, screen->mSceneViewport.height);
OpenGLRenderer::GLRenderer->mBuffers->BindSceneFB(true); OpenGLRenderer::GLRenderer->mBuffers->BindSceneFB(true);
glDrawBuffers(3, buffers); glDrawBuffers(3, buffers);

View file

@ -317,6 +317,7 @@ void GLInstance::UnbindAllTextures()
void GLInstance::SetMatrix(int num, const VSMatrix *mat) void GLInstance::SetMatrix(int num, const VSMatrix *mat)
{ {
if (num == Matrix_Projection) mProjectionM5 = mat->get()[5];
renderState.matrixIndex[num] = matrixArray.Size(); renderState.matrixIndex[num] = matrixArray.Size();
matrixArray.Push(*mat); matrixArray.Push(*mat);
} }

View file

@ -199,8 +199,7 @@ class GLInstance
int LastVB_Offset[2] = {}; int LastVB_Offset[2] = {};
IIndexBuffer* LastIndexBuffer = nullptr; IIndexBuffer* LastIndexBuffer = nullptr;
float mProjectionM5 = 1.0f; // needed by ssao
VSMatrix matrices[NUMMATRICES];
PolymostRenderState renderState; PolymostRenderState renderState;
FShader* activeShader; FShader* activeShader;
PolymostShader* polymostShader; PolymostShader* polymostShader;
@ -260,10 +259,7 @@ public:
LastIndexBuffer = (IIndexBuffer*)~intptr_t(0); LastIndexBuffer = (IIndexBuffer*)~intptr_t(0);
} }
const VSMatrix &GetMatrix(int num) float GetProjectionM5() { return mProjectionM5; }
{
return matrices[num];
}
void SetMatrix(int num, const VSMatrix *mat ); void SetMatrix(int num, const VSMatrix *mat );
void SetMatrix(int num, const float *mat) void SetMatrix(int num, const float *mat)
{ {