Revision 369ee56a
Added by Leszek Koltunski over 8 years ago
src/main/res/raw/main_vertex_shader.glsl | ||
---|---|---|
83 | 83 |
float degree_bitmap(in vec2 S, in vec2 PS) |
84 | 84 |
{ |
85 | 85 |
vec2 A = sign(PS)*u_objD.xy + S; |
86 |
float B = sign(A.x*A.y); |
|
87 | 86 |
|
88 |
return B*B*(1.0 + min(-PS.x/A.x,-PS.y/A.y)); |
|
87 |
vec2 signA = sign(A); // |
|
88 |
vec2 signA_SQ = signA*signA; // div = PS/A if A!=0, 0 otherwise. |
|
89 |
vec2 div = signA_SQ*PS/(A+signA_SQ-vec2(1,1)); // |
|
90 |
|
|
91 |
return 1.0-max(div.x,div.y); |
|
89 | 92 |
} |
90 | 93 |
|
91 | 94 |
////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
111 | 114 |
vec2 PO = PS + region.xy; |
112 | 115 |
float D = region.z*region.z-dot(PO,PO); // D = |OX|^2 - |PO|^2 |
113 | 116 |
vec2 A = sign(PS)*u_objD.xy + S; |
114 |
float B = sign(A.x*A.y); |
|
115 |
float E = B*B*(1.0 + min(-PS.x/A.x,-PS.y/A.y)); |
|
117 |
vec2 signA = sign(A); |
|
118 |
vec2 signA_SQ = signA*signA; |
|
119 |
vec2 div = signA_SQ*PS/(A+signA_SQ-vec2(1,1)); |
|
120 |
float E = 1.0-max(div.x,div.y); |
|
121 |
|
|
116 | 122 |
float ps_sq = dot(PS,PS); |
117 | 123 |
float one_over_ps_sq = 1.0/(ps_sq+1.0-sign(ps_sq)); // return 1.0 if ps_sq = 0.0 |
118 | 124 |
float DOT = dot(PS,PO)*one_over_ps_sq; |
... | ... | |
279 | 285 |
v.z += uz*d*d*(3.0*d*d -8.0*d +6.0); // thick bubble |
280 | 286 |
float b = -(12.0*uz*d*(1.0-d)*(1.0-d)*(1.0-d)) / (dt + (1.0-d)*dot(w,ps) + (sign(dt)-1.0) ); // the last part - (sign-1) is to avoid b being a NaN when ps=(0,0) |
281 | 287 |
|
282 |
v.xy += d*w;
|
|
288 |
v.xy += d*w; |
|
283 | 289 |
n.xy += b*ps; |
284 | 290 |
} |
285 | 291 |
|
Also available in: Unified diff
fix in vertex shader