Moved more shaders.

This commit is contained in:
hiker 2015-05-19 16:40:47 +10:00
parent 52017e31ea
commit 553a0a8b58
3 changed files with 24 additions and 22 deletions

View File

@ -457,19 +457,6 @@ namespace FullScreenShader
assignUniforms("direction", "col");
}
ShadowMatrixesGenerationShader::ShadowMatrixesGenerationShader()
{
loadProgram(OBJECT,
GL_COMPUTE_SHADER, "shadowmatrixgeneration.comp");
assignUniforms("SunCamMatrix");
GLuint block_idx = glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK, "BoundingBoxes");
glShaderStorageBlockBinding(m_program, block_idx, 2);
block_idx = glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK, "NewMatrixData");
glShaderStorageBlockBinding(m_program, block_idx, 1);
}
GlowShader::GlowShader()
{
loadProgram(OBJECT,

View File

@ -88,13 +88,6 @@ public:
SunLightShader();
};
class ShadowMatrixesGenerationShader : public Shader <ShadowMatrixesGenerationShader, core::matrix4>
{
public:
ShadowMatrixesGenerationShader();
};
class GlowShader : public TextureShader<GlowShader, 1>
{
public:

View File

@ -53,6 +53,28 @@ public:
} // LightspaceBoundingBoxShader
}; // LightspaceBoundingBoxShader
// ============================================================================
class ShadowMatricesGenerationShader
: public Shader <ShadowMatricesGenerationShader, core::matrix4>
{
public:
ShadowMatricesGenerationShader()
{
loadProgram(OBJECT, GL_COMPUTE_SHADER, "shadowmatrixgeneration.comp");
assignUniforms("SunCamMatrix");
GLuint block_idx =
glGetProgramResourceIndex(m_program,
GL_SHADER_STORAGE_BLOCK, "BoundingBoxes");
glShaderStorageBlockBinding(m_program, block_idx, 2);
block_idx =
glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK,
"NewMatrixData");
glShaderStorageBlockBinding(m_program, block_idx, 1);
}
}; // ShadowMatricesGenerationShader
// ============================================================================
static std::vector<vector3df> getFrustrumVertex(const scene::SViewFrustum &frustrum)
{
@ -194,8 +216,8 @@ void IrrDriver::updateSplitAndLightcoordRangeFromComputeShaders(size_t width,
GL_STATIC_COPY);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, tempShadowMatssbo);
FullScreenShader::ShadowMatrixesGenerationShader::getInstance()->use();
FullScreenShader::ShadowMatrixesGenerationShader::getInstance()
ShadowMatricesGenerationShader::getInstance()->use();
ShadowMatricesGenerationShader::getInstance()
->setUniforms(m_suncam->getViewMatrix());
glDispatchCompute(4, 1, 1);