Commit b5010f02 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

GradientWidget GLSL function export now support multiple stops with the same value.

parent bc52d0df
......@@ -244,10 +244,17 @@ QString GradientWidget::getShaderFunctionBodyGLSL( int beg, int end, const QStri
if( end != beg )
{
int p = beg + (end-beg)/2;
int p1 = p, p2 = p;
while( p1>0 && m_Stops[p1-1].value() == m_Stops[p].value() )
-- p1;
while( p2<m_Stops.size()-1 && m_Stops[p2+1].value() == m_Stops[p].value() )
++ p2;
res += indent + "if( value <= " + QString::number( m_Stops[p].value() ) + " )\n";
res += getShaderFunctionBodyGLSL( beg, p, indent+" " );
res += getShaderFunctionBodyGLSL( beg, p1, indent+" " );
res += indent + "else\n";
res += getShaderFunctionBodyGLSL( p+1, end, indent+" " );
res += getShaderFunctionBodyGLSL( p2+1, end, indent+" " );
}
else
{
......
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