31 lines
776 B
GLSL
31 lines
776 B
GLSL
uniform vec3 colorStart;
|
|
uniform vec3 colorEnd;
|
|
|
|
uniform float useDash;
|
|
uniform float dashArray;
|
|
uniform float dashOffset;
|
|
uniform float dashRatio;
|
|
uniform sampler2D alphaMap;
|
|
uniform float useAlphaMap;
|
|
|
|
varying vec2 vUV;
|
|
varying vec4 vColor;
|
|
varying float vCounters;
|
|
|
|
vec4 CustomLinearTosRGB( in vec4 value ) {
|
|
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
|
|
}
|
|
|
|
void main() {
|
|
|
|
vec4 c = mix(vec4(colorStart,1.0),vec4(colorEnd, 1.0), vCounters);
|
|
|
|
if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV ).r;
|
|
|
|
if( useDash == 1. ){
|
|
c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));
|
|
}
|
|
|
|
gl_FragColor = CustomLinearTosRGB(c);
|
|
}
|