From 3885389b3bb1a1cbd92768e1082b89efa14d3663 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 30 Mar 2014 16:42:53 +0200 Subject: [PATCH] GL3: Remove GL_LIGHTING --HG-- branch : opengl3 --- .../src/3d/driver/opengl3/driver_opengl.cpp | 2 +- .../3d/driver/opengl3/driver_opengl_light.cpp | 2 +- .../driver/opengl3/driver_opengl_material.cpp | 5 +- .../driver/opengl3/driver_opengl_states.cpp | 100 ++++-------------- .../3d/driver/opengl3/driver_opengl_states.h | 11 -- 5 files changed, 28 insertions(+), 92 deletions(-) diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl.cpp index 618bc92bc..7e533507a 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl.cpp @@ -473,7 +473,7 @@ bool CDriverGL3::setupDisplay() // Backward compatibility: default lighting is Light0 default openGL // meaning that light direction is always (0,1,0) in eye-space // use enableLighting(0....), to get normal behaviour - _DriverGLStates.enableLight(0, true); + // _DriverGLStates.enableLight(0, true); // FIXME GL3 VERTEX PROGRAM _LightMode[0] = CLight::DirectionalLight; _WorldLightDirection[0] = CVector::Null; diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl_light.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl_light.cpp index 6a93042d1..6713f0ea6 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_light.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_light.cpp @@ -134,7 +134,7 @@ void CDriverGL3::enableLightInternal(uint8 num, bool enable) // Enable glLight if (num < MaxLight) { - _DriverGLStates.enableLight(num, enable); // FIXME GL3 FIXED + // _DriverGLStates.enableLight(num, enable); // FIXME GL3 VERTEX PROGRAM _UserLightEnable[num] = enable; } } diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl_material.cpp index f243ff531..c0c8d61d1 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_material.cpp @@ -437,7 +437,8 @@ bool CDriverGL3::setupMaterial(CMaterial& mat) // Light Part. - _DriverGLStates.enableLighting(mat.getFlags()&IDRV_MAT_LIGHTING); + // _DriverGLStates.enableLighting(mat.getFlags()&IDRV_MAT_LIGHTING); // FIXME GL3 VERTEX PROGRAM + if ((mat.getFlags() & IDRV_MAT_LIGHTING) == 0) disableAllLights(); @@ -773,7 +774,7 @@ sint CDriverGL3::beginLightMapMultiPass () computeLightMapInfos (mat); // always enable lighting for lightmap (because of dynamic light) - _DriverGLStates.enableLighting(true); + // _DriverGLStates.enableLighting(true); // FIXME GL3 VERTEX PROGRAM // if the dynamic lightmap light has changed since the last render (should not happen), resetup // normal way is that setupLightMapDynamicLighting() is called in setupMaterial() if shader different from prec diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl_states.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl_states.cpp index 628b747be..9af9d0881 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_states.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_states.cpp @@ -63,11 +63,6 @@ void CDriverGLStates3::init() _DepthRangeNear = 0.f; _DepthRangeFar = 1.f; _ZBias = 0.f; - // by default all lights are disabled (not reseted in forceDefaults) - for (i=0; i::max(); @@ -104,7 +97,7 @@ void CDriverGLStates3::forceDefaults(uint nbStages) _CurStencilOpZFail = GL_KEEP; _CurStencilOpZPass = GL_KEEP; _CurStencilWriteMask = std::numeric_limits::max(); - _CurAlphaTestThreshold= 0.5f; + _CurAlphaTestThreshold = 0.5f; // setup GLStates. glBlendFunc(_CurBlendSrc, _CurBlendDst); @@ -114,25 +107,24 @@ void CDriverGLStates3::forceDefaults(uint nbStages) glStencilMask(_CurStencilWriteMask); // Materials. - uint32 packedOne= (CRGBA(255,255,255,255)).getPacked(); - uint32 packedZero= (CRGBA(0,0,0,255)).getPacked(); - _CurEmissive= packedZero; - _CurAmbient= packedOne; - _CurDiffuse= packedOne; - _CurSpecular= packedZero; - _CurShininess= 1; + uint32 packedOne = (CRGBA(255, 255, 255, 255)).getPacked(); + uint32 packedZero = (CRGBA(0, 0, 0, 255)).getPacked(); + _CurEmissive = packedZero; + _CurAmbient = packedOne; + _CurDiffuse = packedOne; + _CurSpecular = packedZero; + _CurShininess = 1; // Lighted vertex color - _VertexColorLighted=false; + _VertexColorLighted = false; glDisable(GL_COLOR_MATERIAL); // setup GLStates. - static const GLfloat one[4]= {1,1,1,1}; - static const GLfloat zero[4]= {0,0,0,1}; + static const GLfloat one[4] = { 1, 1, 1, 1 }; + static const GLfloat zero[4] = { 0, 0, 0, 1 }; // TexModes - uint stage; - for (stage=0;stage= MaxLight) - return; - - // If different from current setup, update. - bool enabled= (enable!=0); -#ifndef NL3D_GLSTATE_DISABLE_CACHE - if (enabled != _CurLight[num]) -#endif - { - // new state. - _CurLight[num]= enabled; - } -} - -// *************************************************************************** -bool CDriverGLStates3::isLightEnabled(uint num) const -{ - H_AUTO_OGL(CDriverGLStates3_isLightEnabled) - if (num >= MaxLight) - return false; - else - return _CurLight[num]; -} - - // *************************************************************************** void CDriverGLStates3::enableZWrite(uint enable) { diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl_states.h b/code/nel/src/3d/driver/opengl3/driver_opengl_states.h index 6603ca71f..df39a3625 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_states.h +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_states.h @@ -89,12 +89,6 @@ public: /// enable and set good AlphaFunc. void enableAlphaTest(uint enable); void enableZWrite(uint enable); - // overall lighting enabled - void enableLighting(uint enable); - bool isLightingEnabled() const { return _CurLighting; } - /// enable/disable specific light. num must be < "maxLight" param set in init() - void enableLight(uint num, uint enable); - bool isLightEnabled(uint num) const; /// enable/disable stencil test void enableStencilTest(bool enable); bool isStencilTestEnabled() const { return _CurStencilTest; } @@ -170,7 +164,6 @@ private: bool _CurFog; bool _CurCullFace; bool _CurAlphaTest; - bool _CurLighting; bool _CurZWrite; bool _CurStencilTest; @@ -217,10 +210,6 @@ private: private: void updateDepthRange(); - - // Mirror of glEnable() and GL_LIGHT0+i - enum { MaxLight = NL_OPENGL3_MAX_LIGHT }; - bool _CurLight[MaxLight]; }; #ifdef NL_STATIC