Merge with develop

This commit is contained in:
kervala 2015-12-02 19:28:44 +01:00
parent 9c5a5639af
commit 97c90bb567
15 changed files with 223 additions and 38 deletions

View file

@ -415,6 +415,16 @@ public:
*/ */
virtual void setAnisotropicFilter(sint filter) = 0; 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..) /** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..)
* to be divided by Divisor (2, 4, 8...) * to be divided by Divisor (2, 4, 8...)
* Default is 1. * Default is 1.

View file

@ -474,6 +474,8 @@ public:
virtual TPolygonMode getPolygonMode (); virtual TPolygonMode getPolygonMode ();
virtual void forceDXTCCompression(bool dxtcComp); virtual void forceDXTCCompression(bool dxtcComp);
virtual void setAnisotropicFilter(sint filter); virtual void setAnisotropicFilter(sint filter);
virtual uint getAnisotropicFilter() const;
virtual uint getAnisotropicFilterMaximum() const;
virtual void forceTextureResize(uint divisor); virtual void forceTextureResize(uint divisor);
virtual bool setMonitorColorProperties (const CMonitorColorProperties &properties); virtual bool setMonitorColorProperties (const CMonitorColorProperties &properties);
// @} // @}

View file

@ -646,6 +646,16 @@ public:
*/ */
virtual void setAnisotropicFilter(sint filter)=0; 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..) /** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..)
* to be divided by Divisor (2, 4, 8...) * to be divided by Divisor (2, 4, 8...)
* Default is 1. * Default is 1.

View file

@ -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" ) IDriver::IDriver() : _SyncTexDrvInfos( "IDriver::_SyncTexDrvInfos" )

View file

@ -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) void CDriverD3D::forceTextureResize(uint divisor)
{ {
H_AUTO_D3D(CDriverD3D_forceTextureResize); H_AUTO_D3D(CDriverD3D_forceTextureResize);

View file

@ -879,6 +879,8 @@ public:
virtual void disableHardwareTextureShader(); virtual void disableHardwareTextureShader();
virtual void forceDXTCCompression(bool dxtcComp); virtual void forceDXTCCompression(bool dxtcComp);
virtual void setAnisotropicFilter(sint filter); virtual void setAnisotropicFilter(sint filter);
virtual uint getAnisotropicFilter() const;
virtual uint getAnisotropicFilterMaximum() const;
virtual void forceTextureResize(uint divisor); virtual void forceTextureResize(uint divisor);
// Driver information // Driver information

View file

@ -381,6 +381,8 @@ public:
virtual void forceDXTCCompression(bool dxtcComp); virtual void forceDXTCCompression(bool dxtcComp);
virtual void setAnisotropicFilter(sint filter); virtual void setAnisotropicFilter(sint filter);
virtual uint getAnisotropicFilter() const;
virtual uint getAnisotropicFilterMaximum() const;
virtual void forceTextureResize(uint divisor); virtual void forceTextureResize(uint divisor);

View file

@ -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) void CDriverGL::forceTextureResize(uint divisor)
{ {

View file

@ -1481,6 +1481,20 @@ void CDriverUser::setAnisotropicFilter(sint filter)
_Driver->setAnisotropicFilter(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) void CDriverUser::forceTextureResize(uint divisor)
{ {
NL3D_HAUTO_UI_DRIVER; NL3D_HAUTO_UI_DRIVER;

View file

@ -2087,14 +2087,14 @@ namespace NLGUI
clearContext(); clearContext();
MultiCurl = curl_multi_init(); MultiCurl = curl_multi_init();
#ifdef CURLMOPT_MAX_HOST_CONNECTIONS
if (MultiCurl) if (MultiCurl)
{ {
#ifdef CURLMOPT_MAX_HOST_CONNECTIONS
// added in libcurl 7.30.0 // added in libcurl 7.30.0
curl_multi_setopt(MultiCurl, CURLMOPT_MAX_HOST_CONNECTIONS, options.curlMaxConnections); curl_multi_setopt(MultiCurl, CURLMOPT_MAX_HOST_CONNECTIONS, options.curlMaxConnections);
#endif
curl_multi_setopt(MultiCurl, CURLMOPT_PIPELINING, 1); curl_multi_setopt(MultiCurl, CURLMOPT_PIPELINING, 1);
} }
#endif
RunningCurls = 0; RunningCurls = 0;
_CurlWWW = NULL; _CurlWWW = NULL;

View file

@ -183,7 +183,7 @@
posref="BL BL" posref="BL BL"
scale="true" scale="true"
y="4" y="4"
w="86" w="110"
h="2" h="2"
texture="W_line_hor2.tga" /> texture="W_line_hor2.tga" />
<view type="text" <view type="text"
@ -202,7 +202,7 @@
posref="MM MM" posref="MM MM"
x="0" x="0"
y="-1" y="-1"
w="86" w="110"
h="8" h="8"
vertical="false" vertical="false"
align="L" align="L"
@ -246,7 +246,7 @@
posref="BL BL" posref="BL BL"
scale="true" scale="true"
y="4" y="4"
w="86" w="110"
h="2" h="2"
texture="W_line_hor2.tga" /> texture="W_line_hor2.tga" />
<view type="text" <view type="text"
@ -265,7 +265,7 @@
posref="MM MM" posref="MM MM"
x="0" x="0"
y="-1" y="-1"
w="86" w="110"
h="8" h="8"
vertical="false" vertical="false"
align="L" align="L"
@ -378,7 +378,7 @@
y="-18" y="-18"
value=""> value="">
<group id="#id" <group id="#id"
w="160" w="184"
h="20" h="20"
posparent="#posparent" posparent="#posparent"
posref="#posref" posref="#posref"
@ -399,7 +399,7 @@
posref="MR MR" posref="MR MR"
x="0" x="0"
y="0" y="0"
w="90" w="120"
h="20" h="20"
value="#value"> value="#value">
<instance template="combo_box_def1" /> <instance template="combo_box_def1" />
@ -429,6 +429,9 @@
<variable entry="UI:TEMP:PRESET_FX" <variable entry="UI:TEMP:PRESET_FX"
type="sint32" type="sint32"
value="0" /> value="0" />
<variable entry="UI:TEMP:ANISOTROPIC"
type="sint32"
value="0" />
<variable entry="UI:TEMP:VR_DEVICE" <variable entry="UI:TEMP:VR_DEVICE"
type="sint32" type="sint32"
value="0" /> value="0" />
@ -916,7 +919,7 @@
</group> </group>
<group type="combo_box" <group type="combo_box"
id="video_modes" id="video_modes"
w="90" w="100"
h="20" h="20"
value="UI:TEMP:VID_MODE" value="UI:TEMP:VID_MODE"
posparent="fullscreen" posparent="fullscreen"
@ -1237,10 +1240,41 @@
posref="BL TL" posref="BL TL"
x="0" x="0"
y="-12" /> y="-12" />
<group id="bloom_gr" <group id="anisotropic_gr"
posparent="fxaa" posparent="fxaa"
sizeparent="parent" sizeparent="parent"
sizeref="w" sizeref="w"
h="20"
posref="BL TL"
x="0"
y="-12">
<view type="text"
id="text"
posref="TL TL"
x="0"
y="-4"
color="255 255 255 192"
fontsize="12"
shadow="true"
hardtext="uigcFxAnisotropicFilter" />
<group type="combo_box"
id="anisotropic"
w="70"
h="20"
value="UI:TEMP:ANISOTROPIC"
posref="MR ML"
posparent="text"
x="4"
y="0">
<instance template="combo_box_def1" />
</group>
<link expr="@UI:TEMP:ANISOTROPIC"
action="game_config_change_anisotropic" />
</group>
<group id="bloom_gr"
posparent="anisotropic_gr"
sizeparent="parent"
sizeref="w"
h="100" h="100"
posref="BL TL" posref="BL TL"
x="0" x="0"
@ -3146,6 +3180,11 @@
realtime="true" realtime="true"
link="FXAA" link="FXAA"
preset="UI:TEMP:PRESET_FX" /> preset="UI:TEMP:PRESET_FX" />
<param ui="fx:anisotropic_gr:anisotropic:c"
type="db"
widget="boolbut"
realtime="true"
link="UI:TEMP:ANISOTROPIC" />
<param ui="fx:bloom_gr:bloom:c" <param ui="fx:bloom_gr:bloom:c"
type="cfg" type="cfg"
widget="boolbut" widget="boolbut"

View file

@ -1115,6 +1115,7 @@ void prelogInit()
iconSizes.push_back(256); iconSizes.push_back(256);
iconSizes.push_back(128); iconSizes.push_back(128);
iconSizes.push_back(96); iconSizes.push_back(96);
iconSizes.push_back(64);
iconSizes.push_back(48); iconSizes.push_back(48);
iconSizes.push_back(32); iconSizes.push_back(32);
iconSizes.push_back(24); iconSizes.push_back(24);

View file

@ -1340,10 +1340,10 @@ void initMainLoop()
// init CSessionBrowserImpl // init CSessionBrowserImpl
CSessionBrowserImpl::getInstance().init(CLuaManager::getInstance().getLuaState()); CSessionBrowserImpl::getInstance().init(CLuaManager::getInstance().getLuaState());
// active/desactive welcome window // enable/disable welcome window
initWelcomeWindow(); initWelcomeWindow();
// active/desactive bloom config interface // enable/disable bloom config interface
initBloomConfigUI(); initBloomConfigUI();
// popup to offer hardware cursor activation // popup to offer hardware cursor activation
@ -1364,7 +1364,7 @@ void destroyLoadingBitmap ()
// Destroy the Loading Background. // Destroy the Loading Background.
Driver->deleteTextureFile(LoadingBitmap); Driver->deleteTextureFile(LoadingBitmap);
LoadingBitmap = NULL; LoadingBitmap = NULL;
LoadingBitmapFilename = ""; LoadingBitmapFilename.clear();
LoadingMaterial.setTexture (0, NULL); LoadingMaterial.setTexture (0, NULL);
} }
if (LoadingBitmapFull && Driver) if (LoadingBitmapFull && Driver)

View file

@ -2933,6 +2933,10 @@ static vector<UDriver::CMode> VideoModes;
#define GAME_CONFIG_TEXTURE_MODE_COMBO "ui:interface:game_config:content:general:texture_mode:combo" #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" #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 // The 3 possible modes editable (NB: do not allow client.cfg HDEntityTexture==1 and DivideTextureSizeBy2=2
enum TTextureMode {LowTextureMode= 0, NormalTextureMode= 1, HighTextureMode= 2}; enum TTextureMode {LowTextureMode= 0, NormalTextureMode= 1, HighTextureMode= 2};
@ -3044,12 +3048,44 @@ public:
pCB->addText(CI18N::get("uigcHighTextureMode")); pCB->addText(CI18N::get("uigcHighTextureMode"));
} }
// Anisotropic Filtering
pCB = dynamic_cast<CDBGroupComboBox*>(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 // VR_CONFIG
pBut = dynamic_cast<CCtrlBaseButton*>(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_VR_ENABLE_BUTTON)); pBut = dynamic_cast<CCtrlBaseButton*>(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_VR_ENABLE_BUTTON));
if (pBut) if (pBut)
{ {
pBut->setPushed(ClientCfg.VREnable); pBut->setPushed(ClientCfg.VREnable);
} }
updateVRDevicesComboUI(ClientCfg.VREnable); updateVRDevicesComboUI(ClientCfg.VREnable);
// init the mode in DB // init the mode in DB
@ -3060,6 +3096,7 @@ public:
texMode= HighTextureMode; texMode= HighTextureMode;
else else
texMode= NormalTextureMode; texMode= NormalTextureMode;
// -1 is important to indicate we set this value in edit mode // -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(-1);
NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_TEXTURE_MODE_DB )->setValue32(texMode); NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_TEXTURE_MODE_DB )->setValue32(texMode);
@ -3479,6 +3516,34 @@ 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 // *** Apply the Screen AR
// since already set in the config file, need only to bkup the current version // since already set in the config file, need only to bkup the current version
CHandlerGameConfigInit::BkupScreenAspectRatio= ClientCfg.ScreenAspectRatio; CHandlerGameConfigInit::BkupScreenAspectRatio= ClientCfg.ScreenAspectRatio;
@ -3595,6 +3660,33 @@ class CHandlerGameConfigChangeScreenRatioMode : public IActionHandler
REGISTER_ACTION_HANDLER (CHandlerGameConfigChangeScreenRatioMode, "game_config_change_screen_ratio_mode"); 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 class CHandlerGameConfigChangeScreenRatioCustom : public IActionHandler
{ {

View file

@ -59,30 +59,9 @@ void displayDebugUIUnderMouse();
void inGamePatchUncompleteWarning(); void inGamePatchUncompleteWarning();
// active/desactive bloom config interface // enable/disable bloom config interface
void initBloomConfigUI(); void initBloomConfigUI();
#endif // CL_MAIN_LOOP_H #endif // CL_MAIN_LOOP_H
/* End of main_loop.h */ /* End of main_loop.h */