Revision 02ef26bc
Added by Leszek Koltunski over 7 years ago
src/main/res/raw/main_vertex_shader.glsl | ||
---|---|---|
334 | 334 |
vec4 SO = vUniforms[effect+2]; |
335 | 335 |
float d1_circle = degree_region(SO,PS); |
336 | 336 |
float d1_bitmap = degree_bitmap(center,PS); |
337 |
float sinA = vUniforms[effect+1].x; // sin(A) precomputed in EffectListVertex.postprocess
|
|
338 |
float cosA = vUniforms[effect+1].y; // cos(A) precomputed in EffectListVertex.postprocess
|
|
337 |
float sinA = vUniforms[effect ].x; // sin(A) precomputed in EffectListVertex.postprocess
|
|
338 |
float cosA = vUniforms[effect+1].x; // cos(A) precomputed in EffectListVertex.postprocess
|
|
339 | 339 |
vec2 PS2 = vec2( PS.x*cosA+PS.y*sinA,-PS.x*sinA+PS.y*cosA ); // vector PS rotated by A radians clockwise around center. |
340 | 340 |
vec4 SG = (1.0-d1_circle)*SO; // coordinates of the dilated circle P is going to get rotated around |
341 | 341 |
float d2 = max(0.0,degree(SG,center,PS2)); // make it a max(0,deg) because otherwise when center=left edge of the |
... | ... | |
350 | 350 |
|
351 | 351 |
void wave(in int effect, inout vec4 v) |
352 | 352 |
{ |
353 |
vec2 center = vUniforms[effect+1].zw; |
|
353 |
vec2 center = vUniforms[effect+1].zw; |
|
354 |
float sinA = vUniforms[effect ].y; |
|
355 |
float cosA = vUniforms[effect+1].x; |
|
356 |
float sinB = vUniforms[effect ].w; |
|
357 |
float cosB = vUniforms[effect+1].y; |
|
358 |
float amplitude = vUniforms[effect ].x; |
|
359 |
float length = vUniforms[effect ].z; |
|
360 |
|
|
354 | 361 |
vec2 ps = center-v.xy; |
355 | 362 |
float deg = degree_region(vUniforms[effect+2],ps); |
356 |
vec2 sincos = vUniforms[effect+1].xy; |
|
357 |
|
|
358 |
float amplitude = vUniforms[effect].x; |
|
359 |
float length = vUniforms[effect].z; |
|
360 |
float d = dot( vec2(-ps.y,-ps.x),sincos ); |
|
363 |
float d = -ps.x*cosB-ps.y*sinB; |
|
361 | 364 |
float num = length==0.0 ? 0.0 : d / length; |
362 | 365 |
|
363 |
v.xy += (sin(1.578*num)*amplitude*deg*sincos);
|
|
366 |
v.xy += (sin(1.578*num)*amplitude*deg*vec2(sinB,cosB));
|
|
364 | 367 |
} |
365 | 368 |
|
366 | 369 |
#endif |
Also available in: Unified diff
Preparation to make the WAVE effect fully 3D