Tune hand-tip and palm chip layout coordinates
Adjust HandTipMatrix / HandPalmChip center, angle, and size in render.rs and propagate the spacing tweak through shader.wgsl.
This commit is contained in:
@@ -44,43 +44,43 @@ pub struct HandGatewayMode {
|
||||
|
||||
const HAND_TIP_MATRICES: [HandTipMatrix; 5] = [
|
||||
HandTipMatrix {
|
||||
center_px: [260.0, 490.0],
|
||||
center_px: [265.0, 495.0],
|
||||
size_px: [70.0, 120.0],
|
||||
angle_rad: -0.45,
|
||||
angle_rad: -0.40,
|
||||
},
|
||||
HandTipMatrix {
|
||||
center_px: [360.0, 255.0],
|
||||
center_px: [359.0, 260.0],
|
||||
size_px: [70.0, 120.0],
|
||||
angle_rad: -0.05,
|
||||
angle_rad: -0.17,
|
||||
},
|
||||
HandTipMatrix {
|
||||
center_px: [485.0, 225.0],
|
||||
center_px: [482.0, 228.0],
|
||||
size_px: [70.0, 120.0],
|
||||
angle_rad: 0.0,
|
||||
angle_rad: -0.03,
|
||||
},
|
||||
HandTipMatrix {
|
||||
center_px: [595.0, 260.0],
|
||||
center_px: [596.0, 265.0],
|
||||
size_px: [70.0, 120.0],
|
||||
angle_rad: 0.12,
|
||||
angle_rad: 0.10,
|
||||
},
|
||||
HandTipMatrix {
|
||||
center_px: [705.0, 385.0],
|
||||
center_px: [693.0, 370.0],
|
||||
size_px: [70.0, 120.0],
|
||||
angle_rad: 0.28,
|
||||
angle_rad: 0.22,
|
||||
},
|
||||
];
|
||||
|
||||
const HAND_PALM_CHIPS: [HandPalmChip; 2] = [
|
||||
HandPalmChip {
|
||||
center_px: [538.0, 608.0],
|
||||
size_px: [248.0, 82.0],
|
||||
angle_rad: 0.06,
|
||||
center_px: [530.0, 593.0],
|
||||
size_px: [224.0, 68.0],
|
||||
angle_rad: 0.12,
|
||||
rows: 5,
|
||||
cols: 14,
|
||||
},
|
||||
HandPalmChip {
|
||||
center_px: [606.0, 780.0],
|
||||
size_px: [72.0, 214.0],
|
||||
center_px: [610.0, 778.0],
|
||||
size_px: [60.0, 190.0],
|
||||
angle_rad: 0.05,
|
||||
rows: 11,
|
||||
cols: 4,
|
||||
@@ -90,6 +90,7 @@ const HAND_PALM_CHIPS: [HandPalmChip; 2] = [
|
||||
const HAND_FINGER_SENSOR_CELLS: usize = 12 * 7;
|
||||
const HAND_PALM_HORIZONTAL_OFFSET: usize = HAND_FINGER_SENSOR_CELLS * 5;
|
||||
const HAND_PALM_VERTICAL_OFFSET: usize = HAND_PALM_HORIZONTAL_OFFSET + 5 * 14;
|
||||
const HAND_TIP_DOT_LOCAL_Y_OFFSET_PX: f32 = 14.0;
|
||||
|
||||
// Each entry pins one miniature matrix to a fingertip in hand.png.
|
||||
// Coordinates are authored in source-image pixels so they are easy to tune by eye.
|
||||
@@ -1144,7 +1145,7 @@ fn build_hand_membrane_instances(image_width: f32, image_height: f32) -> Vec<Gly
|
||||
.map(|tip| {
|
||||
let uv_x = tip.center_px[0] / image_width.max(1.0);
|
||||
let uv_y = tip.center_px[1] / image_height.max(1.0);
|
||||
let membrane_size = [tip.size_px[0] * 1.62, tip.size_px[1] * 1.56];
|
||||
let membrane_size = [tip.size_px[0] * 1.44, tip.size_px[1] * 1.36];
|
||||
|
||||
GlyphInstance {
|
||||
// Membrane shaders read xy as hand.png UV.
|
||||
@@ -1202,7 +1203,9 @@ 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.
|
||||
let x = tip.center_px[0] + local_x * cos - local_y * sin;
|
||||
|
||||
Reference in New Issue
Block a user