feat: 添加 README,更新 .gitignore,移除 JE-Skin/eskin-finger-sdk
- 添加 README.md 项目文档 - 更新 .gitignore 排除 JE-Skin/、eskin-finger-sdk/ 及构建产物 - 从 git 跟踪中移除 JE-Skin 和 eskin-finger-sdk Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -8,11 +8,12 @@ use crate::matrix::{MatrixLayout, build_view_projection, glyph_world_position};
|
||||
|
||||
pub const PRESSURE_CELL_COUNT: usize =
|
||||
(crate::matrix::MATRIX_ROWS * crate::matrix::MATRIX_COLS) as usize;
|
||||
pub type PressureFrame = [[f32; 2]; PRESSURE_CELL_COUNT];
|
||||
|
||||
pub struct WgpuBackgroundCallback {
|
||||
pub width: f32,
|
||||
pub height: f32,
|
||||
pub pressure: [f32; PRESSURE_CELL_COUNT],
|
||||
pub pressure: PressureFrame,
|
||||
}
|
||||
|
||||
impl egui_wgpu::CallbackTrait for WgpuBackgroundCallback {
|
||||
@@ -126,7 +127,8 @@ impl BackgroundRenderResources {
|
||||
usage: wgpu::BufferUsages::VERTEX,
|
||||
});
|
||||
|
||||
let glyph_instances = build_glyph_instances(rows, cols, &layout, &[]);
|
||||
let glyph_instances =
|
||||
build_glyph_instances(rows, cols, &layout, &[[0.0, 0.0]; PRESSURE_CELL_COUNT]);
|
||||
let glyph_instance_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
label: Some("Pressure Glyph Instance Buffer"),
|
||||
contents: bytemuck::cast_slice(&glyph_instances),
|
||||
@@ -148,7 +150,7 @@ impl BackgroundRenderResources {
|
||||
}
|
||||
}
|
||||
|
||||
fn prepare(&mut self, queue: &wgpu::Queue, width: f32, height: f32, pressure: &[f32]) {
|
||||
fn prepare(&mut self, queue: &wgpu::Queue, width: f32, height: f32, pressure: &PressureFrame) {
|
||||
let aspect = width / height.max(1.0);
|
||||
self.uniform =
|
||||
MatrixUniform::new(width, height, build_view_projection(aspect, &self.layout));
|
||||
@@ -255,19 +257,19 @@ fn build_glyph_instances(
|
||||
rows: u32,
|
||||
cols: u32,
|
||||
layout: &MatrixLayout,
|
||||
pressure: &[f32],
|
||||
pressure: &PressureFrame,
|
||||
) -> Vec<GlyphInstance> {
|
||||
let mut instances = Vec::with_capacity((rows * cols) as usize);
|
||||
|
||||
for row in 0..rows {
|
||||
for col in 0..cols {
|
||||
let index = (row * cols + col) as usize;
|
||||
let normalized = pressure.get(index).copied().unwrap_or(0.0);
|
||||
let [normalized, display_value] = pressure.get(index).copied().unwrap_or([0.0, 0.0]);
|
||||
let (world_position, normalized) =
|
||||
glyph_world_position(row, col, rows, cols, layout, normalized);
|
||||
instances.push(GlyphInstance {
|
||||
world_position,
|
||||
style: [normalized, 0.0, 0.0, 0.0],
|
||||
style: [normalized, display_value, 0.0, 0.0],
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -280,17 +282,17 @@ fn update_glyph_instances(
|
||||
rows: u32,
|
||||
cols: u32,
|
||||
layout: &MatrixLayout,
|
||||
pressure: &[f32],
|
||||
pressure: &PressureFrame,
|
||||
) {
|
||||
for row in 0..rows {
|
||||
for col in 0..cols {
|
||||
let index = (row * cols + col) as usize;
|
||||
let normalized = pressure.get(index).copied().unwrap_or(0.0);
|
||||
let [normalized, display_value] = pressure.get(index).copied().unwrap_or([0.0, 0.0]);
|
||||
let (world_position, normalized) =
|
||||
glyph_world_position(row, col, rows, cols, layout, normalized);
|
||||
if let Some(instance) = instances.get_mut(index) {
|
||||
instance.world_position = world_position;
|
||||
instance.style = [normalized, 0.0, 0.0, 0.0];
|
||||
instance.style = [normalized, display_value, 0.0, 0.0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user