Commit: 091cf3c886540210fb520c0ea987e3c2c92d7462
Parent: 0171f2ba6acb39c216654b82bbdf08fa04e4200e
Author: Randy Palamar
Date: Thu, 14 Nov 2024 20:11:06 -0700
add F# to ui and shader parameters
It belongs in the shader parameters since it actually effects the
output data. Also there was an empty padding available anyways.
Diffstat:
4 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/beamformer_parameters.h b/beamformer_parameters.h
@@ -35,7 +35,7 @@ typedef struct {
f32 time_offset; /* pulse length correction time [s] */
f32 off_axis_pos; /* [m] Position on screen normal to beamform in 2D HERCULES */
i32 beamform_plane; /* Plane to Beamform in 2D HERCULES */
- f32 _pad[1];
+ f32 f_number; /* F# (set to 0 to disable) */
} BeamformerParameters;
/* NOTE: garbage to get the prepocessor to properly stringize the value of a macro */
@@ -65,4 +65,5 @@ layout(std140, binding = 0) uniform parameters {\n\
float time_offset; /* pulse length correction time [s] */\n\
float off_axis_pos; /* [m] Position on screen normal to beamform in 2D HERCULES */\n\
int beamform_plane; /* Plane to Beamform in 2D HERCULES */\n\
+ float f_number; /* F# (set to 0 to disable) */\n\
};\n\n"
diff --git a/shaders/hercules.glsl b/shaders/hercules.glsl
@@ -85,8 +85,7 @@ void main()
* \ |z_e - z_i|/
*
* where x,z_e are transducer element positions and x,z_i are image positions. */
- float f_num = 0.5;
- float apod_arg = f_num * 0.5 * radians(360) / abs(image_point.z);
+ float apod_arg = f_number * 0.5 * radians(360) / abs(image_point.z);
vec2 sum = vec2(0);
vec3 rdist = image_point;
diff --git a/shaders/uforces.glsl b/shaders/uforces.glsl
@@ -81,8 +81,7 @@ void main()
* \ |z_e - z_i|/
*
* where x,z_e are transducer element positions and x,z_i are image positions. */
- float f_num = 0.5;
- float apod_arg = f_num * 0.5 * radians(360) / abs(image_point.z);
+ float apod_arg = f_number * 0.5 * radians(360) / abs(image_point.z);
vec2 sum = vec2(0);
/* NOTE: skip over channels corresponding to other arrays */
diff --git a/ui.c b/ui.c
@@ -308,7 +308,7 @@ draw_settings_ui(BeamformerCtx *ctx, Arena arena, Rect r, v2 mouse)
draw_r = do_value_listing(s8("Sampling Frequency:"), s8("[MHz]"),
bp->sampling_frequency * 1e-6, ui->font, arena, draw_r);
- static f32 hover_t[14];
+ static f32 hover_t[15];
i32 idx = 0;
Variable var;
@@ -376,7 +376,6 @@ draw_settings_ui(BeamformerCtx *ctx, Arena arena, Rect r, v2 mouse)
draw_r = do_text_input_listing(s8("Off Axis Position:"), s8("[mm]"), var, ctx, arena,
draw_r, mouse, hover_t + idx++);
-
var = (Variable){0};
var.store = &bp->beamform_plane;
var.type = VT_B32;
@@ -384,6 +383,15 @@ draw_settings_ui(BeamformerCtx *ctx, Arena arena, Rect r, v2 mouse)
draw_r = do_text_toggle_listing(s8("Beamform Plane:"), s8("XZ"), s8("YZ"), var, ui,
draw_r, mouse, hover_t + idx++);
+ var.store = &bp->f_number;
+ var.type = VT_F32;
+ var.f32_limits = (v2){.y = 1e3};
+ var.flags = V_CAUSES_COMPUTE;
+ var.display_scale = 1;
+ var.scroll_scale = 0.1;
+ draw_r = do_text_input_listing(s8("F#:"), s8(""), var, ctx, arena,
+ draw_r, mouse, hover_t + idx++);
+
var.store = &ctx->fsctx.db;
var.type = VT_F32;
var.f32_limits = (v2){.x = -120};