From d4dd2b726486af016b8714ceee19b1fd881fb39b Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 2 Dec 2015 18:56:49 +0100 Subject: [PATCH] Fixed: Getters for Anisotropic Filtering --HG-- branch : 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 +- .../src/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 ++ .../3d/driver/opengl/driver_opengl_texture.cpp | 16 ++++++++++++++++ code/nel/src/3d/driver_user.cpp | 14 ++++++++++++++ 9 files changed, 75 insertions(+), 1 deletion(-) 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;