Removes useless option for shadows on water
Reviewed By: wraitii Differential Revision: https://code.wildfiregames.com/D3368 This was SVN commit r24630.
This commit is contained in:
parent
de2b16a904
commit
6282960991
@ -66,7 +66,6 @@ waterfancyeffects = false
|
||||
waterrealdepth = true
|
||||
waterrefraction = true
|
||||
waterreflection = true
|
||||
watershadows = false
|
||||
|
||||
shadows = true
|
||||
shadowquality = 0 ; Shadow map resolution. (-2 - Very Low, -1 - Low, 0 - Medium, 1 - High, 2 - Very High)
|
||||
|
@ -230,13 +230,6 @@
|
||||
"dependencies": ["watereffects", "waterrefraction"],
|
||||
"config": "waterrealdepth"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"label": "Shadows on water",
|
||||
"tooltip": "Cast shadows on water.",
|
||||
"dependencies": ["watereffects"],
|
||||
"config": "watershadows"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"label": "Smooth vision",
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
#include "common/fog.h"
|
||||
|
||||
#if USE_SHADOWS_ON_WATER
|
||||
#include "common/shadows_fragment.h"
|
||||
#endif
|
||||
|
||||
// Environment settings
|
||||
uniform vec3 ambient;
|
||||
@ -314,7 +312,7 @@ void main()
|
||||
|
||||
vec3 specular = getSpecular(normal, eyeVec);
|
||||
|
||||
#if USE_SHADOWS_ON_WATER && USE_SHADOW
|
||||
#if USE_SHADOW
|
||||
float shadow = get_shadow();
|
||||
float fresShadow = mix(fresnel, fresnel * shadow, 0.05 + murkiness * 0.2);
|
||||
vec3 color = mix(refrColor.rgb, reflColor.rgb, fresShadow * reflColor.a);
|
||||
|
@ -1,8 +1,6 @@
|
||||
#version 110
|
||||
|
||||
#if USE_SHADOWS_ON_WATER
|
||||
#include "common/shadows_vertex.h"
|
||||
#endif
|
||||
|
||||
uniform mat4 reflectionMatrix;
|
||||
uniform mat4 refractionMatrix;
|
||||
@ -64,9 +62,7 @@ void main()
|
||||
#endif
|
||||
losCoords = (losMatrix * vec4(a_vertex, 1.0)).rg;
|
||||
|
||||
#if USE_SHADOWS_ON_WATER
|
||||
calculatePositionInShadowSpace(vec4(a_vertex, 1.0));
|
||||
#endif
|
||||
|
||||
v_eyeVec = normalize(cameraPos - worldPos);
|
||||
|
||||
|
@ -62,7 +62,6 @@ X(USE_REFRACTION)
|
||||
X(USE_SHADOW)
|
||||
X(USE_SHADOW_PCF)
|
||||
X(USE_SHADOW_SAMPLER)
|
||||
X(USE_SHADOWS_ON_WATER)
|
||||
X(USE_FOG)
|
||||
X(WATERTYPE_CLAP)
|
||||
X(WATERTYPE_LAKE)
|
||||
|
@ -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
|
||||
@ -84,7 +84,6 @@ CRenderingOptions::CRenderingOptions() : m_ConfigHooks(new ConfigHooks())
|
||||
m_WaterRealDepth = false;
|
||||
m_WaterRefraction = false;
|
||||
m_WaterReflection = false;
|
||||
m_WaterShadows = false;
|
||||
m_ShadowAlphaFix = true;
|
||||
m_ARBProgramShadow = true;
|
||||
m_ShadowPCF = false;
|
||||
@ -161,7 +160,6 @@ void CRenderingOptions::ReadConfigAndSetupHooks()
|
||||
m_ConfigHooks->Setup("waterrealdepth", m_WaterRealDepth);
|
||||
m_ConfigHooks->Setup("waterrefraction", m_WaterRefraction);
|
||||
m_ConfigHooks->Setup("waterreflection", m_WaterReflection);
|
||||
m_ConfigHooks->Setup("watershadows", m_WaterShadows);
|
||||
|
||||
m_ConfigHooks->Setup("particles", m_Particles);
|
||||
m_ConfigHooks->Setup("fog", [this]() {
|
||||
|
@ -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
|
||||
@ -93,7 +93,6 @@ OPTION_CUSTOM_SETTER(NAME, TYPE); OPTION_GETTER(NAME, TYPE); OPTION_DEF(NAME, TY
|
||||
OPTION(WaterRealDepth, bool);
|
||||
OPTION(WaterRefraction, bool);
|
||||
OPTION(WaterReflection, bool);
|
||||
OPTION(WaterShadows, bool);
|
||||
|
||||
OPTION(ShadowAlphaFix, bool);
|
||||
OPTION(ARBProgramShadow, bool);
|
||||
|
@ -457,8 +457,6 @@ bool TerrainRenderer::RenderFancyWater(const CShaderDefines& context, int cullGr
|
||||
defines.Add(str_USE_REFRACTION, str_1);
|
||||
if (WaterMgr->m_WaterReflection)
|
||||
defines.Add(str_USE_REFLECTION, str_1);
|
||||
if (shadow && WaterMgr->m_WaterShadows)
|
||||
defines.Add(str_USE_SHADOWS_ON_WATER, str_1);
|
||||
|
||||
// haven't updated the ARB shader yet so I'll always load the GLSL
|
||||
/*if (!g_RenderingOptions.GetPreferGLSL() && !superFancy)
|
||||
@ -605,7 +603,7 @@ bool TerrainRenderer::RenderFancyWater(const CShaderDefines& context, int cullGr
|
||||
m->fancyWaterShader->Uniform(str_waveParams2, 0.3f,0.0f,0.1f,0.3f);
|
||||
}
|
||||
|
||||
if (shadow && WaterMgr->m_WaterShadows)
|
||||
if (shadow)
|
||||
{
|
||||
m->fancyWaterShader->BindTexture(str_shadowTex, shadow->GetTexture());
|
||||
m->fancyWaterShader->Uniform(str_shadowTransform, shadow->GetTextureMatrix());
|
||||
|
@ -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,31 +25,23 @@
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "graphics/ShaderManager.h"
|
||||
#include "graphics/ShaderProgram.h"
|
||||
|
||||
#include "lib/bits.h"
|
||||
#include "lib/timer.h"
|
||||
#include "lib/tex/tex.h"
|
||||
#include "lib/res/graphics/ogl_tex.h"
|
||||
|
||||
#include "maths/MathUtil.h"
|
||||
#include "maths/Vector2D.h"
|
||||
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/Game.h"
|
||||
#include "ps/World.h"
|
||||
|
||||
#include "renderer/WaterManager.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
|
||||
#include "simulation2/Simulation2.h"
|
||||
#include "simulation2/components/ICmpWaterManager.h"
|
||||
#include "simulation2/components/ICmpRangeManager.h"
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// WaterManager implementation
|
||||
|
||||
struct CoastalPoint
|
||||
{
|
||||
CoastalPoint(int idx, CVector2D pos) : index(idx), position(pos) {};
|
||||
@ -80,8 +72,6 @@ struct WaveObject
|
||||
float m_TimeDiff;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
WaterManager::WaterManager()
|
||||
{
|
||||
// water
|
||||
@ -118,7 +108,6 @@ WaterManager::WaterManager()
|
||||
m_WaterRealDepth = false;
|
||||
m_WaterRefraction = false;
|
||||
m_WaterReflection = false;
|
||||
m_WaterShadows = false;
|
||||
m_WaterType = L"ocean";
|
||||
|
||||
m_NeedsReloading = false;
|
||||
@ -875,15 +864,15 @@ void WaterManager::RenderWaves(const CFrustum& frustrum)
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
|
||||
CShaderDefines none;
|
||||
CShaderProgramPtr shad = g_Renderer.GetShaderManager().LoadProgram("glsl/waves", none);
|
||||
CShaderProgramPtr shader = g_Renderer.GetShaderManager().LoadProgram("glsl/waves", none);
|
||||
|
||||
shad->Bind();
|
||||
shader->Bind();
|
||||
|
||||
shad->BindTexture(str_waveTex, m_WaveTex);
|
||||
shad->BindTexture(str_foamTex, m_FoamTex);
|
||||
shader->BindTexture(str_waveTex, m_WaveTex);
|
||||
shader->BindTexture(str_foamTex, m_FoamTex);
|
||||
|
||||
shad->Uniform(str_time, (float)m_WaterTexTimer);
|
||||
shad->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection());
|
||||
shader->Uniform(str_time, (float)m_WaterTexTimer);
|
||||
shader->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection());
|
||||
|
||||
for (size_t a = 0; a < m_ShoreWaves.size(); ++a)
|
||||
{
|
||||
@ -895,24 +884,24 @@ void WaterManager::RenderWaves(const CFrustum& frustrum)
|
||||
|
||||
// setup data pointers
|
||||
GLsizei stride = sizeof(SWavesVertex);
|
||||
shad->VertexPointer(3, GL_FLOAT, stride, &base[VBchunk->m_Index].m_BasePosition);
|
||||
shad->TexCoordPointer(GL_TEXTURE0, 2, GL_UNSIGNED_BYTE, stride, &base[VBchunk->m_Index].m_UV);
|
||||
shader->VertexPointer(3, GL_FLOAT, stride, &base[VBchunk->m_Index].m_BasePosition);
|
||||
shader->TexCoordPointer(GL_TEXTURE0, 2, GL_UNSIGNED_BYTE, stride, &base[VBchunk->m_Index].m_UV);
|
||||
// NormalPointer(gl_FLOAT, stride, &base[m_VBWater->m_Index].m_UV)
|
||||
pglVertexAttribPointerARB(2, 2, GL_FLOAT, GL_TRUE, stride, &base[VBchunk->m_Index].m_PerpVect); // replaces commented above because my normal is vec2
|
||||
shad->VertexAttribPointer(str_a_apexPosition, 3, GL_FLOAT, false, stride, &base[VBchunk->m_Index].m_ApexPosition);
|
||||
shad->VertexAttribPointer(str_a_splashPosition, 3, GL_FLOAT, false, stride, &base[VBchunk->m_Index].m_SplashPosition);
|
||||
shad->VertexAttribPointer(str_a_retreatPosition, 3, GL_FLOAT, false, stride, &base[VBchunk->m_Index].m_RetreatPosition);
|
||||
shader->VertexAttribPointer(str_a_apexPosition, 3, GL_FLOAT, false, stride, &base[VBchunk->m_Index].m_ApexPosition);
|
||||
shader->VertexAttribPointer(str_a_splashPosition, 3, GL_FLOAT, false, stride, &base[VBchunk->m_Index].m_SplashPosition);
|
||||
shader->VertexAttribPointer(str_a_retreatPosition, 3, GL_FLOAT, false, stride, &base[VBchunk->m_Index].m_RetreatPosition);
|
||||
|
||||
shad->AssertPointersBound();
|
||||
shader->AssertPointersBound();
|
||||
|
||||
shad->Uniform(str_translation, m_ShoreWaves[a]->m_TimeDiff);
|
||||
shad->Uniform(str_width, (int)m_ShoreWaves[a]->m_Width);
|
||||
shader->Uniform(str_translation, m_ShoreWaves[a]->m_TimeDiff);
|
||||
shader->Uniform(str_width, (int)m_ShoreWaves[a]->m_Width);
|
||||
|
||||
u8* indexBase = m_ShoreWaves_VBIndices->m_Owner->Bind();
|
||||
glDrawElements(GL_TRIANGLES, (GLsizei) (m_ShoreWaves[a]->m_Width-1)*(7*6),
|
||||
GL_UNSIGNED_SHORT, indexBase + sizeof(u16)*(m_ShoreWaves_VBIndices->m_Index));
|
||||
|
||||
shad->Uniform(str_translation, m_ShoreWaves[a]->m_TimeDiff + 6.0f);
|
||||
shader->Uniform(str_translation, m_ShoreWaves[a]->m_TimeDiff + 6.0f);
|
||||
|
||||
// TODO: figure out why this doesn't work.
|
||||
//g_Renderer.m_Stats.m_DrawCalls++;
|
||||
@ -920,7 +909,7 @@ void WaterManager::RenderWaves(const CFrustum& frustrum)
|
||||
|
||||
CVertexBuffer::Unbind();
|
||||
}
|
||||
shad->Unbind();
|
||||
shader->Unbind();
|
||||
pglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
@ -1079,26 +1068,26 @@ void WaterManager::UpdateQuality()
|
||||
m_WaterEffects = g_RenderingOptions.GetWaterEffects();
|
||||
m_NeedsReloading = true;
|
||||
}
|
||||
if (g_RenderingOptions.GetWaterFancyEffects() != m_WaterFancyEffects) {
|
||||
if (g_RenderingOptions.GetWaterFancyEffects() != m_WaterFancyEffects)
|
||||
{
|
||||
m_WaterFancyEffects = g_RenderingOptions.GetWaterFancyEffects();
|
||||
m_NeedsReloading = true;
|
||||
}
|
||||
if (g_RenderingOptions.GetWaterRealDepth() != m_WaterRealDepth) {
|
||||
if (g_RenderingOptions.GetWaterRealDepth() != m_WaterRealDepth)
|
||||
{
|
||||
m_WaterRealDepth = g_RenderingOptions.GetWaterRealDepth();
|
||||
m_NeedsReloading = true;
|
||||
}
|
||||
if (g_RenderingOptions.GetWaterRefraction() != m_WaterRefraction) {
|
||||
if (g_RenderingOptions.GetWaterRefraction() != m_WaterRefraction)
|
||||
{
|
||||
m_WaterRefraction = g_RenderingOptions.GetWaterRefraction();
|
||||
m_NeedsReloading = true;
|
||||
}
|
||||
if (g_RenderingOptions.GetWaterReflection() != m_WaterReflection) {
|
||||
if (g_RenderingOptions.GetWaterReflection() != m_WaterReflection)
|
||||
{
|
||||
m_WaterReflection = g_RenderingOptions.GetWaterReflection();
|
||||
m_NeedsReloading = true;
|
||||
}
|
||||
if (g_RenderingOptions.GetWaterShadows() != m_WaterShadows) {
|
||||
m_WaterShadows = g_RenderingOptions.GetWaterShadows();
|
||||
m_NeedsReloading = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool WaterManager::WillRenderFancyWater()
|
||||
|
@ -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
|
||||
@ -86,8 +86,6 @@ public:
|
||||
bool m_WaterRefraction;
|
||||
// Use complete reflections instead of showing merely the sky.
|
||||
bool m_WaterReflection;
|
||||
// Show shadows on the water.
|
||||
bool m_WaterShadows;
|
||||
|
||||
bool m_NeedsReloading;
|
||||
// requires also recreating the super fancy information.
|
||||
|
Loading…
Reference in New Issue
Block a user