Integrate hand fingertip force overlays

This commit is contained in:
lenn
2026-07-07 09:43:25 +08:00
parent c4bccc1747
commit a04b903e96
11 changed files with 409 additions and 164 deletions

View File

@@ -73,14 +73,14 @@ const HAND_TIP_MATRICES: [HandTipMatrix; 5] = [
const HAND_PALM_CHIPS: [HandPalmChip; 2] = [
HandPalmChip {
center_px: [530.0, 593.0],
size_px: [224.0, 68.0],
size_px: [258.0, 88.0],
angle_rad: 0.12,
rows: 5,
cols: 14,
},
HandPalmChip {
center_px: [610.0, 778.0],
size_px: [60.0, 190.0],
size_px: [82.0, 228.0],
angle_rad: 0.05,
rows: 11,
cols: 4,
@@ -1203,8 +1203,7 @@ fn build_hand_dot_instances(
// Lay out a rows x cols matrix in fingertip-local pixel space.
let local_x = (col as f32 - cols as f32 / 2.0 + 0.5) / cols as f32 * tip.size_px[0];
let local_y = (row as f32 - rows as f32 / 2.0 + 0.5) / rows as f32
* tip.size_px[1]
let local_y = (row as f32 - rows as f32 / 2.0 + 0.5) / rows as f32 * tip.size_px[1]
+ HAND_TIP_DOT_LOCAL_Y_OFFSET_PX;
// Rotate the local matrix so it follows the direction of the finger.
@@ -1241,8 +1240,8 @@ fn build_hand_palm_dot_instances(
for (chip_index, chip) in HAND_PALM_CHIPS.into_iter().enumerate() {
let cos = chip.angle_rad.cos();
let sin = chip.angle_rad.sin();
// Leave a bevel around the chip so the matrix reads as embedded pixels.
let active_size = [chip.size_px[0] * 0.72, chip.size_px[1] * 0.76];
// Palm films can float slightly beyond the hand artwork, similar to fingertip membranes.
let active_size = [chip.size_px[0] * 0.86, chip.size_px[1] * 0.86];
for row in 0..chip.rows {
for col in 0..chip.cols {
@@ -1278,13 +1277,7 @@ fn build_hand_palm_dot_instances(
instances
}
fn hand_palm_pressure_index(
chip_index: usize,
row: u32,
col: u32,
rows: u32,
cols: u32,
) -> usize {
fn hand_palm_pressure_index(chip_index: usize, row: u32, col: u32, rows: u32, cols: u32) -> usize {
if chip_index == 0 {
(col * rows + (rows - 1 - row)) as usize
} else {