mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- Change shadowmap resolution from 1024 to 128
This commit is contained in:
parent
1df7dc81e6
commit
265df4b797
4 changed files with 15 additions and 7 deletions
|
@ -106,7 +106,7 @@ void FShadowMap::Update()
|
|||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, mNodesBuffer);
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 3, mLinesBuffer);
|
||||
|
||||
glViewport(0, 0, 1024, 1024);
|
||||
glViewport(0, 0, SHADOWMAP_QUALITY, 1024);
|
||||
GLRenderer->RenderScreenQuad();
|
||||
|
||||
const auto &viewport = GLRenderer->mScreenViewport;
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
class ADynamicLight;
|
||||
struct level_info_t;
|
||||
|
||||
// This constant must match the same constant in shadowmap.fp
|
||||
//#define SHADOWMAP_QUALITY 1024
|
||||
#define SHADOWMAP_QUALITY 128
|
||||
|
||||
class FShadowMap
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -770,7 +770,7 @@ void FGLRenderBuffers::CreateShadowMap()
|
|||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &textureBinding);
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &frameBufferBinding);
|
||||
|
||||
mShadowMapTexture = Create2DTexture("ShadowMap", GL_R32F, 1024, 1024);
|
||||
mShadowMapTexture = Create2DTexture("ShadowMap", GL_R32F, SHADOWMAP_QUALITY, 1024);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
|
||||
// This constant must match the same constant in gl_shadowmap.h
|
||||
// #define SHADOWMAP_QUALITY 1024
|
||||
#define SHADOWMAP_QUALITY 128
|
||||
|
||||
struct GPUNode
|
||||
{
|
||||
vec2 aabb_min;
|
||||
|
@ -140,12 +144,12 @@ void main()
|
|||
if (radius > 0.0)
|
||||
{
|
||||
vec2 pixelpos;
|
||||
switch (int(gl_FragCoord.x) / 256)
|
||||
switch (int(gl_FragCoord.x) / int(SHADOWMAP_QUALITY/4))
|
||||
{
|
||||
case 0: pixelpos = vec2((gl_FragCoord.x - 128.0) / 128.0, 1.0); break;
|
||||
case 1: pixelpos = vec2(1.0, (gl_FragCoord.x - 384.0) / 128.0); break;
|
||||
case 2: pixelpos = vec2(-(gl_FragCoord.x - 640.0) / 128.0, -1.0); break;
|
||||
case 3: pixelpos = vec2(-1.0, -(gl_FragCoord.x - 896.0) / 128.0); break;
|
||||
case 0: pixelpos = vec2((gl_FragCoord.x - float(SHADOWMAP_QUALITY/8)) / float(SHADOWMAP_QUALITY/8), 1.0); break;
|
||||
case 1: pixelpos = vec2(1.0, (gl_FragCoord.x - float(SHADOWMAP_QUALITY/4 + SHADOWMAP_QUALITY/8)) / float(SHADOWMAP_QUALITY/8)); break;
|
||||
case 2: pixelpos = vec2(-(gl_FragCoord.x - float(SHADOWMAP_QUALITY/2 + SHADOWMAP_QUALITY/8)) / float(SHADOWMAP_QUALITY/8), -1.0); break;
|
||||
case 3: pixelpos = vec2(-1.0, -(gl_FragCoord.x - float(SHADOWMAP_QUALITY*3/4 + SHADOWMAP_QUALITY/8)) / float(SHADOWMAP_QUALITY/8)); break;
|
||||
}
|
||||
pixelpos = lightpos + pixelpos * radius;
|
||||
|
||||
|
|
Loading…
Reference in a new issue