Merge branch 'shadowmaps' of https://github.com/raa-eruanna/qzdoom into 3.0_work

# Conflicts:
#	src/CMakeLists.txt
#	wadsrc/static/language.enu
This commit is contained in:
Christoph Oelckers 2017-03-11 19:55:43 +01:00
commit 9eae422dab
20 changed files with 994 additions and 5 deletions

View file

@ -105,6 +105,11 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
vp_comb << "#define USE_QUAD_DRAWER\n";
}
if (!!(gl.flags & RFL_SHADER_STORAGE_BUFFER))
{
vp_comb << "#define SUPPORTS_SHADOWMAPS\n";
}
vp_comb << defines << i_data.GetString().GetChars();
FString fp_comb = vp_comb;
@ -270,6 +275,9 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
if (tempindex > 0) glUniform1i(tempindex, i - 1);
}
int shadowmapindex = glGetUniformLocation(hShader, "ShadowMap");
if (shadowmapindex > 0) glUniform1i(shadowmapindex, 16);
glUseProgram(0);
return !!linked;
}

View file

@ -0,0 +1,45 @@
//
//---------------------------------------------------------------------------
//
// Copyright(C) 2016 Magnus Norddahl
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/
//
//--------------------------------------------------------------------------
//
#include "gl/system/gl_system.h"
#include "files.h"
#include "m_swap.h"
#include "v_video.h"
#include "gl/gl_functions.h"
#include "vectors.h"
#include "gl/system/gl_interface.h"
#include "gl/system/gl_framebuffer.h"
#include "gl/system/gl_cvars.h"
#include "gl/shaders/gl_shadowmapshader.h"
void FShadowMapShader::Bind()
{
if (!mShader)
{
mShader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 430);
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/shadowmap.fp", "", 430);
mShader.SetFragDataLocation(0, "FragColor");
mShader.Link("shaders/glsl/shadowmap");
mShader.SetAttribLocation(0, "PositionInProjection");
}
mShader.Bind();
}

View file

@ -0,0 +1,15 @@
#ifndef __GL_SHADOWMAPSHADER_H
#define __GL_SHADOWMAPSHADER_H
#include "gl_shaderprogram.h"
class FShadowMapShader
{
public:
void Bind();
private:
FShaderProgram mShader;
};
#endif