mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-27 19:10:52 +00:00
Add FXAA to Ryzom Client
This commit is contained in:
parent
925aa9c715
commit
971b1ae96c
12 changed files with 81 additions and 14 deletions
|
@ -214,6 +214,12 @@ Shadows_ps1 = 1;
|
|||
Shadows_ps2 = 1;
|
||||
Shadows_ps3 = 1;
|
||||
|
||||
FXAA = 1;
|
||||
FXAA_ps0 = 0;
|
||||
FXAA_ps1 = 1;
|
||||
FXAA_ps2 = 1;
|
||||
FXAA_ps3 = 1;
|
||||
|
||||
Bloom = 0;
|
||||
Bloom_ps0 = 0;
|
||||
Bloom_ps1 = 1;
|
||||
|
|
|
@ -210,6 +210,12 @@ Shadows_ps1 = 1;
|
|||
Shadows_ps2 = 1;
|
||||
Shadows_ps3 = 1;
|
||||
|
||||
FXAA = 1;
|
||||
FXAA_ps0 = 0;
|
||||
FXAA_ps1 = 1;
|
||||
FXAA_ps2 = 1;
|
||||
FXAA_ps3 = 1;
|
||||
|
||||
Bloom = 0;
|
||||
Bloom_ps0 = 0;
|
||||
Bloom_ps1 = 1;
|
||||
|
|
|
@ -1230,8 +1230,15 @@
|
|||
posref="BL TL"
|
||||
x="-20"
|
||||
y="-12" />
|
||||
<instance template="tgcw_checkbox"
|
||||
id="fxaa"
|
||||
text="uiFXAA"
|
||||
posparent="shadow"
|
||||
posref="BL TL"
|
||||
x="0"
|
||||
y="-12" />
|
||||
<group id="bloom_gr"
|
||||
posparent="shadow"
|
||||
posparent="fxaa"
|
||||
sizeparent="parent"
|
||||
sizeref="w"
|
||||
h="100"
|
||||
|
@ -3133,6 +3140,12 @@
|
|||
realtime="true"
|
||||
link="Shadows"
|
||||
preset="UI:TEMP:PRESET_FX" />
|
||||
<param ui="fx:fxaa:c"
|
||||
type="cfg"
|
||||
widget="boolbut"
|
||||
realtime="true"
|
||||
link="FXAA"
|
||||
preset="UI:TEMP:PRESET_FX" />
|
||||
<param ui="fx:bloom_gr:bloom:c"
|
||||
type="cfg"
|
||||
widget="boolbut"
|
||||
|
|
|
@ -389,6 +389,8 @@ CClientConfig::CClientConfig()
|
|||
Fog = true; // Fog is on by default
|
||||
WaitVBL = false;
|
||||
|
||||
FXAA = true;
|
||||
|
||||
Bloom = true;
|
||||
SquareBloom = true;
|
||||
DensityBloom = 255.f;
|
||||
|
@ -980,6 +982,9 @@ void CClientConfig::setValues()
|
|||
READ_BOOL_FV(SquareBloom)
|
||||
READ_FLOAT_FV(DensityBloom)
|
||||
|
||||
// FXAA
|
||||
READ_BOOL_FV(FXAA)
|
||||
|
||||
// ScreenAspectRatio.
|
||||
READ_FLOAT_FV(ScreenAspectRatio)
|
||||
// FoV.
|
||||
|
|
|
@ -263,6 +263,9 @@ struct CClientConfig
|
|||
float GlobalWindPower;
|
||||
CVector GlobalWindDirection;
|
||||
|
||||
// FXAA
|
||||
bool FXAA;
|
||||
|
||||
// Is bloom effect activated
|
||||
bool Bloom;
|
||||
bool SquareBloom;
|
||||
|
|
|
@ -25,21 +25,24 @@ using namespace NLMISC;
|
|||
|
||||
// ***************************************************************************
|
||||
// Main System
|
||||
NL3D::UDriver *Driver = 0; // The main 3D Driver
|
||||
NL3D::UDriver *Driver = NULL; // The main 3D Driver
|
||||
NL3D::IStereoDisplay *StereoDisplay = NULL; // Stereo display
|
||||
NL3D::IStereoHMD *StereoHMD = NULL; // Head mount display
|
||||
CSoundManager *SoundMngr = 0; // the sound manager
|
||||
CSoundManager *SoundMngr = NULL; // the sound manager
|
||||
NL3D::UMaterial GenericMat; // Generic Material
|
||||
NL3D::UTextContext *TextContext = 0; // Context for all the text in the client.
|
||||
NL3D::UTextContext *TextContext = NULL; // Context for all the text in the client.
|
||||
|
||||
// Effects
|
||||
NL3D::CFXAA *FXAA = NULL;
|
||||
|
||||
// Main 3D Objects
|
||||
NL3D::UScene *Scene = 0;
|
||||
NL3D::UScene *SceneRoot = 0;
|
||||
NL3D::UInstanceGroup *BackgroundIG = 0;
|
||||
NL3D::ULandscape *Landscape = 0;
|
||||
NL3D::UCloudScape *CloudScape = 0;
|
||||
NL3D::UScene *Scene = NULL;
|
||||
NL3D::UScene *SceneRoot = NULL;
|
||||
NL3D::UInstanceGroup *BackgroundIG = NULL;
|
||||
NL3D::ULandscape *Landscape = NULL;
|
||||
NL3D::UCloudScape *CloudScape = NULL;
|
||||
NL3D::UCamera MainCam;
|
||||
NL3D::UVisualCollisionManager *CollisionManager = 0;
|
||||
NL3D::UVisualCollisionManager *CollisionManager = NULL;
|
||||
#ifdef USE_WATER_ENV_MAP
|
||||
CWaterEnvMapRdr WaterEnvMapRdr;
|
||||
NL3D::UWaterEnvMap *WaterEnvMap = NULL;
|
||||
|
@ -58,7 +61,7 @@ NLMISC::CMatrix InvMainSceneViewMatrix; // Matrix to transform from camera s
|
|||
|
||||
// Misc
|
||||
bool InitCloudScape = true; // tells that the cloud scape must be reinitialized
|
||||
CEntityAnimationManager *EAM = 0;
|
||||
CEntityAnimationManager *EAM = NULL;
|
||||
CProgress ProgressBar;
|
||||
TBackground LoadingBackground = StartBackground;
|
||||
string LoadingMusic;
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace NL3D
|
|||
class UWaterEnvMap;
|
||||
class IStereoDisplay;
|
||||
class IStereoHMD;
|
||||
class CFXAA;
|
||||
}
|
||||
|
||||
class CEntityAnimationManager;
|
||||
|
@ -85,6 +86,9 @@ extern CSoundManager *SoundMngr; // the sound manager
|
|||
extern NL3D::UMaterial GenericMat; // Generic Material
|
||||
extern NL3D::UTextContext *TextContext; // Context for all the text in the client.
|
||||
|
||||
// Effects
|
||||
extern NL3D::CFXAA *FXAA;
|
||||
|
||||
// Main 3D Objects
|
||||
extern NL3D::UScene *Scene;
|
||||
extern NL3D::UScene *SceneRoot;
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "nel/3d/u_shape_bank.h"
|
||||
#include "nel/3d/u_water_env_map.h"
|
||||
#include "nel/3d/material.h"
|
||||
#include "nel/3d/fxaa.h"
|
||||
// Sound
|
||||
#include "nel/sound/u_audio_mixer.h"
|
||||
// Client
|
||||
|
@ -566,6 +567,9 @@ void initMainLoop()
|
|||
if(Scene == 0)
|
||||
nlerror("initMainLoop : Cannot create a Scene.");
|
||||
|
||||
// create effects
|
||||
if (ClientCfg.FXAA && !FXAA) FXAA = new NL3D::CFXAA(Driver);
|
||||
|
||||
// use this scene for bloom effect
|
||||
CBloomEffect::getInstance().setScene(Scene);
|
||||
|
||||
|
@ -1575,6 +1579,7 @@ void initBloomConfigUI()
|
|||
if(group)
|
||||
group->setDefaultContextHelp(CI18N::get("uiFxTooltipBloom"));
|
||||
|
||||
ClientCfg.writeBool("FXAA", false);
|
||||
ClientCfg.writeBool("Bloom", false);
|
||||
ClientCfg.writeBool("SquareBloom", false);
|
||||
ClientCfg.writeInt("DensityBloom", 0);
|
||||
|
|
|
@ -1990,6 +1990,7 @@ class CAHInitResLod : public IActionHandler
|
|||
CfgPresetList.push_back(pair<string,bool>("NbMaxSkeletonNotCLod", false));
|
||||
CfgPresetList.push_back(pair<string,bool>("CharacterFarClip", true));
|
||||
|
||||
CfgPresetList.push_back(pair<string,bool>("FXAA", false));
|
||||
CfgPresetList.push_back(pair<string,bool>("Bloom", false));
|
||||
CfgPresetList.push_back(pair<string,bool>("SquareBloom", false));
|
||||
CfgPresetList.push_back(pair<string,bool>("DensityBloom", true));
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "nel/3d/stereo_hmd.h"
|
||||
#include "nel/3d/render_target_manager.h"
|
||||
#include "nel/3d/driver_user.h"
|
||||
#include "nel/3d/fxaa.h"
|
||||
// game share
|
||||
#include "game_share/brick_types.h"
|
||||
#include "game_share/light_cycle.h"
|
||||
|
@ -1630,7 +1631,7 @@ bool mainLoop()
|
|||
bool effectRender = false;
|
||||
CTextureUser *effectRenderTarget = NULL;
|
||||
bool haveEffects = Render && Driver->getPolygonMode() == UDriver::Filled
|
||||
&& ClientCfg.Bloom;
|
||||
&& (ClientCfg.Bloom || FXAA);
|
||||
bool defaultRenderTarget = false;
|
||||
if (haveEffects)
|
||||
{
|
||||
|
@ -1733,6 +1734,7 @@ bool mainLoop()
|
|||
if (StereoDisplay) Driver->setViewport(NL3D::CViewport());
|
||||
UCamera pCam = Scene->getCam();
|
||||
Driver->setMatrixMode2D11();
|
||||
if (FXAA) FXAA->applyEffect();
|
||||
if (ClientCfg.Bloom) CBloomEffect::instance().applyBloom();
|
||||
Driver->setMatrixMode3D(pCam);
|
||||
if (StereoDisplay) Driver->setViewport(StereoDisplay->getCurrentViewport());
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <nel/3d/u_driver.h>
|
||||
#include <nel/3d/u_cloud_scape.h>
|
||||
#include <nel/3d/fxaa.h>
|
||||
|
||||
#include "game_share/scenario_entry_points.h"
|
||||
|
||||
|
@ -218,6 +219,22 @@ void updateFromClientCfg()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
if (ClientCfg.FXAA != LastClientCfg.FXAA)
|
||||
{
|
||||
if (ClientCfg.FXAA)
|
||||
{
|
||||
nlassert(!FXAA);
|
||||
FXAA = new NL3D::CFXAA(Driver);
|
||||
}
|
||||
else
|
||||
{
|
||||
nlassert(FXAA);
|
||||
delete FXAA;
|
||||
FXAA = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// GRAPHICS - CHARACTERS
|
||||
//---------------------------------------------------
|
||||
if (ClientCfg.SkinNbMaxPoly != LastClientCfg.SkinNbMaxPoly)
|
||||
|
|
|
@ -497,7 +497,8 @@ void releaseOutGame()
|
|||
// Remove the Actions listener from the Events Server.
|
||||
EventsListener.removeFromServer(CInputHandlerManager::getInstance()->FilteredEventServer);
|
||||
|
||||
// Release Bloom
|
||||
// Release effects
|
||||
delete FXAA; FXAA = NULL;
|
||||
CBloomEffect::releaseInstance();
|
||||
|
||||
// Release Scene, textcontexts, materials, ...
|
||||
|
@ -591,7 +592,8 @@ void release()
|
|||
Driver->deleteTextContext(TextContext);
|
||||
TextContext = NULL;
|
||||
|
||||
// Release Bloom
|
||||
// Release effects
|
||||
delete FXAA; FXAA = NULL;
|
||||
CBloomEffect::releaseInstance();
|
||||
|
||||
// Release Scene, textcontexts, materials, ...
|
||||
|
|
Loading…
Reference in a new issue