Ticket #4351: 4351_shadows.patch
File 4351_shadows.patch, 4.6 KB (added by , 7 years ago) |
---|
-
binaries/data/config/default.cfg
75 75 shadowsonwater = false 76 76 77 77 shadows = true 78 shadowquality = 0 78 79 shadowpcf = true 79 80 vsync = false 80 81 particles = true -
binaries/data/mods/public/gui/options/options.js
199 199 let val = +Engine.ConfigDB_GetValue("user", key); 200 200 if (key === "materialmgr.quality") 201 201 val = val > 5 ? 2 : val > 2 ? 1 : 0; 202 if (key === "shadowquality") 203 val = val + 2; 202 204 control.selected = val; 203 205 break; 204 206 case "list": … … 219 221 let val = this.selected; 220 222 if (key === "materialmgr.quality") 221 223 val = val == 0 ? 2 : val == 1 ? 5 : 8; 224 if (key === "shadowquality") 225 val = val - 2; 222 226 Engine.ConfigDB_CreateValue("user", key, val); 223 227 Engine.ConfigDB_SetChanges("user", true); 224 228 updateOptionPanel(); -
binaries/data/mods/public/gui/options/options.json
123 123 "label": "Shadows", 124 124 "tooltip": "Enable shadows", 125 125 "parameters": { "config": "shadows", "renderer": "Shadows" }, 126 "dependencies": [ "shadow pcf" ]126 "dependencies": [ "shadowquality", "shadowpcf" ] 127 127 }, 128 128 { 129 "type": "dropdown", 130 "label": "Shadow Quality", 131 "tooltip": "Shadow quality. REQUIRES GAME RESTART", 132 "parameters": { "list": [ "Very Low", "Low", "Medium", "High", "Very High" ], "config": "shadowquality" } 133 }, 134 { 129 135 "type": "boolean", 130 136 "label": "Shadow Filtering", 131 137 "tooltip": "Smooth shadows", -
binaries/data/mods/public/gui/options/options.xml
34 34 <object style="ModernLabelText" type="text" size="0 5 100% 25"> 35 35 <translatableAttribute id="caption">Graphics Settings</translatableAttribute> 36 36 </object> 37 <repeat count="2 1">37 <repeat count="22"> 38 38 <object name="graphicsSetting[n]" size="0 25 100% 50" hidden="true"> 39 39 <object name="graphicsSettingLabel[n]" size="0 0 65% 100%" type="text" style="ModernLabelText" text_align="left"/> 40 40 <object name="graphicsSettingTickbox[n]" size="90% 5 100% 100%+5" type="checkbox" style="ModernTickBox" hidden="true"/> -
source/renderer/ShadowMap.cpp
1 /* Copyright (C) 201 3Wildfire Games.1 /* Copyright (C) 2016 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 25 25 #include "lib/bits.h" 26 26 #include "lib/ogl.h" 27 27 #include "ps/CLogger.h" 28 #include "ps/ConfigDB.h" 28 29 #include "ps/Profile.h" 29 30 30 31 #include "graphics/LightEnv.h" … … 94 95 // Helper functions 95 96 void CalcShadowMatrices(); 96 97 void CreateTexture(); 98 99 // Shadow map quality (-2 - Very Low, -1 - Low, 0 - Medium, 1 - High, 2 - Ultra) 100 int QualityLevel; 97 101 }; 98 102 99 103 … … 118 122 119 123 // Avoid using uninitialised values in AddShadowedBound if SetupFrame wasn't called first 120 124 m->LightTransform.SetIdentity(); 125 126 // Default quality is medium 127 m->QualityLevel = 0; 121 128 } 122 129 123 130 … … 385 392 } 386 393 else 387 394 { 395 CFG_GET_VAL("shadowquality", QualityLevel); 396 388 397 // get shadow map size as next power of two up from view width/height 389 Width = Height = (int)round_up_to_pow2((unsigned)std::max(g_Renderer.GetWidth(), g_Renderer.GetHeight())); 398 int shadow_map_size = (int)round_up_to_pow2((unsigned)std::max(g_Renderer.GetWidth(), g_Renderer.GetHeight())); 399 switch (QualityLevel) 400 { 401 // Very Low 402 case -2: 403 shadow_map_size /= 4; 404 break; 405 // Low 406 case -1: 407 shadow_map_size /= 2; 408 break; 409 // High 410 case 1: 411 shadow_map_size *= 2; 412 break; 413 // Ultra 414 case 2: 415 shadow_map_size *= 4; 416 break; 417 // Medium as is 418 default: 419 break; 420 } 421 Width = Height = shadow_map_size; 390 422 } 391 423 // Clamp to the maximum texture size 392 424 Width = std::min(Width, (int)ogl_max_tex_size);