]> git.lizzy.rs Git - irrlicht.git/commitdiff
Drop gamma ramp code
authorsfan5 <sfan5@live.de>
Mon, 18 Jul 2022 19:19:30 +0000 (21:19 +0200)
committersfan5 <sfan5@live.de>
Mon, 18 Jul 2022 19:22:38 +0000 (21:22 +0200)
We definitely won't be wanting to set the gamma for the entire display in the future.

include/IrrCompileConfig.h
include/IrrlichtDevice.h
source/Irrlicht/CIrrDeviceLinux.cpp
source/Irrlicht/CIrrDeviceLinux.h
source/Irrlicht/CIrrDeviceSDL.cpp
source/Irrlicht/CIrrDeviceSDL.h
source/Irrlicht/CIrrDeviceStub.cpp
source/Irrlicht/CIrrDeviceStub.h
source/Irrlicht/CIrrDeviceWin32.cpp
source/Irrlicht/CIrrDeviceWin32.h
source/Irrlicht/CMakeLists.txt

index 20d7669b934348a03527a240d16857a6d0231072..4c1cb7358140dfa8dd8282fe24c97965b24050b5 100644 (file)
@@ -272,19 +272,8 @@ define out. */
 #undef _IRR_COMPILE_WITH_X11_\r
 #endif\r
 \r
-//! On some Linux systems the XF86 vidmode extension, X11 RandR, or XInput2 are missing.\r
-//! Use these defines to add/remove support for those dependencies as needed.\r
-//! XInput2 (library called Xi) is currently only used to support touch-input.\r
 #if defined(_IRR_LINUX_PLATFORM_) && defined(_IRR_COMPILE_WITH_X11_)\r
-#define _IRR_LINUX_X11_VIDMODE_\r
-//#define _IRR_LINUX_X11_RANDR_\r
-//#define _IRR_LINUX_X11_XINPUT2_\r
-#ifdef NO_IRR_LINUX_X11_VIDMODE_\r
-#undef _IRR_LINUX_X11_VIDMODE_\r
-#endif\r
-#ifdef NO_IRR_LINUX_X11_RANDR_\r
-#undef _IRR_LINUX_X11_RANDR_\r
-#endif\r
+//! XInput2 (library called Xi) is currently only used to support touch-input.\r
 #ifdef NO_IRR_LINUX_X11_XINPUT2_\r
 #undef _IRR_LINUX_X11_XINPUT2_\r
 #endif\r
index 88415118b0d780fac6208afb3f39fe7c3dc7ebf1..43107eb5d1cdadcf6cb4ca0e0df0b4475f9640b1 100644 (file)
@@ -270,14 +270,6 @@ namespace irr
         //! Is device motion available.\r
         virtual bool isDeviceMotionAvailable() = 0;\r
 \r
