Ray-caster: remove hard-coded test construction

This commit is contained in:
Aaron Fenyes 2024-08-26 13:51:01 -07:00
parent cbec31f5df
commit bf140efaf7
2 changed files with 11 additions and 33 deletions

View file

@ -97,7 +97,7 @@ fn main() {
let opacity = create_signal(0.5);
let highlight = create_signal(0.2);
let layer_threshold = create_signal(0.0);
let use_test_construction = create_signal(false);
let debug_mode = create_signal(false);
// display
let display = create_node_ref();
@ -186,7 +186,7 @@ fn main() {
let opacity_loc = ctx.get_uniform_location(&program, "opacity");
let highlight_loc = ctx.get_uniform_location(&program, "highlight");
let layer_threshold_loc = ctx.get_uniform_location(&program, "layer_threshold");
let use_test_construction_loc = ctx.get_uniform_location(&program, "use_test_construction");
let debug_mode_loc = ctx.get_uniform_location(&program, "debug_mode");
// create a vertex array and bind it to the graphics context
let vertex_array = ctx.create_vertex_array().unwrap();
@ -244,7 +244,7 @@ fn main() {
ctx.uniform1f(opacity_loc.as_ref(), opacity.get() as f32);
ctx.uniform1f(highlight_loc.as_ref(), highlight.get() as f32);
ctx.uniform1i(layer_threshold_loc.as_ref(), layer_threshold.get() as i32);
ctx.uniform1i(use_test_construction_loc.as_ref(), use_test_construction.get() as i32);
ctx.uniform1i(debug_mode_loc.as_ref(), debug_mode.get() as i32);
// draw the scene
ctx.draw_arrays(WebGl2RenderingContext::TRIANGLES, 0, VERTEX_CNT as i32);
@ -329,11 +329,11 @@ fn main() {
)
}
div(class="control") {
label(for="use-test-construction") { "Use test values" }
label(for="debug-mode") { "Debug mode" }
input(
type="checkbox",
id="use-test-construction",
bind:checked=use_test_construction
id="debug-mode",
bind:checked=debug_mode
)
}
}