This commit is contained in:
1 parent
2fa64106c8
commit
2054fa2558
21 files changed
+711
-159
No files matched your search
@@ -2415,78 +2415,87 @@ fn light_editor_ui(world: &mut World, ui: &mut egui::Ui, entity: Entity) {
|
||||
}
|
||||
});
|
||||
});
|
||||
let mut color = [light.color.r, light.color.g, light.color.b, light.color.a];
|
||||
property_row(ui, "Color", |ui| {
|
||||
if ui.color_edit_button_rgba_unmultiplied(&mut color).changed() {
|
||||
light.color = ColorDesc {
|
||||
r: color[0],
|
||||
g: color[1],
|
||||
b: color[2],
|
||||
a: color[3],
|
||||
};
|
||||
changed = true;
|
||||
let solari_disabled = solari_disables_local_light(world, &light);
|
||||
if solari_disabled {
|
||||
ui.colored_label(
|
||||
egui::Color32::from_rgb(255, 180, 100),
|
||||
"Point and spot lights are disabled while Solari is active. Use a directional light or emissive material, or switch GI to Forward.",
|
||||
);
|
||||
}
|
||||
ui.add_enabled_ui(!solari_disabled, |ui| {
|
||||
let mut color = [light.color.r, light.color.g, light.color.b, light.color.a];
|
||||
property_row(ui, "Color", |ui| {
|
||||
if ui.color_edit_button_rgba_unmultiplied(&mut color).changed() {
|
||||
light.color = ColorDesc {
|
||||
r: color[0],
|
||||
g: color[1],
|
||||
b: color[2],
|
||||
a: color[3],
|
||||
};
|
||||
changed = true;
|
||||
}
|
||||
});
|
||||
let intensity_label = match light.kind {
|
||||
AuthoringLightKind::Directional => "Intensity (lux)",
|
||||
_ => "Intensity (lumens)",
|
||||
};
|
||||
let intensity_max = match light.kind {
|
||||
AuthoringLightKind::Directional => AUTHORING_DIRECTIONAL_LUX_MAX,
|
||||
_ => AUTHORING_POINT_SPOT_LUMENS_MAX,
|
||||
};
|
||||
property_row(ui, intensity_label, |ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
if ui
|
||||
.add(
|
||||
egui::Slider::new(&mut light.intensity, 0.0..=intensity_max)
|
||||
.show_value(false),
|
||||
)
|
||||
.changed()
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
if ui
|
||||
.add_sized(
|
||||
[fit_width(ui, 72.0, 120.0), 20.0],
|
||||
egui::DragValue::new(&mut light.intensity)
|
||||
.range(0.0..=intensity_max)
|
||||
.speed(intensity_max * 0.001),
|
||||
)
|
||||
.changed()
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
if matches!(
|
||||
light.kind,
|
||||
AuthoringLightKind::Point | AuthoringLightKind::Spot
|
||||
) {
|
||||
property_row(ui, "Range (m)", |ui| {
|
||||
changed |= ui
|
||||
.add(egui::Slider::new(&mut light.range, 0.0..=100.0))
|
||||
.changed();
|
||||
});
|
||||
}
|
||||
if matches!(light.kind, AuthoringLightKind::Spot) {
|
||||
property_row(ui, "Inner angle", |ui| {
|
||||
changed |= ui
|
||||
.add(egui::Slider::new(&mut light.inner_angle_deg, 1.0..=80.0))
|
||||
.changed();
|
||||
});
|
||||
property_row(ui, "Outer angle", |ui| {
|
||||
changed |= ui
|
||||
.add(egui::Slider::new(&mut light.outer_angle_deg, 1.0..=90.0))
|
||||
.changed();
|
||||
});
|
||||
}
|
||||
property_row(ui, "Shadows", |ui| {
|
||||
changed |= ui.checkbox(&mut light.shadows, "Cast shadows").changed();
|
||||
});
|
||||
if matches!(light.kind, AuthoringLightKind::Directional) {
|
||||
ui.small("Controls project sun while this directional exists.");
|
||||
}
|
||||
});
|
||||
let intensity_label = match light.kind {
|
||||
AuthoringLightKind::Directional => "Intensity (lux)",
|
||||
_ => "Intensity (lumens)",
|
||||
};
|
||||
let intensity_max = match light.kind {
|
||||
AuthoringLightKind::Directional => AUTHORING_DIRECTIONAL_LUX_MAX,
|
||||
_ => AUTHORING_POINT_SPOT_LUMENS_MAX,
|
||||
};
|
||||
property_row(ui, intensity_label, |ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
if ui
|
||||
.add(
|
||||
egui::Slider::new(&mut light.intensity, 0.0..=intensity_max)
|
||||
.show_value(false),
|
||||
)
|
||||
.changed()
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
if ui
|
||||
.add_sized(
|
||||
[fit_width(ui, 72.0, 120.0), 20.0],
|
||||
egui::DragValue::new(&mut light.intensity)
|
||||
.range(0.0..=intensity_max)
|
||||
.speed(intensity_max * 0.001),
|
||||
)
|
||||
.changed()
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
if matches!(
|
||||
light.kind,
|
||||
AuthoringLightKind::Point | AuthoringLightKind::Spot
|
||||
) {
|
||||
property_row(ui, "Range (m)", |ui| {
|
||||
changed |= ui
|
||||
.add(egui::Slider::new(&mut light.range, 0.0..=100.0))
|
||||
.changed();
|
||||
});
|
||||
}
|
||||
if matches!(light.kind, AuthoringLightKind::Spot) {
|
||||
property_row(ui, "Inner angle", |ui| {
|
||||
changed |= ui
|
||||
.add(egui::Slider::new(&mut light.inner_angle_deg, 1.0..=80.0))
|
||||
.changed();
|
||||
});
|
||||
property_row(ui, "Outer angle", |ui| {
|
||||
changed |= ui
|
||||
.add(egui::Slider::new(&mut light.outer_angle_deg, 1.0..=90.0))
|
||||
.changed();
|
||||
});
|
||||
}
|
||||
property_row(ui, "Shadows", |ui| {
|
||||
changed |= ui.checkbox(&mut light.shadows, "Cast shadows").changed();
|
||||
});
|
||||
if matches!(light.kind, AuthoringLightKind::Directional) {
|
||||
ui.small("Controls project sun while this directional exists.");
|
||||
}
|
||||
});
|
||||
apply_component_card_response(world, entity, card_response);
|
||||
if changed {
|
||||
@@ -2494,6 +2503,18 @@ fn light_editor_ui(world: &mut World, ui: &mut egui::Ui, entity: Entity) {
|
||||
}
|
||||
}
|
||||
|
||||
fn solari_disables_local_light(world: &World, light: &LightDesc) -> bool {
|
||||
matches!(
|
||||
light.kind,
|
||||
AuthoringLightKind::Point | AuthoringLightKind::Spot
|
||||
) && world
|
||||
.get_resource::<settings::ActiveCameraRenderProfile>()
|
||||
.is_some_and(|profile| profile.gi_path == settings::GiPath::SolariDeferred)
|
||||
&& world
|
||||
.get_resource::<settings::RenderingCapabilities>()
|
||||
.is_some_and(|caps| caps.rt_supported)
|
||||
}
|
||||
|
||||
fn rigid_body_editor_ui(world: &mut World, ui: &mut egui::Ui, entity: Entity) {
|
||||
let Some(mut body) = world.get::<RigidBodyDesc>(entity).copied() else {
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user