Commit 129a63f9 authored by Martin Heistermann's avatar Martin Heistermann

GL: respect alpha channel of vertex colors

parent 3c3f2507
......@@ -1182,7 +1182,11 @@ void ShaderProgGenerator::addVertexBeginCode(QStringList* _code)
_code->push_back("vec3 sg_vNormalOS = vec3(0.0, 1.0, 0.0);");
if (desc_.vertexColors && (desc_.colorMaterialMode == GL_AMBIENT || desc_.colorMaterialMode == GL_AMBIENT_AND_DIFFUSE))
_code->push_back(QString("vec4 sg_cColor = vec4(g_cEmissive + g_cLightModelAmbient * ") + ShaderGenerator::keywords.macro_inputVertexColor + QString(".xyz, SG_ALPHA);"));
_code->push_back(QString("vec4 sg_cColor = vec4(g_cEmissive + g_cLightModelAmbient * ")
+ ShaderGenerator::keywords.macro_inputVertexColor
+ QString(".rgb, SG_ALPHA * ")
+ ShaderGenerator::keywords.macro_inputVertexColor
+ QString(".a);"));
else
_code->push_back("vec4 sg_cColor = vec4(g_cEmissive + g_cLightModelAmbient * g_cAmbient, SG_ALPHA);");
......@@ -1817,7 +1821,11 @@ void ShaderProgGenerator::addFragmentBeginCode(QStringList* _code)
if (desc_.vertexColors && (desc_.colorMaterialMode == GL_AMBIENT || desc_.colorMaterialMode == GL_AMBIENT_AND_DIFFUSE))
_code->push_back(QString("vec4 sg_cColor = vec4(g_cEmissive + g_cLightModelAmbient * ") + ShaderGenerator::keywords.macro_inputVertexColor + QString(".xyz, SG_ALPHA);"));
_code->push_back(QString("vec4 sg_cColor = vec4(g_cEmissive + g_cLightModelAmbient * ")
+ ShaderGenerator::keywords.macro_inputVertexColor
+ QString(".rgb, SG_ALPHA * ")
+ ShaderGenerator::keywords.macro_inputVertexColor
+ QString(".a);"));
else
_code->push_back("vec4 sg_cColor = vec4(g_cEmissive + g_cLightModelAmbient * g_cAmbient, SG_ALPHA);");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment