From 5c312bd0eec16c1a80bc5d52a1a5fa7ebab5af8b Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Tue, 11 Oct 2022 15:25:27 -0400 Subject: [PATCH] add points option to test performance of particle systems --- notes.md | 3 +++ release.md | 1 + src/kiri-mode/cam/animate.js | 18 ++++++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/notes.md b/notes.md index c60dabbd..c6903700 100644 --- a/notes.md +++ b/notes.md @@ -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) diff --git a/release.md b/release.md index 0fc91469..8716a98f 100644 --- a/release.md +++ b/release.md @@ -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 diff --git a/src/kiri-mode/cam/animate.js b/src/kiri-mode/cam/animate.js index 53716da8..9d513931 100644 --- a/src/kiri-mode/cam/animate.js +++ b/src/kiri-mode/cam/animate.js @@ -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),