Index: ps/trunk/binaries/data/config/default.cfg =================================================================== --- ps/trunk/binaries/data/config/default.cfg +++ ps/trunk/binaries/data/config/default.cfg @@ -66,7 +66,6 @@ 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) Index: ps/trunk/binaries/data/mods/public/gui/options/options.json =================================================================== --- ps/trunk/binaries/data/mods/public/gui/options/options.json +++ ps/trunk/binaries/data/mods/public/gui/options/options.json @@ -232,13 +232,6 @@ }, { "type": "boolean", - "label": "Shadows on water", - "tooltip": "Cast shadows on water.", - "dependencies": ["watereffects"], - "config": "watershadows" - }, - { - "type": "boolean", "label": "Smooth vision", "tooltip": "Lift darkness and fog of war smoothly.", "config": "smoothlos" Index: ps/trunk/binaries/data/mods/public/shaders/glsl/water_high.fs =================================================================== --- ps/trunk/binaries/data/mods/public/shaders/glsl/water_high.fs +++ ps/trunk/binaries/data/mods/public/shaders/glsl/water_high.fs @@ -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 @@ 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); Index: ps/trunk/binaries/data/mods/public/shaders/glsl/water_high.vs =================================================================== --- ps/trunk/binaries/data/mods/public/shaders/glsl/water_high.vs +++ ps/trunk/binaries/data/mods/public/shaders/glsl/water_high.vs @@ -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 @@ #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); Index: ps/trunk/source/ps/CStrInternStatic.h =================================================================== --- ps/trunk/source/ps/CStrInternStatic.h +++ ps/trunk/source/ps/CStrInternStatic.h @@ -62,7 +62,6 @@ 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) Index: ps/trunk/source/renderer/RenderingOptions.h =================================================================== --- ps/trunk/source/renderer/RenderingOptions.h +++ ps/trunk/source/renderer/RenderingOptions.h @@ -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(WaterRealDepth, bool); OPTION(WaterRefraction, bool); OPTION(WaterReflection, bool); - OPTION(WaterShadows, bool); OPTION(ShadowAlphaFix, bool); OPTION(ARBProgramShadow, bool); Index: ps/trunk/source/renderer/RenderingOptions.cpp =================================================================== --- ps/trunk/source/renderer/RenderingOptions.cpp +++ ps/trunk/source/renderer/RenderingOptions.cpp @@ -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 @@ 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 @@ 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]() { Index: ps/trunk/source/renderer/TerrainRenderer.cpp =================================================================== --- ps/trunk/source/renderer/TerrainRenderer.cpp +++ ps/trunk/source/renderer/TerrainRenderer.cpp @@ -457,8 +457,6 @@ 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 @@ 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()); Index: ps/trunk/source/renderer/WaterManager.h =================================================================== --- ps/trunk/source/renderer/WaterManager.h +++ ps/trunk/source/renderer/WaterManager.h @@ -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 @@ 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. Index: ps/trunk/source/renderer/WaterManager.cpp =================================================================== --- ps/trunk/source/renderer/WaterManager.cpp +++ ps/trunk/source/renderer/WaterManager.cpp @@ -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 @@ float m_TimeDiff; }; -/////////////////////////////////////////////////////////////////// -// Construction/Destruction WaterManager::WaterManager() { // water @@ -118,7 +108,6 @@ m_WaterRealDepth = false; m_WaterRefraction = false; m_WaterReflection = false; - m_WaterShadows = false; m_WaterType = L"ocean"; m_NeedsReloading = false; @@ -875,15 +864,15 @@ 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 @@ // 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 @@ CVertexBuffer::Unbind(); } - shad->Unbind(); + shader->Unbind(); pglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glDisable(GL_BLEND); @@ -1079,26 +1068,26 @@ 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()