gl and clicking fiexs

This commit is contained in:
biglyderv 2025-03-04 05:14:52 -05:00
parent 2c842d5b0f
commit 588f5c09d8
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
2 changed files with 7 additions and 3 deletions

View file

@ -33,7 +33,7 @@
void main() {
// gl_FragColor is a special variable a fragment shader
// is responsible for setting
float dist = (log(distance(b_position.xy,vec2(0.0))) - size_thing) / log(2.0) * 0.1;
float dist = (log(distance(b_position.xy,vec2(0.0))) - size_thing + dist_thing) / log(2.0) * 0.1;
gl_FragColor = vec4((mod(dist,0.1) - 0.1 + 0.1 * dist_thing) * 50.0 * vec3(1,1,1),1); // return redish-purple
}

View file

@ -106,7 +106,7 @@ function renderThing() {
hud.textContent = `${Math.floor(nothingness * 100) / 100} nothings; ${Math.floor(nGain * 60 * 100) / 100} nil/sec`
gl.uniform1f(sizeBuffer, -Math.log(nothingness));
gl.uniform1f(distBuffer, 0.1 + nGain / (nothingness+10));
gl.uniform1f(distBuffer, 0.1 + 3 * nGain/(nGain+1));
var primitiveType = gl.TRIANGLES;
var offset = 0;
@ -121,6 +121,11 @@ requestAnimationFrame(renderThing)
let clicking = false;
setInterval(function() {
nothingness += nGain;
},1000 / 60)
document.body.onclick = async function() {
if (clicking) return;
clicking = true;
@ -128,7 +133,6 @@ document.body.onclick = async function() {
nGain += 0.05;
while (nGain > oldNGain) {
nGain -= 0.005;
nothingness += nGain;
await new Promise((res) => setTimeout(res,1000 / 60))
}
nGain = oldNGain;