Fixing skybox problems

This commit is contained in:
rewin
2024-03-19 21:49:22 +03:00
parent 4c532fd32c
commit 2c6affce55
8 changed files with 54 additions and 51 deletions
Generated
+8 -8
View File
@@ -5889,7 +5889,7 @@ dependencies = [
[[package]]
name = "space_bevy_xpbd_plugin"
version = "0.4.0"
source = "git+https://github.com/rewin123/space_editor?rev=0e27774697ffc8d9006736f8f0a5b939d55de53a#0e27774697ffc8d9006736f8f0a5b939d55de53a"
source = "git+https://github.com/rewin123/space_editor?rev=e191880bdfc7498a1c93d6efd98393c462990dea#e191880bdfc7498a1c93d6efd98393c462990dea"
dependencies = [
"bevy",
"bevy-inspector-egui",
@@ -5900,7 +5900,7 @@ dependencies = [
[[package]]
name = "space_editor"
version = "0.4.0"
source = "git+https://github.com/rewin123/space_editor?rev=0e27774697ffc8d9006736f8f0a5b939d55de53a#0e27774697ffc8d9006736f8f0a5b939d55de53a"
source = "git+https://github.com/rewin123/space_editor?rev=e191880bdfc7498a1c93d6efd98393c462990dea#e191880bdfc7498a1c93d6efd98393c462990dea"
dependencies = [
"bevy",
"space_bevy_xpbd_plugin",
@@ -5911,7 +5911,7 @@ dependencies = [
[[package]]
name = "space_editor_core"
version = "0.4.0"
source = "git+https://github.com/rewin123/space_editor?rev=0e27774697ffc8d9006736f8f0a5b939d55de53a#0e27774697ffc8d9006736f8f0a5b939d55de53a"
source = "git+https://github.com/rewin123/space_editor?rev=e191880bdfc7498a1c93d6efd98393c462990dea#e191880bdfc7498a1c93d6efd98393c462990dea"
dependencies = [
"bevy",
"bevy_egui",
@@ -5926,7 +5926,7 @@ dependencies = [
[[package]]
name = "space_editor_ui"
version = "0.4.0"
source = "git+https://github.com/rewin123/space_editor?rev=0e27774697ffc8d9006736f8f0a5b939d55de53a#0e27774697ffc8d9006736f8f0a5b939d55de53a"
source = "git+https://github.com/rewin123/space_editor?rev=e191880bdfc7498a1c93d6efd98393c462990dea#e191880bdfc7498a1c93d6efd98393c462990dea"
dependencies = [
"anyhow",
"bevy",
@@ -5954,7 +5954,7 @@ dependencies = [
[[package]]
name = "space_persistence"
version = "0.4.0"
source = "git+https://github.com/rewin123/space_editor?rev=0e27774697ffc8d9006736f8f0a5b939d55de53a#0e27774697ffc8d9006736f8f0a5b939d55de53a"
source = "git+https://github.com/rewin123/space_editor?rev=e191880bdfc7498a1c93d6efd98393c462990dea#e191880bdfc7498a1c93d6efd98393c462990dea"
dependencies = [
"bevy",
"ron",
@@ -5964,7 +5964,7 @@ dependencies = [
[[package]]
name = "space_prefab"
version = "0.4.0"
source = "git+https://github.com/rewin123/space_editor?rev=0e27774697ffc8d9006736f8f0a5b939d55de53a#0e27774697ffc8d9006736f8f0a5b939d55de53a"
source = "git+https://github.com/rewin123/space_editor?rev=e191880bdfc7498a1c93d6efd98393c462990dea#e191880bdfc7498a1c93d6efd98393c462990dea"
dependencies = [
"bevy",
"bevy-inspector-egui",
@@ -5978,7 +5978,7 @@ dependencies = [
[[package]]
name = "space_shared"
version = "0.4.0"
source = "git+https://github.com/rewin123/space_editor?rev=0e27774697ffc8d9006736f8f0a5b939d55de53a#0e27774697ffc8d9006736f8f0a5b939d55de53a"
source = "git+https://github.com/rewin123/space_editor?rev=e191880bdfc7498a1c93d6efd98393c462990dea#e191880bdfc7498a1c93d6efd98393c462990dea"
dependencies = [
"anyhow",
"bevy",
@@ -5991,7 +5991,7 @@ dependencies = [
[[package]]
name = "space_undo"
version = "0.4.0"
source = "git+https://github.com/rewin123/space_editor?rev=0e27774697ffc8d9006736f8f0a5b939d55de53a#0e27774697ffc8d9006736f8f0a5b939d55de53a"
source = "git+https://github.com/rewin123/space_editor?rev=e191880bdfc7498a1c93d6efd98393c462990dea#e191880bdfc7498a1c93d6efd98393c462990dea"
dependencies = [
"bevy",
"pretty-type-name",
+4 -4
View File
@@ -1,8 +1,8 @@
{
"space_persistence::PersistenceSettings": "{\"space_persistence::PersistenceSettings\":(load_on_startup:true,save_on_close:true)}",
"space_undo::ChangeChainSettings": "{\"space_undo::ChangeChainSettings\":(max_change_chain_size:200)}",
"space_editor_core::hotkeys::HotkeySet<space_editor_ui::tools::gizmo::GizmoHotkey>": "{\"space_editor_core::hotkeys::HotkeySet<space_editor_ui::tools::gizmo::GizmoHotkey>\":(bindings:{Rotate:[R],Translate:[G],Scale:[S],Multiple:[ShiftLeft],Clone:[AltLeft],Delete:[X]},name:\"GizmoHotkey\")}",
"space_editor_ui::sizing::Sizing": "{\"space_editor_ui::sizing::Sizing\":(icon:Regular,gizmos:Gizmos,text:14.0)}",
"space_editor_ui::settings::GameModeSettings": "{\"space_editor_ui::settings::GameModeSettings\":(mode:Game3D)}",
"space_persistence::PersistenceSettings": "{\"space_persistence::PersistenceSettings\":(load_on_startup:true,save_on_close:true)}",
"space_editor_core::hotkeys::HotkeySet<space_editor_ui::tools::gizmo::GizmoHotkey>": "{\"space_editor_core::hotkeys::HotkeySet<space_editor_ui::tools::gizmo::GizmoHotkey>\":(bindings:{Clone:[AltLeft],Rotate:[KeyR],Multiple:[ShiftLeft],Delete:[KeyX],Translate:[KeyG],Scale:[KeyS]},name:\"GizmoHotkey\")}",
"space_editor_ui::settings::NewWindowSettings": "{\"space_editor_ui::settings::NewWindowSettings\":(new_tab:SameNode)}",
"space_undo::ChangeChainSettings": "{\"space_undo::ChangeChainSettings\":(max_change_chain_size:200)}",
"space_editor_ui::sizing::Sizing": "{\"space_editor_ui::sizing::Sizing\":(icon:Regular,gizmos:Gizmos,text:14.0)}",
}
+1 -1
View File
@@ -46,7 +46,7 @@ futures-lite = "2.2.0"
futures = "0.3.30"
image = "0.24.8"
bytemuck = "1.14.1"
space_editor = {git = "https://github.com/rewin123/space_editor", rev = "0e27774697ffc8d9006736f8f0a5b939d55de53a"}
space_editor = {git = "https://github.com/rewin123/space_editor", rev = "e191880bdfc7498a1c93d6efd98393c462990dea"}
anyhow.workspace = true
serde_repr = "0.1.18"
@@ -1,7 +0,0 @@
(
meta_format_version: "1.0",
asset: Load(
loader: "bevy_render::texture::hdr_texture_loader::HdrTextureLoader",
settings: (),
),
)
+1 -1
View File
@@ -70,7 +70,7 @@ impl Plugin for DebugPlugin {
.disable::<GizmoToolPlugin>()
// .disable::<EditorGizmoConfigPlugin>()
// .disable::<MeshlessVisualizerPlugin>()
// .disable::<space_editor::prelude::SelectedPlugin>(),
.disable::<space_editor::prelude::SelectedPlugin>(),
);
app.add_systems(Update, sync_editor_camera);
+1 -1
View File
@@ -86,7 +86,7 @@ impl PluginGroup for CommonPlugins {
.add(InspectorPlugin)
.add(InterpolationPlugin)
.add(ScenePlugin)
.add(SkyboxPlugin)
// .add(SkyboxPlugin)
.add(StudioInputPlugin)
.add(UiLayerPlugin)
.add(WorldGridPlugin)
+3 -1
View File
@@ -175,7 +175,9 @@ fn check_loading(
if let Some((load_state, dep_load_state, rec_load_state)) =
asset_server.get_load_states(h.id())
{
let is_loaded = dep_load_state == DependencyLoadState::Loaded;
let is_loaded = dep_load_state == DependencyLoadState::Loaded
|| rec_load_state == RecursiveDependencyLoadState::Loaded
|| load_state == LoadState::Loaded;
let is_failed = dep_load_state == DependencyLoadState::Failed
|| rec_load_state == RecursiveDependencyLoadState::Failed
+36 -28
View File
@@ -47,12 +47,20 @@ fn load_skybox(mut cmd: Commands, assets: Res<AssetServer>, id: Res<SkyboxId>) {
brightness: 1.0,
})
} else {
let paths = SkyboxPaths::new(id);
cmd.insert_resource(SkyboxAssets {
cubemap: assets.load(paths.cubemap),
env_diffuse: assets.load(paths.env_diffuse),
env_specular: assets.load(paths.env_specular),
let color = Color::hex("AAAAAA").unwrap();
cmd.insert_resource(ClearColor(color));
cmd.insert_resource(AmbientLight {
color,
brightness: 1.0,
});
// let paths = SkyboxPaths::new(id);
// cmd.insert_resource(SkyboxAssets {
// cubemap: assets.load(paths.cubemap),
// env_diffuse: assets.load(paths.env_diffuse),
// env_specular: assets.load(paths.env_specular),
// });
}
}
@@ -86,31 +94,31 @@ fn spawn_skybox(
skybox_assets: Res<SkyboxAssets>,
q_camera: Query<Entity, With<MainCamera>>,
) {
// Configure the skybox texture as a cubemap
let image = images.get_mut(&skybox_assets.cubemap).unwrap();
if image.texture_descriptor.array_layer_count() == 1 {
image.reinterpret_stacked_2d_as_array(6);
image.texture_view_descriptor = Some(TextureViewDescriptor {
dimension: Some(TextureViewDimension::Cube),
..default()
});
}
// // Configure the skybox texture as a cubemap
// let image = images.get_mut(&skybox_assets.cubemap).unwrap();
// if image.texture_descriptor.array_layer_count() == 1 {
// image.reinterpret_stacked_2d_as_array(6);
// image.texture_view_descriptor = Some(TextureViewDescriptor {
// dimension: Some(TextureViewDimension::Cube),
// ..default()
// });
// }
// Add components to the scene camera
cmd.entity(q_camera.single()).insert((
Skybox {
image: skybox_assets.cubemap.clone(),
brightness: 1.0,
},
EnvironmentMapLight {
diffuse_map: skybox_assets.env_diffuse.clone(),
specular_map: skybox_assets.env_specular.clone(),
intensity: 1.0,
},
));
// // Add components to the scene camera
// cmd.entity(q_camera.single()).insert((
// Skybox {
// image: skybox_assets.cubemap.clone(),
// brightness: 10.0,
// },
// EnvironmentMapLight {
// diffuse_map: skybox_assets.env_diffuse.clone(),
// specular_map: skybox_assets.env_specular.clone(),
// intensity: 10.0,
// },
// ));
// Remove the intermediate resource
cmd.remove_resource::<SkyboxAssets>();
// // Remove the intermediate resource
// cmd.remove_resource::<SkyboxAssets>();
}
struct SkyboxPaths {