a = {
let ticks = 0;
let indexes;
let indexedVector;
let y;
while (true) {
ticks++;
for (let i = 0; i < particleCount; i++) {
if (particles.geometry.attributes.position.array[i * 3] > size0 * columns)
particles.geometry.attributes.position.array[i * 3] =
random(0, 1) * size0 * columns;
if (
particles.geometry.attributes.position.array[i * 3 + 1] >
size0 * rows
)
particles.geometry.attributes.position.array[i * 3 + 1] =
random(0, 1) * size0 * rows;
if (
particles.geometry.attributes.position.array[i * 3 + 2] >
size0 * depths
)
particles.geometry.attributes.position.array[i * 3 + 2] =
random(0, 1) * size0 * depths;
if (particles.geometry.attributes.position.array[i * 3] < 0)
particles.geometry.attributes.position.array[i * 3] =
random(0, 1) * size0 * columns;
if (particles.geometry.attributes.position.array[i * 3 + 1] < 0)
particles.geometry.attributes.position.array[i * 3 + 1] =
random(0, 1) * size0 * rows;
if (particles.geometry.attributes.position.array[i * 3 + 2] < 0)
particles.geometry.attributes.position.array[i * 3 + 2] =
random(0, 1) * size0 * depths;
indexedVector =
flowfield[
Math.floor(
particles.geometry.attributes.position.array[i * 3] / size0
)
][
Math.floor(
particles.geometry.attributes.position.array[i * 3 + 1] / size0
)
][
Math.floor(
particles.geometry.attributes.position.array[i * 3 + 2] / size0
)
].addScalar(0.0000000000000000000000001);
particles.geometry.attributes.acceleration.array[i * 3] +=
indexedVector.x;
particles.geometry.attributes.acceleration.array[i * 3 + 1] +=
indexedVector.y;
particles.geometry.attributes.acceleration.array[i * 3 + 2] +=
indexedVector.z;
particles.geometry.attributes.velocity.array[i * 3] +=
particles.geometry.attributes.acceleration.array[i * 3];
particles.geometry.attributes.velocity.array[i * 3 + 1] +=
particles.geometry.attributes.acceleration.array[i * 3 + 1];
particles.geometry.attributes.velocity.array[i * 3 + 2] +=
particles.geometry.attributes.acceleration.array[i * 3 + 2];
particles.geometry.attributes.position.array[i * 3] +=
particles.geometry.attributes.velocity.array[i * 3];
particles.geometry.attributes.position.array[i * 3 + 1] +=
particles.geometry.attributes.velocity.array[i * 3 + 1];
particles.geometry.attributes.position.array[i * 3 + 2] +=
particles.geometry.attributes.velocity.array[i * 3 + 2];
particles.geometry.attributes.acceleration.array[i * 3] += 0;
particles.geometry.attributes.acceleration.array[i * 3 + 1] += 0;
particles.geometry.attributes.acceleration.array[i * 3 + 2] += 0;
}
// cube.rotation.z += 0.01;
// for (let i = 0; i < 3000; i++) {
// particles.geometry.attributes.position.array[i] += 0.001;
// }
particles.geometry.attributes.position.needsUpdate = true;
renderer.render(scene, camera);
yield Promises.tick(1000, 1);
}
}