Compare commits
2
Commits
2a7d1f6df4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcd35af4f1 | ||
|
|
7a2bafc8de |
+1
-1
@@ -109,7 +109,7 @@ void main() {
|
|||||||
|
|
||||||
vec4 color = texture(iTex0, invert ? vUV : uv);
|
vec4 color = texture(iTex0, invert ? vUV : uv);
|
||||||
|
|
||||||
color = mix(color, 1. - color, iDemo * write_int(uv * 20., vec2(1.), iFPS, 2));
|
color = mix(color, 1. - color, iDemo * write_int_left(uv * 20., vec2(1., 1.), iFPS, 3));
|
||||||
color = mix(color, 1. - color, iDemo * write_5(uv * 20., vec2(1., 18.), textDEMO));
|
color = mix(color, 1. - color, iDemo * write_5(uv * 20., vec2(1., 18.), textDEMO));
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
|||||||
@@ -381,6 +381,7 @@ float write_int_left(vec2 uv, vec2 pos, int value, int magnitude)
|
|||||||
int i;
|
int i;
|
||||||
int m = 1;
|
int m = 1;
|
||||||
float d = 0.;
|
float d = 0.;
|
||||||
|
pos.x -= magnitude;
|
||||||
for (i = 0; i < magnitude; i++) {
|
for (i = 0; i < magnitude; i++) {
|
||||||
if (i == 0 || value >= m) {
|
if (i == 0 || value >= m) {
|
||||||
pos.x += 1.;
|
pos.x += 1.;
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ vec4 debug(vec2 vUV)
|
|||||||
|
|
||||||
// show mix
|
// show mix
|
||||||
f += char_at(uv2, vec2(1.55, -.6), mix_type ? 0x4B : 0x4D);
|
f += char_at(uv2, vec2(1.55, -.6), mix_type ? 0x4B : 0x4D);
|
||||||
f = mix(f, 1 - f, rect(uv2, vec2(.2, -.9 + .9 * mix_value), vec2(.9, .9 * mix_value)));
|
f = mix(f, 1 - f, rect(uv2, vec2(2., -.9 + .9 * mix_value), vec2(.9, .9 * mix_value)));
|
||||||
|
|
||||||
// show debug info
|
// show debug info
|
||||||
float v = 0.;
|
float v = 0.;
|
||||||
|
|||||||
+11
-5
@@ -1,14 +1,20 @@
|
|||||||
#ifndef INC_RAND
|
#ifndef INC_RAND
|
||||||
#define INC_RAND
|
#define INC_RAND
|
||||||
|
|
||||||
|
// https://thebookofshaders.com/10/
|
||||||
|
// https://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
|
||||||
|
|
||||||
float rand(float seed){
|
float rand(float seed){
|
||||||
float v = pow(abs(seed), .8571429); // 6. / 7.
|
const float c = 43758.5453;
|
||||||
v *= sin(v) + 1.;
|
return fract(sin(seed) * c);
|
||||||
return fract(v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float rand(vec2 n){
|
float rand(vec2 co)
|
||||||
return rand(n.x * 1234. + n.y * 9876.);
|
{
|
||||||
|
const float a = 12.9898;
|
||||||
|
const float b = 78.233;
|
||||||
|
float dt= dot(co.xy ,vec2(a,b));
|
||||||
|
return rand(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user