mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-24 08:26:01 +00:00
Allow Skybox to take a Color (#57)
This PR Adds the ability to set the color of the skybox using the URL parameters. - Now you can pass a color's hexadecimal number (without the #) in the skybox parameter, and that will set the skybox to that color.
This commit is contained in:
+15
-6
@@ -39,12 +39,21 @@ struct SkyboxAssets {
|
||||
}
|
||||
|
||||
fn load_skybox(mut cmd: Commands, assets: Res<AssetServer>, id: Res<SkyboxId>) {
|
||||
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 id = &**id;
|
||||
if let Ok(color) = Color::hex(id) {
|
||||
cmd.insert_resource(ClearColor(color));
|
||||
cmd.insert_resource(AmbientLight {
|
||||
color,
|
||||
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),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn skybox_assets_loaded(
|
||||
|
||||
Reference in New Issue
Block a user