Update auto_toon2.glsl

This commit is contained in:
myownfriend 2014-05-20 23:43:56 -04:00
parent 8b0d4db1ac
commit 4a0150033f
1 changed files with 45 additions and 41 deletions

View File

@ -7,6 +7,7 @@ uniform vec4 resolution;
void main()
{
//Changethis to increase the number of colors.
int numColors =8;
@ -20,8 +21,6 @@ void main()
float4 c0 = color - float4(edge, edge, edge, edge) * 12.0;
float red = 0.0;
float green = 0.0;
float blue = 0.0;
@ -33,12 +32,14 @@ void main()
float colorN = 0.0;
float colorB = 0.0;
for(count = 1; count <= numColors ; count++){
for (count = 1; count <= numColors; count++)
{
colorN = float(count / numColors);
if ( c0.r <= colorN && c0.r >= colorB && rr == false ){
if (count == 1){
if ( c0.r <= colorN && c0.r >= colorB && rr == false )
{
if (count == 1)
{
if (colorN >= 0.1)
red = 0.01;
else
@ -52,8 +53,10 @@ void main()
rr = true;
}
if (c0.b <= colorN && c0.b >= colorB && bb == false){
if (count == 1){
if (c0.b <= colorN && c0.b >= colorB && bb == false)
{
if (count == 1)
{
if(colorN >= 0.1)
blue = 0.01;
else
@ -67,8 +70,10 @@ void main()
bb = true;
}
if (c0.g <= colorN && c0.g >= colorB && gg == false){
if (count == 1){
if (c0.g <= colorN && c0.g >= colorB && gg == false)
{
if (count == 1)
{
if(colorN >= 0.1)
green = 0.01;
else
@ -82,11 +87,10 @@ void main()
}
colorB = float(count / numColors);
if(rr == true && bb == true && gg == true)
break;
}
ocol0 = float4(red, green, blue, c0.a);
}