From 90dc025fd8ab1abe24fc813bb30024d7195099a5 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 12 Nov 2013 01:38:43 +0100 Subject: [PATCH] Fixed: Some uniforms names were wrong after the merge, which led to rendering issues. --HG-- branch : gsoc2013-dfighter --- .../opengl3/driver_glsl_shader_generator.cpp | 26 +++++++++---------- code/nel/src/3d/program.cpp | 2 +- 2 files changed, 14 insertions(+), 14 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 09f4049a3..4e04644bb 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 @@ -266,12 +266,12 @@ namespace NL3D void CGLSLShaderGenerator::addDiffuse() { - ss << "uniform vec4 diffuse;" << std::endl; + ss << "uniform vec4 diffuseColor;" << std::endl; } void CGLSLShaderGenerator::addColor() { - ss << "uniform vec4 mcolor;" << std::endl; + ss << "uniform vec4 materialColor;" << std::endl; } void CGLSLShaderGenerator::addConstants() @@ -979,7 +979,7 @@ namespace NL3D buildArg( stage, 0, false, arg0 ); buildArg( stage, 1, false, arg1 ); - std::string As = "diffuse.a"; + std::string As = "diffuseColor.a"; ss << "texel.rgb = " << arg0 << " * " << As << ";" << std::endl; ss << "texel.rgb = texel.rgb + " << arg1 << " * " << "( 1.0 - " << As << " );" << std::endl; @@ -1082,7 +1082,7 @@ namespace NL3D buildArg( stage, 0, true, arg0 ); buildArg( stage, 1, true, arg1 ); - std::string As = "diffuse.a"; + std::string As = "diffuseColor.a"; ss << "texel.a = " << arg0 << " * " << As << ";" << std::endl; ss << "texel.a = texel.a + " << arg1 << " * " << "( 1.0 - " << As << " );" << std::endl; @@ -1178,19 +1178,19 @@ namespace NL3D switch( op ) { case CMaterial::SrcColor: - ds << "mcolor.rgb"; + ds << "materialColor.rgb"; break; case CMaterial::InvSrcColor: - ds << "( vec3( 1.0, 1.0, 1.0 ) - mcolor.rgb )"; + ds << "( vec3( 1.0, 1.0, 1.0 ) - materialColor.rgb )"; break; case CMaterial::SrcAlpha: - ds << "mcolor.a"; + ds << "materialColor.a"; break; case CMaterial::InvSrcAlpha: - ds << "( 1.0 - mcolor.a )"; + ds << "( 1.0 - materialColor.a )"; break; } break; @@ -1279,7 +1279,7 @@ namespace NL3D // Color map UV coords are at position 0 ss << "vec4 texel" << ntextures - 1 << " = texture2D( sampler" << ntextures - 1 << ", " << attribNames[ TexCoord0 ] << " );" << std::endl; - //ss << "vec4 texel = diffuse;" << std::endl; + //ss << "vec4 texel = diffuseColor;" << std::endl; //ss << "vec4 texel = vec4( 1.0, 1.0, 1.0, 1.0 );" << std::endl; ss << "vec4 texel = vec4( 0.0, 0.0, 0.0, 1.0 );" << std::endl; @@ -1346,7 +1346,7 @@ namespace NL3D ss << "vec4 texel0 = texture2D( sampler0, texCoord0 );" << std::endl; ss << "vec4 texel1 = textureCube( sampler1, cubeTexCoords );" << std::endl; ss << "vec4 texel;" << std::endl; - ss << "texel.rgb = texel0.rgb * diffuse;" << std::endl; + ss << "texel.rgb = texel0.rgb * diffuseColor;" << std::endl; ss << "texel.a = texel0.a;" << std::endl; ss << "texel.rgb = texel1.rgb * texel.a + texel.rgb;" << std::endl; ss << "texel.a = texel1.a;" << std::endl; @@ -1400,15 +1400,15 @@ namespace NL3D ss << "texel.rgb = texel0.rgb * constant0.rgb + constant0.rgb;" << std::endl; ss << "texel.rgb = texel1.rgb * texel.rgb;" << std::endl; ss << "texel.rgb = texel2.rgb * constant2.rgb + texel.rgb;" << std::endl; - ss << "texel.a = texel0.a * diffuse.a" << std::endl; + ss << "texel.a = texel0.a * diffuseColor.a" << std::endl; ss << "texel.a = texel1.a * texel.a;" << std::endl; } else { ss << "texel.rgb = texel0.rgb * constant0.rgb + color.rgb;" << std::endl; ss << "texel.rgb = texel1.rgb * texel.rgb;" << std::endl; - ss << "texel.a = texel0.a * diffuse.a;" << std::endl; - ss << "texel.a = texel1.a * diffuse.a;" << std::endl; + ss << "texel.a = texel0.a * diffuseColor.a;" << std::endl; + ss << "texel.a = texel1.a * diffuseColor.a;" << std::endl; } ss << "fragColor = texel;" << std::endl; diff --git a/code/nel/src/3d/program.cpp b/code/nel/src/3d/program.cpp index 85ba08a6a..f29e4ab5d 100644 --- a/code/nel/src/3d/program.cpp +++ b/code/nel/src/3d/program.cpp @@ -95,7 +95,7 @@ const char *CProgramIndex::Names[NUM_UNIFORMS] = "fogEnd", "fogColor", - "color", + "materialColor", "diffuseColor", "constant0",