From d354c0ec9d87fd35cc562b44b7f98d804b98d8ac Mon Sep 17 00:00:00 2001 From: shun suzuki Date: Mon, 26 Feb 2024 10:04:36 +0900 Subject: [PATCH] fix simulator for unity --- simulator/assets/shaders/pressure.comp | 6 +++--- simulator/src/field_compute_pipeline.rs | 2 +- simulator/src/simulator.rs | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/simulator/assets/shaders/pressure.comp b/simulator/assets/shaders/pressure.comp index 2891ebc..6ac8029 100644 --- a/simulator/assets/shaders/pressure.comp +++ b/simulator/assets/shaders/pressure.comp @@ -23,8 +23,8 @@ layout(push_constant) uniform Config { uint width; uint height; float pixel_size; - float scale; - uint _dummy_1; + uint _pad0; + uint _pad1; mat4 world; } config; @@ -47,7 +47,7 @@ void main() { vec3 tp = vec3(source_pos.pos[idx]); float r = length(point - tp); float p = source_drive.drive[idx].y - source_drive.drive[idx].w * r; - float amp = source_drive.drive[idx].z * source_drive.drive[idx].x / (4 * PI * r) * config.scale; + float amp = source_drive.drive[idx].z * source_drive.drive[idx].x / (4 * PI * r); re += amp * cos(p); im += amp * sin(p); } diff --git a/simulator/src/field_compute_pipeline.rs b/simulator/src/field_compute_pipeline.rs index 159fd7e..c73793c 100644 --- a/simulator/src/field_compute_pipeline.rs +++ b/simulator/src/field_compute_pipeline.rs @@ -9,8 +9,8 @@ pub struct Config { pub width: u32, pub height: u32, pub pixel_size: f32, - pub scale: f32, pub _pad0: u32, + pub _pad1: u32, pub model: [[f32; 4]; 4], } diff --git a/simulator/src/simulator.rs b/simulator/src/simulator.rs index 16245d3..4d0e451 100644 --- a/simulator/src/simulator.rs +++ b/simulator/src/simulator.rs @@ -15,7 +15,7 @@ use crate::{ update_flag::UpdateFlag, view::*, viewer_settings::ViewerSettings, - Quaternion, Vector3, MILLIMETER, + Quaternion, Vector3, }; use autd3_driver::{cpu::TxDatagram, defined::T4010A1_AMPLITUDE}; use autd3_firmware_emulator::{CPUEmulator, FPGAEmulator}; @@ -565,7 +565,6 @@ impl Simulator { / self.settings.slice_pixel_size) as _, pixel_size: self.settings.slice_pixel_size as _, - scale: MILLIMETER, model: slice_model.into(), ..Default::default() };