mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 18:22:25 +00:00
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:
1 parent
b1c5aa11b7
commit
ce3d292198
6 files changed
+36
-14
No files matched your search
@@ -502,7 +502,8 @@ export function createIssArticulation() {
|
||||
/** Whether the last update had the station in sunlight; null before one. */
|
||||
let lastSunlit = null;
|
||||
/** Command panel state: the arm is being posed by hand, so the sway is off. */
|
||||
let armManual = false;
|
||||
/** The arm joints posed by hand (command panel); the rest keep swaying. */
|
||||
const manualJoints = new Set();
|
||||
let armNodes = null;
|
||||
/** Command panel state: how far the arrays are rolled out, 0.05 to 1. */
|
||||
let deploy = 1;
|
||||
@@ -697,10 +698,10 @@ export function createIssArticulation() {
|
||||
dishes = nextDishes;
|
||||
|
||||
// Arm: an illustrative sway (see ISS_ARM_JOINTS).
|
||||
if (!armManual) {
|
||||
{
|
||||
const arm = issArmAngles(nowMs / 1000, ISS_SWAY_JOINTS);
|
||||
ISS_SWAY_JOINTS.forEach((joint, i) => {
|
||||
if (!joint.sway) return;
|
||||
if (!joint.sway || manualJoints.has(joint.node)) return;
|
||||
const node = (armNodes ??= ISS_SWAY_JOINTS.map(
|
||||
(entry) => model.getNode(entry.node) ?? null,
|
||||
))[i];
|
||||
@@ -723,7 +724,7 @@ export function createIssArticulation() {
|
||||
* @param {number} angle Radians.
|
||||
*/
|
||||
function setJoint(name, pivot, axis, angle) {
|
||||
armManual = true;
|
||||
manualJoints.add(name);
|
||||
const node = boundModel?.getNode(name);
|
||||
if (node) node.matrix = issAxisMatrix(pivot, axis, angle, scratchMatrix);
|
||||
}
|
||||
@@ -739,7 +740,7 @@ export function createIssArticulation() {
|
||||
override = null;
|
||||
dishOverride = null;
|
||||
telemetryAllowed = true;
|
||||
armManual = false;
|
||||
manualJoints.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -802,7 +803,7 @@ export function createIssArticulation() {
|
||||
|
||||
/** Command panel: hand the arm back to its sway. */
|
||||
function resumeArm() {
|
||||
armManual = false;
|
||||
manualJoints.clear();
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -214,7 +214,7 @@ export function createRendering({
|
||||
|
||||
function _setOrbitPathShown(noradId, show) {
|
||||
const path = layerState._orbitPaths.get(noradId);
|
||||
if (!path) return;
|
||||
if (!path || path.item.show === show) return;
|
||||
path.item.show = show;
|
||||
sets?.rings.upsert([path.item]);
|
||||
}
|
||||
|
||||
@@ -633,7 +633,6 @@ export function createStationModel(
|
||||
if (
|
||||
!loading &&
|
||||
!failed &&
|
||||
resolveAsset &&
|
||||
dotPosition &&
|
||||
cameraDistance <= spec.maxDistanceM * 1.5
|
||||
)
|
||||
@@ -657,7 +656,10 @@ export function createStationModel(
|
||||
|
||||
const frame = _stationFrame(scratchPosition);
|
||||
if (!frame) {
|
||||
// Nowhere to draw the model (the orbit would not propagate): the dots
|
||||
// draw at every distance rather than nothing at all.
|
||||
_hide();
|
||||
_releaseDots();
|
||||
return;
|
||||
}
|
||||
const { date, axes } = frame;
|
||||
|
||||
@@ -393,9 +393,17 @@ export function createTracking({ state: layerState, services, parts, source }) {
|
||||
// republished every frame.
|
||||
const clearPx =
|
||||
modelFor(parts, layerState._trackedNorad)?._cardClearPx?.() ?? null;
|
||||
// The overlay's gap is twice the anchor radius, so half the clearance.
|
||||
const anchorRadiusPx = clearPx ? Math.round(clearPx / 8) * 4 : null;
|
||||
const current = readEntityRecord(layerState._trackedEntity)?.labelModel;
|
||||
// The overlay's gap is twice the anchor radius, so half the clearance,
|
||||
// in 4 px steps. The step kept stands until the clearance has moved a
|
||||
// pixel past the step's edge: at an edge, sub-pixel jitter in the range
|
||||
// would otherwise flip it, and republish the card, every frame.
|
||||
const kept = current?.anchorRadiusPx ?? null;
|
||||
const anchorRadiusPx = !clearPx
|
||||
? null
|
||||
: kept !== null && Math.abs(clearPx / 2 - kept) < 3
|
||||
? kept
|
||||
: Math.round(clearPx / 8) * 4;
|
||||
// Compare the WHOLE detail array: comparing only `details[0]` swallowed any
|
||||
// change confined to the companions line, so the card would never republish.
|
||||
const unchanged =
|
||||
|
||||
Reference in new issue
Block a user