Merge with develop

This commit is contained in:
kervala 2015-12-02 19:28:44 +01:00
commit 1197c50201
15 changed files with 223 additions and 38 deletions

View file

@ -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.

View file

@ -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);
// @}

View file

@ -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.

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" )

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)
{
H_AUTO_D3D(CDriverD3D_forceTextureResize);

View file

@ -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

View file

@ -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);

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)
{

View file

@ -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;

View file

@ -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;

View file

@ -183,7 +183,7 @@
posref="BL BL"
scale="true"
y="4"
w="86"
w="110"
h="2"
texture="W_line_hor2.tga" />
<view type="text"
@ -202,7 +202,7 @@
posref="MM MM"
x="0"
y="-1"
w="86"
w="110"
h="8"
vertical="false"
align="L"
@ -246,7 +246,7 @@
posref="BL BL"
scale="true"
y="4"
w="86"
w="110"
h="2"
texture="W_line_hor2.tga" />
<view type="text"
@ -265,7 +265,7 @@
posref="MM MM"
x="0"
y="-1"
w="86"
w="110"
h="8"
vertical="false"
align="L"
@ -378,7 +378,7 @@
y="-18"
value="">
<group id="#id"
w="160"
w="184"
h="20"
posparent="#posparent"
posref="#posref"
@ -399,7 +399,7 @@
posref="MR MR"
x="0"
y="0"
w="90"
w="120"
h="20"
value="#value">
<instance template="combo_box_def1" />
@ -429,6 +429,9 @@
<variable entry="UI:TEMP:PRESET_FX"
type="sint32"
value="0" />
<variable entry="UI:TEMP:ANISOTROPIC"
type="sint32"
value="0" />
<variable entry="UI:TEMP:VR_DEVICE"
type="sint32"
value="0" />
@ -916,7 +919,7 @@
</group>
<group type="combo_box"
id="video_modes"
w="90"
w="100"
h="20"
value="UI:TEMP:VID_MODE"
posparent="fullscreen"
@ -1237,10 +1240,41 @@
posref="BL TL"
x="0"
y="-12" />
<group id="bloom_gr"
<group id="anisotropic_gr"
posparent="fxaa"
sizeparent="parent"
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"
posref="BL TL"
x="0"
@ -3146,6 +3180,11 @@
realtime="true"
link="FXAA"
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"
type="cfg"
widget="boolbut"

View file

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

View file

@ -1340,10 +1340,10 @@ void initMainLoop()
// init CSessionBrowserImpl
CSessionBrowserImpl::getInstance().init(CLuaManager::getInstance().getLuaState());
// active/desactive welcome window
// enable/disable welcome window
initWelcomeWindow();
// active/desactive bloom config interface
// enable/disable bloom config interface
initBloomConfigUI();
// popup to offer hardware cursor activation
@ -1364,7 +1364,7 @@ void destroyLoadingBitmap ()
// Destroy the Loading Background.
Driver->deleteTextureFile(LoadingBitmap);
LoadingBitmap = NULL;
LoadingBitmapFilename = "";
LoadingBitmapFilename.clear();
LoadingMaterial.setTexture (0, NULL);
}
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_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<CDBGroupComboBox*>(CWidgetManager::getInstance()->getElementFromId( GAME_CONFIG_TEXTURE_MODE_COMBO ));
pCB = dynamic_cast<CDBGroupComboBox*>(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<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
pBut = dynamic_cast<CCtrlBaseButton*>(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
{

View file

@ -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 */