-               //! Set the current Gamma Value for the Display\r
-               virtual bool setGammaRamp(f32 red, f32 green, f32 blue,\r
-                                       f32 relativebrightness, f32 relativecontrast) =0;\r
-\r
-               //! Get the current Gamma Value for the Display\r
-               virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,\r
-                                       f32 &brightness, f32 &contrast) =0;\r
-\r
                //! Set the maximal elapsed time between 2 clicks to generate doubleclicks for the mouse. It also affects tripleclick behavior.\r
                /** When set to 0 no double- and tripleclicks will be generated.\r
                \param timeMs maximal time in milliseconds for two consecutive clicks to be recognized as double click\r
index 243415d773ce8844f6becf1ae27fda31d38c376e..6d4c1a7cdd33e73aba801174da0e4f43cfa7ef09 100644 (file)
@@ -1763,97 +1763,6 @@ void CIrrDeviceLinux::pollJoysticks()
 }\r
 \r
 \r
-//! Set the current Gamma Value for the Display\r
-bool CIrrDeviceLinux::setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast )\r
-{\r
-       #if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_)\r
-       s32 eventbase, errorbase;\r
-       #ifdef _IRR_LINUX_X11_VIDMODE_\r
-       if (XF86VidModeQueryExtension(XDisplay, &eventbase, &errorbase))\r
-       {\r
-               XF86VidModeGamma gamma;\r
-               gamma.red=red;\r
-               gamma.green=green;\r
-               gamma.blue=blue;\r
-               XF86VidModeSetGamma(XDisplay, Screennr, &gamma);\r
-               return true;\r
-       }\r
-       #endif\r
-       #if defined(_IRR_LINUX_X11_VIDMODE_) && defined(_IRR_LINUX_X11_RANDR_)\r
-       else\r
-       #endif\r
-       #ifdef _IRR_LINUX_X11_RANDR_\r
-       if (XRRQueryExtension(XDisplay, &eventbase, &errorbase))\r
-       {\r
-               XRRQueryVersion(XDisplay, &eventbase, &errorbase); // major, minor\r
-               if (eventbase>=1 && errorbase>1)\r
-               {\r
-               #if (RANDR_MAJOR>1 || RANDR_MINOR>1)\r
-                       XRRCrtcGamma *gamma = XRRGetCrtcGamma(XDisplay, Screennr);\r
-                       if (gamma)\r
-                       {\r
-                               *gamma->red=(u16)red;\r
-                               *gamma->green=(u16)green;\r
-                               *gamma->blue=(u16)blue;\r
-                               XRRSetCrtcGamma(XDisplay, Screennr, gamma);\r
-                               XRRFreeGamma(gamma);\r
-                               return true;\r
-                       }\r
-               #endif\r
-               }\r
-       }\r
-       #endif\r
-       #endif\r
-       return false;\r
-}\r
-\r
-\r
-//! Get the current Gamma Value for the Display\r
-bool CIrrDeviceLinux::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast )\r
-{\r
-       brightness = 0.f;\r
-       contrast = 0.f;\r
-       #if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_)\r
-       s32 eventbase, errorbase;\r
-       #ifdef _IRR_LINUX_X11_VIDMODE_\r
-       if (XF86VidModeQueryExtension(XDisplay, &eventbase, &errorbase))\r
-       {\r
-               XF86VidModeGamma gamma;\r
-               XF86VidModeGetGamma(XDisplay, Screennr, &gamma);\r
-               red = gamma.red;\r
-               green = gamma.green;\r
-               blue = gamma.blue;\r
-               return true;\r
-       }\r
-       #endif\r
-       #if defined(_IRR_LINUX_X11_VIDMODE_) && defined(_IRR_LINUX_X11_RANDR_)\r
-       else\r
-       #endif\r
-       #ifdef _IRR_LINUX_X11_RANDR_\r
-       if (XRRQueryExtension(XDisplay, &eventbase, &errorbase))\r
-       {\r
-               XRRQueryVersion(XDisplay, &eventbase, &errorbase); // major, minor\r
-               if (eventbase>=1 && errorbase>1)\r
-               {\r
-               #if (RANDR_MAJOR>1 || RANDR_MINOR>1)\r
-                       XRRCrtcGamma *gamma = XRRGetCrtcGamma(XDisplay, Screennr);\r
-                       if (gamma)\r
-                       {\r
-                               red = *gamma->red;\r
-                               green = *gamma->green;\r
-                               blue= *gamma->blue;\r
-                               XRRFreeGamma(gamma);\r
-                               return true;\r
-                       }\r
-               #endif\r
-               }\r
-       }\r
-       #endif\r
-       #endif\r
-       return false;\r
-}\r
-\r
-\r
 //! gets text from the clipboard\r
 //! \return Returns 0 if no string is in there, otherwise utf-8 text.\r
 const c8 *CIrrDeviceLinux::getTextFromClipboard() const\r
index 52dec838a4ac34c119ba8d5b6203933dc9f240e7..9e3479f6eb981ced86a1d70631d4667407d88a90 100644 (file)
 #include <X11/Xlib.h>\r
 #include <X11/Xutil.h>\r
 #include <X11/cursorfont.h>\r
-#ifdef _IRR_LINUX_X11_VIDMODE_\r
-#include <X11/extensions/xf86vmode.h>\r
-#endif\r
-#ifdef _IRR_LINUX_X11_RANDR_\r
-#include <X11/extensions/Xrandr.h>\r
-#endif\r
 #include <X11/keysym.h>\r
 \r
 #ifdef _IRR_LINUX_X11_XINPUT2_\r
@@ -101,12 +95,6 @@ namespace irr
                //! Activate any joysticks, and generate events for them.\r
                virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo) _IRR_OVERRIDE_;\r
 \r
-               //! Set the current Gamma Value for the Display\r
-               virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast ) _IRR_OVERRIDE_;\r
-\r
-               //! Get the current Gamma Value for the Display\r
-               virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast ) _IRR_OVERRIDE_;\r
-\r
                //! gets text from the clipboard\r
                //! \return Returns 0 if no string is in there, otherwise utf-8 text.\r
                virtual const c8 *getTextFromClipboard() const;\r
index aacc8f82c2d649061c8acd3409e89d4549a3c4c7..331c8e593d789e21561bf93738ba5fefbd7d4afd 100644 (file)
@@ -1012,25 +1012,6 @@ bool CIrrDeviceSDL::isWindowMinimized() const
 }\r
 \r
 \r
-//! Set the current Gamma Value for the Display\r
-bool CIrrDeviceSDL::setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast )\r
-{\r
-       /*\r
-       // todo: Gamma in SDL takes ints, what does Irrlicht use?\r
-       return (SDL_SetGamma(red, green, blue) != -1);\r
-       */\r
-       return false;\r
-}\r
-\r
-//! Get the current Gamma Value for the Display\r
-bool CIrrDeviceSDL::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast )\r
-{\r
-/*     brightness = 0.f;\r
-       contrast = 0.f;\r
-       return (SDL_GetGamma(&red, &green, &blue) != -1);*/\r
-       return false;\r
-}\r
-\r
 //! returns color format of the window.\r
 video::ECOLOR_FORMAT CIrrDeviceSDL::getColorFormat() const\r
 {\r
index d630de1d44dd18a4fb68b59c6c6b96a433b12fca..05391504d07d92d78c630d31046acc6522fcca19 100644 (file)
@@ -88,12 +88,6 @@ namespace irr
                //! Activate any joysticks, and generate events for them.\r
                virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo) _IRR_OVERRIDE_;\r
 \r
