This commit is contained in:
1 parent
2fa64106c8
commit
2054fa2558
21 files changed
+711
-159
No files matched your search
@@ -476,7 +476,7 @@ fn labeled_asset_path(path: &str, label: &str) -> String {
|
||||
}
|
||||
|
||||
fn studio_render_image() -> Image {
|
||||
Image::new_target_texture(THUMB_SIZE, THUMB_SIZE, TextureFormat::Rgba8UnormSrgb, None)
|
||||
Image::new_target_texture(THUMB_SIZE, THUMB_SIZE, TextureFormat::Rgba16Float, None)
|
||||
}
|
||||
|
||||
fn finish_active_thumbnail(
|
||||
|
||||
@@ -7,7 +7,7 @@ use bevy::scene::serde::SceneDeserializer;
|
||||
use bevy::scene::DynamicScene;
|
||||
use bevy::scene::DynamicSceneBuilder;
|
||||
use bevy::window::PrimaryWindow;
|
||||
use scene::{migrate_scene_text, stamp_schema_version, strip_schema_version, validate_level_text};
|
||||
use scene::{document::SceneDocument, strip_schema_version, validate_level_text};
|
||||
use serde::de::DeserializeSeed;
|
||||
use shared::{
|
||||
flush_level_object_hydration, infer_actor_kind, strip_hydrated_entity, validate_actor, ActorId,
|
||||
@@ -495,8 +495,8 @@ fn save_entities(world: &mut World, path: &Path, entities: Vec<Entity>) -> Resul
|
||||
std::fs::create_dir_all(parent)
|
||||
.map_err(|err| format!("could not create {}: {err}", parent.display()))?;
|
||||
}
|
||||
let stamped = stamp_schema_version(&ron)?;
|
||||
std::fs::write(path, stamped)
|
||||
let document = SceneDocument::from_ron_text(&ron)?;
|
||||
std::fs::write(path, document.to_ron_text()?)
|
||||
.map_err(|err| format!("could not write {}: {err}", path.display()))?;
|
||||
finalize_scene_load(world);
|
||||
|
||||
@@ -511,8 +511,8 @@ fn load_level(world: &mut World, path: &Path) -> Result<(), String> {
|
||||
let text = std::fs::read_to_string(path)
|
||||
.map_err(|err| format!("could not read {}: {err}", path.display()))?;
|
||||
validate_level_text(&text)?;
|
||||
let normalized = migrate_scene_text(&text)?;
|
||||
let bevy_ron = strip_schema_version(&normalized)?;
|
||||
let document = SceneDocument::from_ron_text(&text)?;
|
||||
let bevy_ron = strip_schema_version(document.normalized_ron())?;
|
||||
|
||||
clear_loaded_scene_roots(world);
|
||||
clear_level_objects(world);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -82,6 +82,7 @@ struct RenderViewCache {
|
||||
profile: Option<ActiveCameraRenderProfile>,
|
||||
effective_gi: Option<GiPath>,
|
||||
stack: Option<EffectiveRenderStack>,
|
||||
local_shadow_lights: Option<bool>,
|
||||
}
|
||||
|
||||
/// Ensures exactly one camera has the full project rendering stack for the current mode.
|
||||
@@ -146,6 +147,8 @@ fn sync_project_render_view(
|
||||
let effective_gi = stack.effective_gi_path;
|
||||
let solari_readiness_changed = cache.effective_gi != Some(effective_gi);
|
||||
cache.effective_gi = Some(effective_gi);
|
||||
let local_shadow_lights_changed = cache.local_shadow_lights != Some(local_shadow_lights.0);
|
||||
cache.local_shadow_lights = Some(local_shadow_lights.0);
|
||||
|
||||
let active_target = viewport_target.0.as_ref().map(|t| t.image.id());
|
||||
let target_changed = cache.target != active_target;
|
||||
@@ -156,6 +159,7 @@ fn sync_project_render_view(
|
||||
&& !target_changed
|
||||
&& !profile_changed
|
||||
&& !solari_readiness_changed
|
||||
&& !local_shadow_lights_changed
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -183,9 +187,11 @@ fn sync_project_render_view(
|
||||
|| target_changed
|
||||
|| profile_changed
|
||||
|| solari_readiness_changed
|
||||
|| local_shadow_lights_changed
|
||||
{
|
||||
let force_full_apply = owner_changed || target_changed || solari_readiness_changed;
|
||||
for entity in &active {
|
||||
let apply = if owner_changed {
|
||||
let apply = if force_full_apply {
|
||||
ViewportStackApply::Full
|
||||
} else if let Ok(state) = camera_fx.get(*entity) {
|
||||
let snap = fx_snapshot(state);
|
||||
|
||||
@@ -84,9 +84,6 @@ fn active_camera_tab(world: &mut World, ui: &mut egui::Ui) {
|
||||
) {
|
||||
(GiPath::Forward, _, _) => "Forward PBR",
|
||||
(GiPath::SolariDeferred, GiPath::SolariDeferred, _) => "Solari deferred",
|
||||
(GiPath::SolariDeferred, _, Some(RenderFallbackReason::LocalShadowLights)) => {
|
||||
"Solari requested, Forward (local shadow lights)"
|
||||
}
|
||||
(GiPath::SolariDeferred, _, Some(RenderFallbackReason::RtUnsupported)) => {
|
||||
"Solari requested, Forward (RT unsupported)"
|
||||
}
|
||||
@@ -102,12 +99,7 @@ fn active_camera_tab(world: &mut World, ui: &mut egui::Ui) {
|
||||
{
|
||||
ui.colored_label(
|
||||
egui::Color32::from_rgb(255, 180, 100),
|
||||
"Solari deferred: directional lights and emissive meshes affect lighting; point/spot lights are Forward-only in Bevy 0.18.",
|
||||
);
|
||||
} else if stack.fallback_reason == Some(RenderFallbackReason::LocalShadowLights) {
|
||||
ui.colored_label(
|
||||
egui::Color32::from_rgb(255, 180, 100),
|
||||
"Point/spot lights with shadows require Forward PBR; GI auto-falls back while they are in the scene.",
|
||||
"Solari deferred: directional lights and emissive meshes affect lighting; point/spot LightDesc components are disabled in Bevy 0.18.",
|
||||
);
|
||||
} else if stack.fallback_reason == Some(RenderFallbackReason::RtUnsupported)
|
||||
|| (!caps.rt_supported && profile.gi_path == GiPath::Forward)
|
||||
@@ -176,7 +168,9 @@ fn active_camera_tab(world: &mut World, ui: &mut egui::Ui) {
|
||||
ui.label(format!(
|
||||
"Post-FX: hdr={} target_hdr={} bloom={} taa={} ssao={} atmosphere={} tonemap={}",
|
||||
profile.hdr,
|
||||
hdr_enabled_profile(&profile) || stack.effective_gi_path == GiPath::SolariDeferred,
|
||||
hdr_enabled_profile(&profile)
|
||||
|| profile.atmosphere
|
||||
|| stack.effective_gi_path == GiPath::SolariDeferred,
|
||||
profile.bloom,
|
||||
profile.taa,
|
||||
profile.ssao,
|
||||
|
||||
Reference in new issue
Block a user