Removes unused shadow settings forgotten in 12e2428495, removes direct SkipSubmit access.

This was SVN commit r25261.
This commit is contained in:
vladislavbelov
2021-04-14 20:25:05 +00:00
parent f57ac432e8
commit 715dca0701
6 changed files with 53 additions and 81 deletions
+2 -2
View File
@@ -84,7 +84,7 @@ void CChart::DrawLine(const CShaderProgramPtr& shader, const CGUIColor& color, c
glEnable(GL_LINE_SMOOTH);
#endif
glLineWidth(1.1f);
if (!g_Renderer.m_SkipSubmit)
if (!g_Renderer.DoSkipSubmit())
glDrawArrays(GL_LINE_STRIP, 0, vertices.size() / 3);
glLineWidth(1.0f);
#if !CONFIG2_GLES
@@ -98,7 +98,7 @@ void CChart::DrawTriangleStrip(const CShaderProgramPtr& shader, const CGUIColor&
shader->VertexPointer(3, GL_FLOAT, 0, &vertices[0]);
shader->AssertPointersBound();
if (!g_Renderer.m_SkipSubmit)
if (!g_Renderer.DoSkipSubmit())
glDrawArrays(GL_TRIANGLE_STRIP, 0, vertices.size() / 3);
}
+3 -3
View File
@@ -349,7 +349,7 @@ void CMiniMap::DrawViewRect(const CMatrix3D& transform) const
shader->VertexPointer(2, GL_FLOAT, 0, vertices.data());
shader->AssertPointersBound();
if (!g_Renderer.m_SkipSubmit)
if (!g_Renderer.DoSkipSubmit())
glDrawArrays(GL_LINES, 0, vertices.size() / 2);
tech->EndPass();
@@ -414,7 +414,7 @@ void CMiniMap::DrawTexture(CShaderProgramPtr shader, float coordMax, float angle
shader->VertexPointer(3, GL_FLOAT, 0, quadVerts);
shader->AssertPointersBound();
if (!g_Renderer.m_SkipSubmit)
if (!g_Renderer.DoSkipSubmit())
glDrawArrays(GL_TRIANGLES, 0, 6);
}
@@ -655,7 +655,7 @@ void CMiniMap::Draw()
shader->ColorPointer(4, GL_UNSIGNED_BYTE, stride, base + m_AttributeColor.offset);
shader->AssertPointersBound();
if (!g_Renderer.m_SkipSubmit)
if (!g_Renderer.DoSkipSubmit())
glDrawElements(GL_POINTS, (GLsizei)(m_EntitiesDrawn), GL_UNSIGNED_SHORT, indexBase);
g_Renderer.GetStats().m_DrawCalls++;
+2 -5
View File
@@ -434,12 +434,9 @@ CRenderer::CRenderer()
if (skycolor.ParseString(skystring, 255.f))
SetClearColor(skycolor.AsSColor4ub());
m_ShadowZBias = 0.02f;
m_ShadowMapSize = 0;
m_LightEnv = nullptr;
m_LightEnv = NULL;
m_CurrentScene = NULL;
m_CurrentScene = nullptr;
m_hCompositeAlphaMap = 0;
+19 -37
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -25,16 +25,14 @@
#include "graphics/Camera.h"
#include "graphics/SColor.h"
#include "graphics/ShaderDefines.h"
#include "graphics/ShaderProgramPtr.h"
#include "lib/file/vfs/vfs_path.h"
#include "lib/res/handle.h"
#include "ps/Singleton.h"
#include "graphics/ShaderDefines.h"
#include "renderer/Scene.h"
#include "renderer/RenderingOptions.h"
#include "renderer/Scene.h"
// necessary declarations
class CFontManager;
class CLightEnv;
class CMaterial;
@@ -74,7 +72,8 @@ public:
// various enumerations and renderer related constants
enum { NumAlphaMaps=14 };
enum CullGroup {
enum CullGroup
{
CULL_DEFAULT,
CULL_SHADOWS,
CULL_REFLECTIONS,
@@ -85,7 +84,8 @@ public:
};
// stats class - per frame counts of number of draw calls, poly counts etc
struct Stats {
struct Stats
{
// set all stats to zero
void Reset() { memset(this, 0, sizeof(*this)); }
// number of draw calls per frame - total DrawElements + Begin/End immediate mode loops
@@ -104,7 +104,8 @@ public:
size_t m_Particles;
};
struct Caps {
struct Caps
{
bool m_VBO;
bool m_ARBProgram;
bool m_ARBProgramShadow;
@@ -192,8 +193,9 @@ public:
// set the current lighting environment; (note: the passed pointer is just copied to a variable within the renderer,
// so the lightenv passed must be scoped such that it is not destructed until after the renderer is no longer rendering)
void SetLightEnv(CLightEnv* lightenv) {
m_LightEnv=lightenv;
void SetLightEnv(CLightEnv* lightenv)
{
m_LightEnv = lightenv;
}
// set the mode to render subsequent terrain patches
@@ -288,6 +290,12 @@ public:
*/
void ResetState();
/**
* m_SkipSubmit: Disable the actual submission of rendering commands to OpenGL.
* All state setup is still performed as usual.
*/
bool DoSkipSubmit() const { return m_SkipSubmit; }
protected:
friend struct CRendererInternals;
friend class CVertexBuffer;
@@ -428,33 +436,7 @@ protected:
*/
bool m_DisplayTerrainPriorities;
public:
/**
* m_ShadowZBias: Z bias used when rendering shadows into a depth texture.
* This can be used to control shadowing artifacts.
*
* Can be accessed via JS as renderer.shadowZBias
* ShadowMap uses this for matrix calculation.
*/
float m_ShadowZBias;
/**
* m_ShadowMapSize: Size of shadow map, or 0 for default. Typically slow but useful
* for high-quality rendering. Changes don't take effect until the shadow map
* is regenerated.
*
* Can be accessed via JS as renderer.shadowMapSize
*/
int m_ShadowMapSize;
/**
* m_SkipSubmit: Disable the actual submission of rendering commands to OpenGL.
* All state setup is still performed as usual.
*
* Can be accessed via JS as renderer.skipSubmit
*/
bool m_SkipSubmit;
};
#endif
#endif // INCLUDED_RENDERER
+26 -33
View File
@@ -433,41 +433,34 @@ void ShadowMapInternals::CreateTexture()
pglGenFramebuffersEXT(1, &Framebuffer);
if (g_Renderer.m_ShadowMapSize != 0)
{
// non-default option to override the size
Width = Height = g_Renderer.m_ShadowMapSize;
}
else
{
CFG_GET_VAL("shadowquality", QualityLevel);
CFG_GET_VAL("shadowquality", QualityLevel);
// get shadow map size as next power of two up from view width/height
int shadow_map_size = (int)round_up_to_pow2((unsigned)std::max(g_Renderer.GetWidth(), g_Renderer.GetHeight()));
switch (QualityLevel)
{
// Very Low
case -2:
shadow_map_size /= 4;
break;
// Low
case -1:
shadow_map_size /= 2;
break;
// High
case 1:
shadow_map_size *= 2;
break;
// Ultra
case 2:
shadow_map_size *= 4;
break;
// Medium as is
default:
break;
}
Width = Height = shadow_map_size;
// get shadow map size as next power of two up from view width/height
int shadow_map_size = (int)round_up_to_pow2((unsigned)std::max(g_Renderer.GetWidth(), g_Renderer.GetHeight()));
switch (QualityLevel)
{
// Very Low
case -2:
shadow_map_size /= 4;
break;
// Low
case -1:
shadow_map_size /= 2;
break;
// High
case 1:
shadow_map_size *= 2;
break;
// Ultra
case 2:
shadow_map_size *= 4;
break;
// Medium as is
default:
break;
}
Width = Height = shadow_map_size;
// Clamp to the maximum texture size
Width = std::min(Width, (int)ogl_max_tex_size);
Height = std::min(Height, (int)ogl_max_tex_size);
+1 -1
View File
@@ -847,7 +847,7 @@ void WaterManager::RenderWaves(const CFrustum& frustrum)
#if CONFIG2_GLES
#warning Fix WaterManager::RenderWaves on GLES
#else
if (g_Renderer.m_SkipSubmit || !m_WaterFancyEffects)
if (g_Renderer.DoSkipSubmit() || !m_WaterFancyEffects)
return;
pglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FancyEffectsFBO);