ソースを参照

add an animated variant of the colors shader

Lucas Stadler 10 年 前
コミット
77e89bdcbf
共有1 個のファイルを変更した20 個の追加1 個の削除を含む
  1. 20 1
      glsl/defaultFiles.js

+ 20 - 1
glsl/defaultFiles.js

@ -4,6 +4,25 @@ files.builtin = {
4 4
5 5
void main() {
6 6
  gl_FragColor = vec4(gl_FragCoord.xy / iResolution, blue, 1.0);
7
}`,
8
  "colors2.frag": `/*
9
 * A shader that maps the RGB scale onto the canvas.
10
 *
11
 * Blue controls the amount of blue to mix in, or the speed with which
12
 * to animate from/to blue when animating.
13
 */
14
15
uniform float blue; //#slider[0.0,0.0,1.0]
16
17
void main() {
18
  if (iGlobalTime > 0.0) {
19
    // if animating, control the speed of the color shift
20
    gl_FragColor = vec4(gl_FragCoord.xy / iResolution,
21
                        0.5 + sin(iGlobalTime * blue)*0.5, 1.0);
22
  } else {
23
    // else just control the blue component
24
    gl_FragColor = vec4(gl_FragCoord.xy / iResolution, blue, 1.0);
25
  }
7 26
}`,
8 27
  "default.frag": `//#include "includes/sphere-tracer.frag"
9 28
//#include "includes/default-main.frag"
@ -97,4 +116,4 @@ void main() {
97 116
98 117
  gl_FragColor = vec4( col, 1.0 );
99 118
}`
100
};
119
};