add points option to test performance of particle systems

This commit is contained in:
Stewart Allen 2022-10-11 15:25:27 -04:00
commit 5c312bd0ee
3 changed files with 20 additions and 2 deletions

View file

@ -4,6 +4,7 @@
* `F` experiment with structuredClone(), SharedArrayBuffer, createImageBitmap()
* `F` test #private fields, array.at() for negative indices
* `F` option to hide platform when viewing from below
# Kiri:Moto
@ -107,6 +108,8 @@
* `F` gcode output option as zip for multiple or flip ops or tool change
* `F` maintain several part orientations + op chains in a single profile
* `P` use SharedArrayBuffer for position array in animation
* `P` routing should start with the smallest poly by area
* `P` refactor slicing engine to use common core in geo
* `P` port slicing to common core & refactor accordingly
* `P` decrease cutting speed when entire tool is engaged (start of roughing)

View file

@ -12,6 +12,7 @@ Full docs @ https://docs.grid.space/projects/kiri-moto
* fix CAM invalidation of tabs on scale and traces on scale or rotate
* fix belt fan override for base extrusions touching belt
# Release 3.5 (2022-10-07)
## Kiri:moto

View file

@ -9,6 +9,7 @@ const { kiri } = root;
const { driver } = kiri;
const { CAM } = driver;
const asLines = false;
const asPoints = false;
let meshes = {},
unitScale = 1,
@ -100,9 +101,19 @@ kiri.load(() => {
function meshAdd(id, ind, pos) {
const geo = new THREE.BufferGeometry();
geo.setAttribute('position', new THREE.BufferAttribute(pos, 3));
geo.setIndex(new THREE.BufferAttribute(new Uint32Array(ind), 1));
if (ind.length) {
geo.setIndex(new THREE.BufferAttribute(new Uint32Array(ind), 1));
}
let mesh;
if (asLines) {
if (asPoints) {
const mat = new THREE.PointsMaterial({
transparent: true,
opacity: 0.75,
color: 0x888888,
size: 0.3
});
mesh = new THREE.Points(geo, mat);
} else if (asLines) {
const mat = new THREE.LineBasicMaterial({
transparent: true,
opacity: 0.75,
@ -338,6 +349,9 @@ kiri.load(() => {
let px = pos[ai++] = x * step - ox + step / 2;
let py = pos[ai++] = y * step - oy + step / 2;
pos[ai++] = size.z;
if (asPoints) {
continue;
}
if (asLines) {
if (y > 0) ind.appendAll([
(stepsY * x) + (y - 1),