proof of bevy egui color picker in UI. needs to and from bevy color, stuffed in a resource, to transmit between systems

This commit is contained in:
adia redmoon 2024-04-13 14:15:53 -07:00
parent ec020a03b5
commit 50749acacb
2 changed files with 9 additions and 10 deletions

View File

@ -7,7 +7,10 @@ use bevy::{
transform::components::GlobalTransform,
window::Window,
};
use bevy_egui::{egui, EguiContexts, EguiPlugin};
use bevy_egui::{
egui::{self, color_picker, Color32},
EguiContexts, EguiPlugin,
};
use rand::Rng;
use crate::{
@ -86,13 +89,7 @@ pub fn edit_click_events(
if collision.is_some() {
let col = collision.unwrap();
let x = edit_octtree.remove_voxel(col.voxel_index_location);
if x == 0 {
dbg!(edit_octtree);
dbg!(col.voxel_index_location);
} else {
println!("Successfully culled {} voxels!", x);
}
edit_octtree.remove_voxel(col.voxel_index_location);
}
} else if let Some(_) = insert.filter(|input| input.pressed()) {
if collision.is_some() {
@ -114,6 +111,7 @@ pub fn edit_window_ui(
mut oct_assets: ResMut<Assets<OctTreeAsset>>,
mut pairs: ResMut<MeshingOctTreePairs>,
) {
let mut color: Color32 = Default::default();
egui::Window::new("VVEdit").show(contexts.ctx_mut(), |ui| {
let mut label = String::from("Pre-Alpha");
use std::fmt::Write;
@ -122,6 +120,7 @@ pub fn edit_window_ui(
writeln!(label, "R+click removes a voxel:").ok();
writeln!(label, "E+click paints (edits) a voxel:").ok();
color_picker::color_picker_color32(ui, &mut color, color_picker::Alpha::Opaque);
ui.label(label);
if ui.button("Add Origin Voxel").clicked() {
//

View File

@ -2,8 +2,7 @@
use std::mem::swap;
use bevy::math::{vec3, Vec3};
use rand::Rng;
use bevy::math::Vec3;
use crate::vvlib::intersections::aa_bounds_contains;
@ -627,6 +626,7 @@ pub fn test_path() {
}
#[test]
pub fn fuzztestpath() {
use rand::Rng;
let origin = Vec3::ZERO;
let mut test_oct = OctTree::<i32>::new(origin, 1);
let range = 10000.;