-               //! Set the current Gamma Value for the Display\r
-               virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast ) _IRR_OVERRIDE_;\r
-\r
-               //! Get the current Gamma Value for the Display\r
-               virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast ) _IRR_OVERRIDE_;\r
-\r
                //! Get the device type\r
                virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_\r
                {\r
index 3bad68ae9d17520bd46cf9eb5076d82d19d72479..95e7c5d144053db0ee41a952aab2af5dc92ca847 100644 (file)
@@ -363,60 +363,6 @@ bool CIrrDeviceStub::isDeviceMotionAvailable()
     return false;\r
 }\r
 \r
-/*!\r
-*/\r
-void CIrrDeviceStub::calculateGammaRamp ( u16 *ramp, f32 gamma, f32 relativebrightness, f32 relativecontrast )\r
-{\r
-       s32 i;\r
-       s32 value;\r
-       s32 rbright = (s32) ( relativebrightness * (65535.f / 4 ) );\r
-       f32 rcontrast = 1.f / (255.f - ( relativecontrast * 127.5f ) );\r
-\r
-       gamma = gamma > 0.f ? 1.0f / gamma : 0.f;\r
-\r
-       for ( i = 0; i < 256; ++i )\r
-       {\r
-               value = (s32)(pow( rcontrast * i, gamma)*65535.f + 0.5f );\r
-               ramp[i] = (u16) core::s32_clamp ( value + rbright, 0, 65535 );\r
-       }\r
-\r
-}\r
-\r
-void CIrrDeviceStub::calculateGammaFromRamp ( f32 &gamma, const u16 *ramp )\r
-{\r
-       /* The following is adapted from a post by Garrett Bass on OpenGL\r
-       Gamedev list, March 4, 2000.\r
-       */\r
-       f32 sum = 0.0;\r
-       s32 i, count = 0;\r
-\r
-       gamma = 1.0;\r
-       for ( i = 1; i < 256; ++i ) {\r
-               if ( (ramp[i] != 0) && (ramp[i] != 65535) ) {\r
-                       f32 B = (f32)i / 256.f;\r
-                       f32 A = ramp[i] / 65535.f;\r
-                       sum += (f32) ( logf(A) / logf(B) );\r
-                       count++;\r
-               }\r
-       }\r
-       if ( count && sum ) {\r
-               gamma = 1.0f / (sum / count);\r
-       }\r
-\r
-}\r
-\r
-//! Set the current Gamma Value for the Display\r
-bool CIrrDeviceStub::setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast )\r
-{\r
-       return false;\r
-}\r
-\r
-//! Get the current Gamma Value for the Display\r
-bool CIrrDeviceStub::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast )\r
-{\r
-       return false;\r
-}\r
-\r
 //! Set the maximal elapsed time between 2 clicks to generate doubleclicks for the mouse. It also affects tripleclick behavior.\r
 void CIrrDeviceStub::setDoubleClickTime( u32 timeMs )\r
 {\r
index 546b2bad9d53b860e08e5e6a02744f553c073ad8..d59277befc87e44be4fe43e7cb85a59180c74b6f 100644 (file)
@@ -145,12 +145,6 @@ namespace irr
         //! Is device motion available.\r
         virtual bool isDeviceMotionAvailable() _IRR_OVERRIDE_;\r
 \r
-               //! Set the current Gamma Value for the Display\r
-               virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast ) _IRR_OVERRIDE_;\r
-\r
-               //! Get the current Gamma Value for the Display\r
-               virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast ) _IRR_OVERRIDE_;\r
-\r
                //! Set the maximal elapsed time between 2 clicks to generate doubleclicks for the mouse. It also affects tripleclick behavior.\r
                //! When set to 0 no double- and tripleclicks will be generated.\r
                virtual void setDoubleClickTime( u32 timeMs ) _IRR_OVERRIDE_;\r
