Review of the PR's own code: joints, rings, node posing, card clearance

- A hand-set Canadarm2 joint no longer stops Dextre's and the Japanese arm's
  sway: only the joints set by hand hold still.
- A ring already shown or hidden is not sent to the renderer again (the
  close-up asked for it every frame).
- Node posing: the matrix handed to a node goes through one scratch (the
  node copies it), and a name the model lacks is looked up once.
- The tracked card's clearance step holds until the clearance has left it,
  so jitter at a step's edge no longer republishes the card every frame.
- A frame the station cannot be placed in gives its dots back rather than
  drawing neither model nor dot.
This commit is contained in:
Denis Groshev committed 2026-11-16 20:42:08 +01:00
1 parent b1c5aa11b7
commit ce3d292198
6 files changed
+36 -14

No files matched your search

+13 -3
View File
@@ -60,6 +60,9 @@ export const RECEDE_WRITE_EPSILON = 0.005;
* written, so an update that keeps a node's matrix writes nothing.
*/
const posedNodes = new WeakMap();
/** A posed name the model has no node for: looked up once, then skipped. */
const NO_NODE = Symbol('no such node');
const scratchNodeMatrix = new Cesium.Matrix4();
/**
* Write the item's node transforms to `model` once it is ready: changed
@@ -75,18 +78,25 @@ function poseNodes(item, model) {
for (const [name, last] of posed) {
if (wanted && Object.hasOwn(wanted, name)) continue;
posed.delete(name);
if (last === NO_NODE) continue;
const node = model.getNode(name);
if (node && last) node.matrix = Cesium.Matrix4.clone(node.originalMatrix);
if (node) node.matrix = Cesium.Matrix4.clone(node.originalMatrix);
}
if (!wanted) return;
for (const name of Object.keys(wanted)) {
const matrix = wanted[name];
if (!matrix || matrix.length < 16) continue;
const last = posed.get(name);
if (last === NO_NODE) continue;
if (last && sameMatrix(last, matrix)) continue;
const node = model.getNode(name);
posed.set(name, node ? Array.from(matrix).slice(0, 16) : null);
if (node) node.matrix = Cesium.Matrix4.fromArray(matrix);
if (!node) {
posed.set(name, NO_NODE);
continue;
}
posed.set(name, Array.from(matrix).slice(0, 16));
// The node copies the matrix it is given.
node.matrix = Cesium.Matrix4.fromArray(matrix, 0, scratchNodeMatrix);
}
}