mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-17 00:13:17 +00:00
Fixing skybox problems
This commit is contained in:
+1
-1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user