feat(all): 迁移扩展相关功能
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
precision highp float;
|
||||
precision highp int;
|
||||
|
||||
uniform sampler2D tInput;
|
||||
uniform vec2 delta;
|
||||
in vec2 coord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
/* get vertex info */
|
||||
vec4 info = texture(tInput, coord);
|
||||
|
||||
/* calculate average neighbor height */
|
||||
vec2 dx = vec2(delta.x, 0.0);
|
||||
vec2 dy = vec2(0.0, delta.y);
|
||||
float average = (
|
||||
texture(tInput, coord - dx).r +
|
||||
texture(tInput, coord - dy).r +
|
||||
texture(tInput, coord + dx).r +
|
||||
texture(tInput, coord + dy).r
|
||||
) * 0.25;
|
||||
|
||||
/* change the velocity to move toward the average */
|
||||
info.g += (average - info.r) * 2.0;
|
||||
|
||||
/* attenuate the velocity a little so waves do not last forever */
|
||||
info.g *= 0.995;
|
||||
|
||||
/* move the vertex along the velocity */
|
||||
info.r += info.g;
|
||||
|
||||
fragColor = info;
|
||||
}
|
||||
Reference in New Issue
Block a user