From 86482ed82fdef38623cdea190189d2bcd15f8047 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 2 Sep 2013 21:25:46 +0200 Subject: [PATCH] Fixed some shader compile errors. --HG-- branch : gsoc2013-dfighter --- .../3d/driver/OpenGL3/driver_glsl_shader_generator.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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 ef5246e8b..28ecfaba4 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 @@ -295,14 +295,16 @@ namespace NL3D ss << "vec3 ReflectionMap( const in vec3 eyePos, const in vec3 normal )" << std::endl; ss << "{" << std::endl; ss << "vec3 u = normalize( eyePos );" << std::endl; - ss <<"return reflect( u, normal );" << std::endl; + ss << "return reflect( u, normal );" << std::endl; ss << "}" << std::endl; ss << std::endl; ss << "void main( void )" << std::endl; ss << "{" << std::endl; ss << "vec4 eyePosition = mvMatrix * v" << attribNames[ 0 ] << ";" << std::endl; - ss << "cubeTexCoords = ReflectionMap( eyePosition, v" << attribNames[ 2 ] << " );" << std::endl; + ss << "vec3 ep = eyePosition.xyz / eyePosition.w;" << std::endl; + ss << "vec3 n = vnormal.xyz;" << std::endl; + ss << "cubeTexCoords = ReflectionMap( ep, n );" << std::endl; ss << "vec4 t = vec4( cubeTexCoords, 1.0 );" << std::endl; ss << "t = t * texMatrix;" << std::endl; ss << "cubeTexCoords = t.xyz;" << std::endl; @@ -904,8 +906,8 @@ namespace NL3D ss << "vec4 texel;" << std::endl; ss << "texel.rgb = texel0.rgb * diffuse;" << std::endl; ss << "texel.a = texel0.a;" << std::endl; - ss << "texel.rgb = texel1.rgb * texel.alpha + texel.rgb;" << std::endl; - ss << "texel.a = color.a;" << std::endl; + ss << "texel.rgb = texel1.rgb * texel.a + texel.rgb;" << std::endl; + ss << "texel.a = texel1.a;" << std::endl; ss << "fragColor = texel;" << std::endl; ss << "}" << std::endl; }