use inspector to edit mandelbulb settings

This commit is contained in:
TÁNCZOS Vilmos Zsombor 2025-06-01 00:12:28 +02:00
parent 42d3a39fe1
commit 5cd680e4ea
4 changed files with 62 additions and 1 deletions

55
Cargo.lock generated
View file

@ -434,6 +434,51 @@ dependencies = [
"bevy_internal",
]
[[package]]
name = "bevy-inspector-egui"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4971e763f289921fd4616418628458bec26a6fc13fe4299c0e4066f39d7ceaa2"
dependencies = [
"bevy-inspector-egui-derive",
"bevy_app",
"bevy_asset",
"bevy_color",
"bevy_core_pipeline",
"bevy_ecs",
"bevy_egui",
"bevy_image",
"bevy_log",
"bevy_math",
"bevy_pbr",
"bevy_platform",
"bevy_reflect",
"bevy_render",
"bevy_state",
"bevy_time",
"bevy_utils",
"bevy_window",
"bytemuck",
"disqualified",
"egui",
"fuzzy-matcher",
"image",
"smallvec",
"uuid",
"winit",
]
[[package]]
name = "bevy-inspector-egui-derive"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2656316165dbe2af6b3acaa763332f5dbdd12f809d59f5bf4304e0642a8005c9"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "bevy_a11y"
version = "0.16.0"
@ -1481,6 +1526,7 @@ name = "bevyart"
version = "0.1.0"
dependencies = [
"bevy",
"bevy-inspector-egui",
"bevy_egui",
"bevy_panorbit_camera",
]
@ -2518,6 +2564,15 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "fuzzy-matcher"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94"
dependencies = [
"thread_local",
]
[[package]]
name = "generic-array"
version = "0.14.7"

View file

@ -5,6 +5,7 @@ edition = "2024"
[dependencies]
bevy = { version = "0.16.0", features = ["shader_format_wesl"] }
bevy-inspector-egui = "0.31.0"
bevy_egui = "0.34.1"
bevy_panorbit_camera = { version = "0.26.0", features = ["bevy_egui"] }

View file

@ -1,5 +1,6 @@
use bevy::{color::palettes::css::RED, prelude::*, render::storage::ShaderStorageBuffer};
use bevy_egui::EguiPlugin;
use bevy_inspector_egui::quick::WorldInspectorPlugin;
use mandelbulb::{MandelbulbExtension, MandelbulbMaterial, MandelbulbStorage};
mod camera;
@ -12,6 +13,7 @@ fn main() {
EguiPlugin {
enable_multipass_for_primary_context: false,
},
WorldInspectorPlugin::new(),
))
.add_plugins((camera::plugin, mandelbulb::plugin))
.add_systems(Startup, setup)

View file

@ -6,6 +6,7 @@ use bevy::{
storage::ShaderStorageBuffer,
},
};
use bevy_inspector_egui::quick::ResourceInspectorPlugin;
pub type MandelbulbMaterial = ExtendedMaterial<StandardMaterial, MandelbulbExtension>;
@ -14,10 +15,12 @@ const SHADER_ASSET_PATH: &str = "shaders/mandelbulb.wgsl";
pub fn plugin(app: &mut App) {
app.add_plugins(MaterialPlugin::<MandelbulbMaterial>::default())
.init_resource::<MandelbulbSettings>()
.register_type::<MandelbulbSettings>()
.add_plugins(ResourceInspectorPlugin::<MandelbulbSettings>::new())
.add_systems(Update, update_volu_material);
}
#[derive(Resource)]
#[derive(Resource, Debug, Reflect)]
struct MandelbulbSettings {
power: f32,
iterations: i32,