Skip to content

Commit

Permalink
Add shader hill1ch.frag
Browse files Browse the repository at this point in the history
  • Loading branch information
rbn42 committed Oct 30, 2019
1 parent ae0e703 commit 47f43c5
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions kde/plasmoid/contents/shaders/hill1ch.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
uniform sampler2D tex1;
in mediump vec2 qt_TexCoord0;
out vec4 out_Color;

float height1(float distanc,float raw_height){
return raw_height-distanc;
}

float height2(float distanc,float raw_height){
return raw_height/(1+distanc*distanc);
}

float height(float distanc,float raw_height){
return raw_height*exp(-distanc*distanc*3);
}

void main()
{
float px_step=0.0005;
int max_distance=40;

float h=1-qt_TexCoord0.y;

out_Color=vec4(0,0,0,0);
float max_nb=0;
for(int i=-max_distance; i<max_distance+1; i++) {
float distanc=abs(i)/1.0/max_distance;
float x=qt_TexCoord0.x+i*px_step;
x=int(x*2000)/2000.0;

vec4 raw=texture(tex1, vec2(x,0.5));
float raw_max=(raw.g+raw.r)/2.;

if(h <=height(distanc,raw_max))
if(raw_max>max_nb){
max_nb=raw_max;
out_Color=vec4(getRGB(5*x),1.);
}
}
}

0 comments on commit 47f43c5

Please sign in to comment.