@@ -177,9 +171,6 @@ namespace irr
                */\r
                virtual u32 checkSuccessiveClicks(s32 mouseX, s32 mouseY, EMOUSE_INPUT_EVENT inputEvent);\r
 \r
-               void calculateGammaRamp ( u16 *ramp, f32 gamma, f32 relativebrightness, f32 relativecontrast );\r
-               void calculateGammaFromRamp ( f32 &gamma, const u16 *ramp );\r
-\r
                //! Checks whether the input device should take input from the IME\r
                bool acceptsIME();\r
 \r
index 0ea188b1f2418761542f5b1aed1a589f68e6b588..d8d1702a9e19a0bf812cde83ad4d1f41e8998128 100644 (file)
@@ -1383,46 +1383,6 @@ bool CIrrDeviceWin32::activateJoysticks(core::array<SJoystickInfo> & joystickInf
 }\r
 \r
 \r
-//! Set the current Gamma Value for the Display\r
-bool CIrrDeviceWin32::setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast )\r
-{\r
-       bool r;\r
-       u16 ramp[3][256];\r
-\r
-       calculateGammaRamp( ramp[0], red, brightness, contrast );\r
-       calculateGammaRamp( ramp[1], green, brightness, contrast );\r
-       calculateGammaRamp( ramp[2], blue, brightness, contrast );\r
-\r
-       HDC dc = GetDC(0);\r
-       r = SetDeviceGammaRamp ( dc, ramp ) == TRUE;\r
-       ReleaseDC(HWnd, dc);\r
-       return r;\r
-}\r
-\r
-//! Get the current Gamma Value for the Display\r
-bool CIrrDeviceWin32::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast )\r
-{\r
-       bool r;\r
-       u16 ramp[3][256];\r
-\r
-       HDC dc = GetDC(0);\r
-       r = GetDeviceGammaRamp ( dc, ramp ) == TRUE;\r
-       ReleaseDC(HWnd, dc);\r
-\r
-       if (r)\r
-       {\r
-               calculateGammaFromRamp(red, ramp[0]);\r
-               calculateGammaFromRamp(green, ramp[1]);\r
-               calculateGammaFromRamp(blue, ramp[2]);\r
-       }\r
-\r
-       brightness = 0.f;\r
-       contrast = 0.f;\r
-\r
-       return r;\r
-}\r
-\r
-\r
 //! Process system events\r
 void CIrrDeviceWin32::handleSystemMessages()\r
 {\r
index 02c42b7e8cf6f0a8eea36833655426f8803aa876..863f2a65426eebc3c735b593371a30a6177d20a7 100644 (file)
@@ -89,12 +89,6 @@ namespace irr
                //! Activate any joysticks, and generate events for them.\r
                virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo) _IRR_OVERRIDE_;\r
 \r
-               //! Set the current Gamma Value for the Display\r
-               virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast ) _IRR_OVERRIDE_;\r
-\r
-               //! Get the current Gamma Value for the Display\r
-               virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast ) _IRR_OVERRIDE_;\r
-\r
                //! Remove all messages pending in the system message loop\r
                virtual void clearSystemMessages() _IRR_OVERRIDE_;\r
 \r
index 0aeb5335dd6a05b8b6067e86e534deb01ee99a59..07c10cd6f05af1a8ebe2175f4739eee2c03d71da 100644 (file)
@@ -139,7 +139,6 @@ set(link_libs
        "$<$<PLATFORM_ID:Windows>:gdi32>"
        "$<$<PLATFORM_ID:Windows>:winmm>"
        ${X11_X11_LIB}
-       ${X11_Xxf86vm_LIB}
 )
 
 # Source files