From 6f396aa8f768e21e1e4f31facf911162c926b78e Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 15 Sep 2013 21:27:23 +0200 Subject: [PATCH] Added the directional light(s) to the lightmap shader too. --HG-- branch : gsoc2013-dfighter --- .../driver/OpenGL3/driver_glsl_shader_generator.cpp | 13 +++++++++++++ .../src/3d/driver/OpenGL3/driver_opengl_program.cpp | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/code/nel/src/3d/driver/OpenGL3/driver_glsl_shader_generator.cpp b/code/nel/src/3d/driver/OpenGL3/driver_glsl_shader_generator.cpp index 4ddf4bfcc..f35ffa305 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_glsl_shader_generator.cpp +++ b/code/nel/src/3d/driver/OpenGL3/driver_glsl_shader_generator.cpp @@ -1168,6 +1168,16 @@ namespace NL3D ss << std::endl; + if( desc->lightingEnabled() ) + { + addLightUniformsFS(); + addLightInsFS(); + ss << std::endl; + + addLightsFunctionFS(); + ss << std::endl; + } + if( desc->fogEnabled() ) addFogFunction(); @@ -1207,6 +1217,9 @@ namespace NL3D } ss << "fragColor = texel;" << std::endl; + + if( desc->lightingEnabled() ) + addLightsFS(); if( desc->fogEnabled() ) addFog(); diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl_program.cpp b/code/nel/src/3d/driver/OpenGL3/driver_opengl_program.cpp index a57cac824..9357caab4 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl_program.cpp +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl_program.cpp @@ -401,19 +401,19 @@ namespace NL3D int ldc = currentProgram->getUniformIndex( IProgramObject::EUniform( IProgramObject::Light0ColDiff + i ) ); if( ldc != -1 ) { - setUniform4f( ldc, 1.0f, 0.0f, 0.0f, 1.0f ); + setUniform4f( ldc, 1.0f, 1.0f, 1.0f, 1.0f ); } int lsc = currentProgram->getUniformIndex( IProgramObject::EUniform( IProgramObject::Light0ColSpec + i ) ); if( lsc != -1 ) { - setUniform4f( lsc, 0.0f, 1.0f, 0.0f, 1.0f ); + setUniform4f( lsc, 1.0f, 1.0f, 1.0f, 1.0f ); } int lac = currentProgram->getUniformIndex( IProgramObject::EUniform( IProgramObject::Light0ColAmb + i ) ); if( lac != -1 ) { - setUniform4f( lac, 0.0f, 0.0f, 0.3f, 1.0f ); + setUniform4f( lac, 0.1f, 0.1f, 0.1f, 1.0f ); } }