balancing, visuals, clicking,s tuff

This commit is contained in:
biglyderv 2025-03-06 21:31:44 -05:00
parent cf63368549
commit 25ebe3deb3
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
3 changed files with 15 additions and 21 deletions

View file

@ -36,7 +36,7 @@
// gl_FragColor is a special variable a fragment shader // gl_FragColor is a special variable a fragment shader
// is responsible for setting // is responsible for setting
if (is_fg) { if (is_fg) {
gl_FragColor = vec4(b_position.xyz*0.1,1) * 0.2 + vec4(0.3,0.3,0.3,1) * 0.8; gl_FragColor = vec4(b_position.xyz,1) * 0.2 + vec4(0.3,0.3,0.3,1) * 0.8;
return; return;
} }
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) / log(2.0) * 0.1;

View file

@ -35,33 +35,25 @@ document.querySelector('canvas').addEventListener('click', (e) => {
setInterval(function () { setInterval(function () {
nothingness += nGain + getBonus; nothingness += nGain + getBonus;
getBonus += 0.0001 * cubePos.length; nGain = 0.003 + 0.003 * cubePos.length;
getBonus *= 0.93; getBonus *= 0.93;
for (let a of cubePos) { for (let a of cubePos) {
let f = (nGain + getBonus * 100 + 10) / (nothingness + 10); let f = (nGain + getBonus * 1000 + 10) / (nothingness + 10);
console.log(f,getBonus)
f *= 50; let dist = Math.sqrt(a[0] ** 2 + a[1] ** 2)
dist = (f*90 / dist) ** 0.1;
if (f > 100) f = 100; a[3] = a[3] * 0.9 + a[0] * (dist - 1);
a[4] = a[4] * 0.9 + a[1] * (dist - 1);
a[0] = a[0] * 0.9 + a[3] * .4 * f; a[0] += a[3] * 0.01;
a[1] = a[1] * 0.9 + a[4] * .4 * f; a[1] += a[4] * 0.01;
f /= Math.sqrt(a[0] * a[0] + a[1] * a[1]) / 0.3; a[3] += Math.sin(f*0.1) * a[1];
if (f > 0.3) f = 0.3; a[4] += -Math.sin(f*0.1) * a[0];
let a3 = a[3], a4 = a[4];
a[3] = Math.sin(f) * a4 + Math.cos(f) * a3;
a[4] = -Math.sin(f) * a3 + Math.cos(f) * a4;
let d = Math.sqrt(a[3] * a[3] + a[4] * a[4])
a[3] /= d / 2;
a[4] /= d / 2;
} }
}, 1000 / 60) }, 1000 / 60)

View file

@ -130,12 +130,14 @@ function renderThing() {
let sizes = (nGain + 1) / (nothingness + 1) * 1000000 / (cubePos.length + 30); let sizes = (nGain + 1) / (nothingness + 1) * 1000000 / (cubePos.length + 30);
sizes = Math.pow(sizes, 0.3); sizes = Math.pow(sizes, 0.3);
if (sizes > 10) sizes = 10; if (sizes > 10) sizes = 10;
if (sizes < 3) sizes = 3;
positions = MDN.createCubeData(sizes, sizes, sizes); positions = MDN.createCubeData(1,1,1);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW);
for (let cubie of cubePos) { for (let cubie of cubePos) {
let vp = MDN.rotateYMatrix(Math.log(nothingness + 1) * cubie[2] / 10); let vp = MDN.rotateYMatrix(Math.log(nothingness + 1) * cubie[2] / 10);
vp = MDN.multiplyMatrices(MDN.scaleMatrix(sizes,sizes,sizes), vp)
vp = MDN.multiplyMatrices(MDN.translateMatrix(cubie[0], cubie[1], cubie[2]), vp) vp = MDN.multiplyMatrices(MDN.translateMatrix(cubie[0], cubie[1], cubie[2]), vp)
gl.uniformMatrix4fv(vpBuffer, false, new Float32Array(vp)); gl.uniformMatrix4fv(vpBuffer, false, new Float32Array(vp));