From 97c90bb567dd8da2b6adde2eed669baf28fecbda Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 2 Dec 2015 19:28:44 +0100 Subject: [PATCH] Merge with develop --- code/nel/include/nel/3d/driver.h | 10 ++ code/nel/include/nel/3d/driver_user.h | 2 + code/nel/include/nel/3d/u_driver.h | 10 ++ code/nel/src/3d/driver.cpp | 2 +- .../3d/driver/direct3d/driver_direct3d.cpp | 18 ++++ .../src/3d/driver/direct3d/driver_direct3d.h | 2 + code/nel/src/3d/driver/opengl/driver_opengl.h | 2 + .../driver/opengl/driver_opengl_texture.cpp | 16 ++++ code/nel/src/3d/driver_user.cpp | 14 +++ code/nel/src/gui/group_html.cpp | 4 +- .../gamedev/interfaces_v3/game_config.xml | 55 +++++++++-- code/ryzom/client/src/init.cpp | 1 + code/ryzom/client/src/init_main_loop.cpp | 6 +- .../src/interface_v3/action_handler_game.cpp | 96 ++++++++++++++++++- code/ryzom/client/src/main_loop.h | 23 +---- 15 files changed, 223 insertions(+), 38 deletions(-) diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index 39cafc2de..8e2eb8409 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -415,6 +415,16 @@ public: */ virtual void setAnisotropicFilter(sint filter) = 0; + /** + * Get current anisotropic filter value + */ + virtual uint getAnisotropicFilter() const = 0; + + /** + * Get maximum anisotropic filter value + */ + virtual uint getAnisotropicFilterMaximum() const = 0; + /** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..) * to be divided by Divisor (2, 4, 8...) * Default is 1. diff --git a/code/nel/include/nel/3d/driver_user.h b/code/nel/include/nel/3d/driver_user.h index f1e1fad84..761a03114 100644 --- a/code/nel/include/nel/3d/driver_user.h +++ b/code/nel/include/nel/3d/driver_user.h @@ -474,6 +474,8 @@ public: virtual TPolygonMode getPolygonMode (); virtual void forceDXTCCompression(bool dxtcComp); virtual void setAnisotropicFilter(sint filter); + virtual uint getAnisotropicFilter() const; + virtual uint getAnisotropicFilterMaximum() const; virtual void forceTextureResize(uint divisor); virtual bool setMonitorColorProperties (const CMonitorColorProperties &properties); // @} diff --git a/code/nel/include/nel/3d/u_driver.h b/code/nel/include/nel/3d/u_driver.h index dc2b02e56..f880c9f47 100644 --- a/code/nel/include/nel/3d/u_driver.h +++ b/code/nel/include/nel/3d/u_driver.h @@ -646,6 +646,16 @@ public: */ virtual void setAnisotropicFilter(sint filter)=0; + /** + * Get current anisotropic filter value + */ + virtual uint getAnisotropicFilter() const = 0; + + /** + * Get maximum anisotropic filter value + */ + virtual uint getAnisotropicFilterMaximum() const = 0; + /** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..) * to be divided by Divisor (2, 4, 8...) * Default is 1. diff --git a/code/nel/src/3d/driver.cpp b/code/nel/src/3d/driver.cpp index 791172700..f6fa074f0 100644 --- a/code/nel/src/3d/driver.cpp +++ b/code/nel/src/3d/driver.cpp @@ -32,7 +32,7 @@ namespace NL3D { // *************************************************************************** -const uint32 IDriver::InterfaceVersion = 0x6e; // gpu program interface +const uint32 IDriver::InterfaceVersion = 0x6f; // getters for anisotropic filter // *************************************************************************** IDriver::IDriver() : _SyncTexDrvInfos( "IDriver::_SyncTexDrvInfos" ) diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 5ffaceda6..fb310bd7d 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -2103,6 +2103,24 @@ void CDriverD3D::setAnisotropicFilter(sint filter) // *************************************************************************** +uint CDriverD3D::getAnisotropicFilter() const +{ + H_AUTO_D3D(CDriverD3D_getAnisotropicFilter); + + return _AnisotropicFilter; +} + +// *************************************************************************** + +uint CDriverD3D::getAnisotropicFilterMaximum() const +{ + H_AUTO_D3D(CDriverD3D_getAnisotropicFilterMaximum); + + return _MaxAnisotropy; +} + +// *************************************************************************** + void CDriverD3D::forceTextureResize(uint divisor) { H_AUTO_D3D(CDriverD3D_forceTextureResize); diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.h b/code/nel/src/3d/driver/direct3d/driver_direct3d.h index 039b6f3ed..830694a42 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -879,6 +879,8 @@ public: virtual void disableHardwareTextureShader(); virtual void forceDXTCCompression(bool dxtcComp); virtual void setAnisotropicFilter(sint filter); + virtual uint getAnisotropicFilter() const; + virtual uint getAnisotropicFilterMaximum() const; virtual void forceTextureResize(uint divisor); // Driver information diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index 1a7ca6825..6affa6929 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -381,6 +381,8 @@ public: virtual void forceDXTCCompression(bool dxtcComp); virtual void setAnisotropicFilter(sint filter); + virtual uint getAnisotropicFilter() const; + virtual uint getAnisotropicFilterMaximum() const; virtual void forceTextureResize(uint divisor); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp index 7b49e20a0..a46f7ef12 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp @@ -2128,6 +2128,22 @@ void CDriverGL::setAnisotropicFilter(sint filtering) } } +// *************************************************************************** +uint CDriverGL::getAnisotropicFilter() const +{ + H_AUTO_OGL(CDriverGL_getAnisotropicFilter); + + return (uint)_AnisotropicFilter; +} + +// *************************************************************************** +uint CDriverGL::getAnisotropicFilterMaximum() const +{ + H_AUTO_OGL(CDriverGL_getAnisotropicFilterMaximum); + + return (uint)_Extensions.EXTTextureFilterAnisotropicMaximum; +} + // *************************************************************************** void CDriverGL::forceTextureResize(uint divisor) { diff --git a/code/nel/src/3d/driver_user.cpp b/code/nel/src/3d/driver_user.cpp index 017a2b6dc..457197d70 100644 --- a/code/nel/src/3d/driver_user.cpp +++ b/code/nel/src/3d/driver_user.cpp @@ -1481,6 +1481,20 @@ void CDriverUser::setAnisotropicFilter(sint filter) _Driver->setAnisotropicFilter(filter); } +uint CDriverUser::getAnisotropicFilter() const +{ + NL3D_HAUTO_UI_DRIVER; + + return _Driver->getAnisotropicFilter(); +} + +uint CDriverUser::getAnisotropicFilterMaximum() const +{ + NL3D_HAUTO_UI_DRIVER; + + return _Driver->getAnisotropicFilterMaximum(); +} + void CDriverUser::forceTextureResize(uint divisor) { NL3D_HAUTO_UI_DRIVER; diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 7d451d561..24610f7eb 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -2087,14 +2087,14 @@ namespace NLGUI clearContext(); MultiCurl = curl_multi_init(); +#ifdef CURLMOPT_MAX_HOST_CONNECTIONS if (MultiCurl) { -#ifdef CURLMOPT_MAX_HOST_CONNECTIONS // added in libcurl 7.30.0 curl_multi_setopt(MultiCurl, CURLMOPT_MAX_HOST_CONNECTIONS, options.curlMaxConnections); -#endif curl_multi_setopt(MultiCurl, CURLMOPT_PIPELINING, 1); } +#endif RunningCurls = 0; _CurlWWW = NULL; diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml b/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml index c2b62cebd..bd0952277 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml @@ -183,7 +183,7 @@ posref="BL BL" scale="true" y="4" - w="86" + w="110" h="2" texture="W_line_hor2.tga" /> @@ -429,6 +429,9 @@ + @@ -916,7 +919,7 @@ - + + + + + + + + deleteTextureFile(LoadingBitmap); LoadingBitmap = NULL; - LoadingBitmapFilename = ""; + LoadingBitmapFilename.clear(); LoadingMaterial.setTexture (0, NULL); } if (LoadingBitmapFull && Driver) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 8457185e7..bff77eb7f 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2933,6 +2933,10 @@ static vector VideoModes; #define GAME_CONFIG_TEXTURE_MODE_COMBO "ui:interface:game_config:content:general:texture_mode:combo" #define GAME_CONFIG_TEXTURE_MODE_DB "UI:TEMP:TEXTURE_MODE" +// Anisotropic Filtering controls +#define GAME_CONFIG_ANISOTROPIC_COMBO "ui:interface:game_config:content:fx:anisotropic_gr:anisotropic" +#define GAME_CONFIG_ANISOTROPIC_DB "UI:TEMP:ANISOTROPIC" + // The 3 possible modes editable (NB: do not allow client.cfg HDEntityTexture==1 and DivideTextureSizeBy2=2 enum TTextureMode {LowTextureMode= 0, NormalTextureMode= 1, HighTextureMode= 2}; @@ -3034,7 +3038,7 @@ public: // **** Init Texture Size Modes // init the combo box, according to Texture Installed or not - pCB= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( GAME_CONFIG_TEXTURE_MODE_COMBO )); + pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId( GAME_CONFIG_TEXTURE_MODE_COMBO )); if( pCB ) { pCB->resetTexts(); @@ -3044,12 +3048,44 @@ public: pCB->addText(CI18N::get("uigcHighTextureMode")); } + // Anisotropic Filtering + pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_ANISOTROPIC_COMBO)); + + sint nAnisotropic = 0; + + if (pCB) + { + uint maxAnisotropic = Driver->getAnisotropicFilterMaximum(); + + pCB->resetTexts(); + pCB->addText(CI18N::get("uigcFxAnisotropicFilterNone")); + + uint anisotropic = 2; + uint i = 1; + + while (anisotropic <= maxAnisotropic) + { + pCB->addText(ucstring(NLMISC::toString("%ux", anisotropic))); + + if (ClientCfg.AnisotropicFilter == anisotropic) + nAnisotropic = i; + + anisotropic <<= 1; + ++i; + } + } + + // -1 is important to indicate we set this value in edit mode + NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_ANISOTROPIC_DB )->setValue32(-1); + NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_ANISOTROPIC_DB )->setValue32(nAnisotropic); + // VR_CONFIG pBut = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_VR_ENABLE_BUTTON)); if (pBut) { pBut->setPushed(ClientCfg.VREnable); } + updateVRDevicesComboUI(ClientCfg.VREnable); // init the mode in DB @@ -3060,6 +3096,7 @@ public: texMode= HighTextureMode; else texMode= NormalTextureMode; + // -1 is important to indicate we set this value in edit mode NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_TEXTURE_MODE_DB )->setValue32(-1); NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_TEXTURE_MODE_DB )->setValue32(texMode); @@ -3479,13 +3516,41 @@ class CHandlerGameConfigApply : public IActionHandler } } + // **** Apply Anisotropic Filtering + sint nAnisotropic = NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_ANISOTROPIC_DB )->getValue32(); + + if (nAnisotropic >= 0) + { + uint anisotropic = 0; + + // compute the real anisotropic value + if (nAnisotropic > 0) + { + anisotropic = 1; + + for(size_t i = 0; i < nAnisotropic; ++i) + { + anisotropic <<= 1; + } + } + + + if (ClientCfg.AnisotropicFilter != anisotropic) + { + ClientCfg.AnisotropicFilter = anisotropic; + ClientCfg.writeInt("AnisotropicFilter", anisotropic); + requestReboot = true; + } + } + + // *** Apply the Screen AR // since already set in the config file, need only to bkup the current version CHandlerGameConfigInit::BkupScreenAspectRatio= ClientCfg.ScreenAspectRatio; // *** Apply the language code // only if not in "work" language mode (else strange requestReboot) - if(ClientCfg.LanguageCode!="wk") + if (ClientCfg.LanguageCode!="wk") { sint newOne = NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_LANGUAGE )->getValue32(); //string newVal = (newOne==2)?"de":(newOne==1)?"fr":"en"; @@ -3595,6 +3660,33 @@ class CHandlerGameConfigChangeScreenRatioMode : public IActionHandler REGISTER_ACTION_HANDLER (CHandlerGameConfigChangeScreenRatioMode, "game_config_change_screen_ratio_mode"); +// *************************************************************************** +class CHandlerGameConfigChangeAnisotropic : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) + { + if (CInterfaceLink::isUpdatingAllLinks()) return; // don't want to trash the value in client.cfg at init, due to 'updateAllLinks' being called + + CInterfaceManager *pIM = CInterfaceManager::getInstance(); + + // get values of anisotropic filtering + sint oldAnisotropic = NLGUI::CDBManager::getInstance()->getDbProp(GAME_CONFIG_ANISOTROPIC_DB)->getOldValue32(); + sint anisotropic = NLGUI::CDBManager::getInstance()->getDbProp(GAME_CONFIG_ANISOTROPIC_DB)->getValue32(); + + // dirt the apply button of the DDX. + // don't do it at init! + if(oldAnisotropic != anisotropic && oldAnisotropic != -1 && anisotropic != -1) + { + CDDXManager *pDM = CDDXManager::getInstance(); + CInterfaceDDX *pDDX = pDM->get(GAME_CONFIG_DDX); + if(pDDX) + pDDX->validateApplyButton(); + } + } +}; +REGISTER_ACTION_HANDLER (CHandlerGameConfigChangeAnisotropic, "game_config_change_anisotropic"); + + // *************************************************************************** class CHandlerGameConfigChangeScreenRatioCustom : public IActionHandler { diff --git a/code/ryzom/client/src/main_loop.h b/code/ryzom/client/src/main_loop.h index 93e4db36d..79ebc69fa 100644 --- a/code/ryzom/client/src/main_loop.h +++ b/code/ryzom/client/src/main_loop.h @@ -59,30 +59,9 @@ void displayDebugUIUnderMouse(); void inGamePatchUncompleteWarning(); -// active/desactive bloom config interface +// enable/disable bloom config interface void initBloomConfigUI(); #endif // CL_MAIN_LOOP_H /* End of main_loop.h */ - - - - - - - - - - - - - - - - - - - - -