Ticket #3641: glsl-detect.patch
File glsl-detect.patch, 4.5 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/mod/hwdetect/hwdetect.js
1 /* Copyright (c) 201 3Wildfire Games1 /* Copyright (c) 2015 Wildfire Games 2 2 * 3 3 * Permission is hereby granted, free of charge, to any person obtaining 4 4 * a copy of this software and associated documentation files (the … … 180 180 var disable_shadowpcf = undefined; 181 181 var disable_allwater = undefined; 182 182 var disable_fancywater = undefined; 183 var enable_glsl = undefined; 183 184 var override_renderpath = undefined; 184 185 185 186 // TODO: add some mechanism for setting config values … … 209 210 var GL_VERSION = settings.GL_VERSION; 210 211 var GL_EXTENSIONS = settings.GL_EXTENSIONS.split(" "); 211 212 213 // enable GLSL on OpenGL 3+ 214 if (GL_VERSION.match(/^[3-9]/)) 215 enable_glsl = true; 212 216 213 217 // NVIDIA 260.19.* UNIX drivers cause random crashes soon after startup. 214 218 // http://www.wildfiregames.com/forum/index.php?showtopic=13668 … … 293 297 "disable_shadowpcf": disable_shadowpcf, 294 298 "disable_allwater": disable_allwater, 295 299 "disable_fancywater": disable_fancywater, 300 "enable_glsl": enable_glsl, 296 301 "override_renderpath": override_renderpath, 297 302 }; 298 303 } … … 332 337 if (output.disable_fancywater !== undefined) 333 338 Engine.SetDisableFancyWater(output.disable_fancywater); 334 339 340 if (output.enable_glsl !== undefined) 341 Engine.SetEnableGLSL(output.enable_glsl); 342 335 343 if (output.override_renderpath !== undefined) 336 344 Engine.SetRenderPath(output.override_renderpath); 337 345 }; -
source/ps/GameSetup/Config.cpp
51 51 bool g_Silhouettes = false; 52 52 bool g_ShowSky = false; 53 53 54 bool g_PreferGLSL = false; 55 bool g_GenTangents = false; 56 54 57 float g_Gamma = 1.0f; 55 58 56 59 CStr g_RenderPath = "default"; -
source/ps/GameSetup/Config.h
1 /* Copyright (C) 201 2Wildfire Games.1 /* Copyright (C) 2015 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 … … 72 72 // flag to switch on sky rendering 73 73 extern bool g_ShowSky; 74 74 75 // Prefer GLSL shaders over ARB shaders 76 extern bool g_PreferGLSL; 77 // Generate tangents for normal and parallax mapping 78 extern bool g_GenTangents; 79 75 80 extern float g_Gamma; 76 81 // name of configured render path (depending on OpenGL extensions, this may not be 77 82 // the render path that is actually in use right now) -
source/ps/GameSetup/GameSetup.cpp
617 617 g_Renderer.SetOptionBool(CRenderer::OPT_PARTICLES, g_Particles); 618 618 g_Renderer.SetOptionBool(CRenderer::OPT_SILHOUETTES, g_Silhouettes); 619 619 g_Renderer.SetOptionBool(CRenderer::OPT_SHOWSKY, g_ShowSky); 620 g_Renderer.SetOptionBool(CRenderer::OPT_PREFERGLSL, g_PreferGLSL); 621 g_Renderer.SetOptionBool(CRenderer::OPT_GENTANGENTS, g_GenTangents); 620 622 621 623 // create terrain related stuff 622 624 new CTerrainTextureManager; -
source/ps/GameSetup/HWDetect.cpp
172 172 g_WaterShadows = !disabled; 173 173 } 174 174 175 void SetEnableGLSL(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool enabled) 176 { 177 if (!IsOverridden("preferglsl")) 178 g_PreferGLSL = enabled; 179 if (!IsOverridden("gentangents")) 180 g_GenTangents = enabled; 181 } 182 175 183 void SetRenderPath(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), std::string renderpath) 176 184 { 177 185 g_RenderPath = renderpath; … … 191 199 scriptInterface.RegisterFunction<void, bool, &SetDisableShadowPCF>("SetDisableShadowPCF"); 192 200 scriptInterface.RegisterFunction<void, bool, &SetDisableAllWater>("SetDisableAllWater"); 193 201 scriptInterface.RegisterFunction<void, bool, &SetDisableFancyWater>("SetDisableFancyWater"); 202 scriptInterface.RegisterFunction<void, bool, &SetEnableGLSL>("SetEnableGLSL"); 194 203 scriptInterface.RegisterFunction<void, std::string, &SetRenderPath>("SetRenderPath"); 195 204 196 205 // Load the detection script: