mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
Migrate lights to required components (#15554)
# Objective Another step in the migration to required components: lights! Note that this does not include `EnvironmentMapLight` or reflection probes yet, because their API hasn't been fully chosen yet. ## Solution As per the [selected proposals](https://hackmd.io/@bevy/required_components/%2FLLnzwz9XTxiD7i2jiUXkJg): - Deprecate `PointLightBundle` in favor of the `PointLight` component - Deprecate `SpotLightBundle` in favor of the `PointLight` component - Deprecate `DirectionalLightBundle` in favor of the `DirectionalLight` component ## Testing I ran some examples with lights. --- ## Migration Guide `PointLightBundle`, `SpotLightBundle`, and `DirectionalLightBundle` have been deprecated. Use the `PointLight`, `SpotLight`, and `DirectionalLight` components instead. Adding them will now insert the other components required by them automatically.
This commit is contained in:
parent
383c2e5bd7
commit
de888a373d
104 changed files with 538 additions and 720 deletions
|
@ -17,8 +17,7 @@ use bevy_ecs::{
|
|||
use bevy_hierarchy::{BuildChildren, ChildBuild, WorldChildBuilder};
|
||||
use bevy_math::{Affine2, Mat4, Vec3};
|
||||
use bevy_pbr::{
|
||||
DirectionalLight, DirectionalLightBundle, PbrBundle, PointLight, PointLightBundle, SpotLight,
|
||||
SpotLightBundle, StandardMaterial, UvChannel, MAX_JOINTS,
|
||||
DirectionalLight, PbrBundle, PointLight, SpotLight, StandardMaterial, UvChannel, MAX_JOINTS,
|
||||
};
|
||||
use bevy_render::{
|
||||
alpha::AlphaMode,
|
||||
|
@ -1523,14 +1522,11 @@ fn load_node(
|
|||
if let Some(light) = gltf_node.light() {
|
||||
match light.kind() {
|
||||
gltf::khr_lights_punctual::Kind::Directional => {
|
||||
let mut entity = parent.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
color: Color::srgb_from_array(light.color()),
|
||||
// NOTE: KHR_punctual_lights defines the intensity units for directional
|
||||
// lights in lux (lm/m^2) which is what we need.
|
||||
illuminance: light.intensity(),
|
||||
..Default::default()
|
||||
},
|
||||
let mut entity = parent.spawn(DirectionalLight {
|
||||
color: Color::srgb_from_array(light.color()),
|
||||
// NOTE: KHR_punctual_lights defines the intensity units for directional
|
||||
// lights in lux (lm/m^2) which is what we need.
|
||||
illuminance: light.intensity(),
|
||||
..Default::default()
|
||||
});
|
||||
if let Some(name) = light.name() {
|
||||
|
@ -1543,17 +1539,14 @@ fn load_node(
|
|||
}
|
||||
}
|
||||
gltf::khr_lights_punctual::Kind::Point => {
|
||||
let mut entity = parent.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
color: Color::srgb_from_array(light.color()),
|
||||
// NOTE: KHR_punctual_lights defines the intensity units for point lights in
|
||||
// candela (lm/sr) which is luminous intensity and we need luminous power.
|
||||
// For a point light, luminous power = 4 * pi * luminous intensity
|
||||
intensity: light.intensity() * core::f32::consts::PI * 4.0,
|
||||
range: light.range().unwrap_or(20.0),
|
||||
radius: 0.0,
|
||||
..Default::default()
|
||||
},
|
||||
let mut entity = parent.spawn(PointLight {
|
||||
color: Color::srgb_from_array(light.color()),
|
||||
// NOTE: KHR_punctual_lights defines the intensity units for point lights in
|
||||
// candela (lm/sr) which is luminous intensity and we need luminous power.
|
||||
// For a point light, luminous power = 4 * pi * luminous intensity
|
||||
intensity: light.intensity() * core::f32::consts::PI * 4.0,
|
||||
range: light.range().unwrap_or(20.0),
|
||||
radius: 0.0,
|
||||
..Default::default()
|
||||
});
|
||||
if let Some(name) = light.name() {
|
||||
|
@ -1569,19 +1562,16 @@ fn load_node(
|
|||
inner_cone_angle,
|
||||
outer_cone_angle,
|
||||
} => {
|
||||
let mut entity = parent.spawn(SpotLightBundle {
|
||||
spot_light: SpotLight {
|
||||
color: Color::srgb_from_array(light.color()),
|
||||
// NOTE: KHR_punctual_lights defines the intensity units for spot lights in
|
||||
// candela (lm/sr) which is luminous intensity and we need luminous power.
|
||||
// For a spot light, we map luminous power = 4 * pi * luminous intensity
|
||||
intensity: light.intensity() * core::f32::consts::PI * 4.0,
|
||||
range: light.range().unwrap_or(20.0),
|
||||
radius: light.range().unwrap_or(0.0),
|
||||
inner_angle: inner_cone_angle,
|
||||
outer_angle: outer_cone_angle,
|
||||
..Default::default()
|
||||
},
|
||||
let mut entity = parent.spawn(SpotLight {
|
||||
color: Color::srgb_from_array(light.color()),
|
||||
// NOTE: KHR_punctual_lights defines the intensity units for spot lights in
|
||||
// candela (lm/sr) which is luminous intensity and we need luminous power.
|
||||
// For a spot light, we map luminous power = 4 * pi * luminous intensity
|
||||
intensity: light.intensity() * core::f32::consts::PI * 4.0,
|
||||
range: light.range().unwrap_or(20.0),
|
||||
radius: light.range().unwrap_or(0.0),
|
||||
inner_angle: inner_cone_angle,
|
||||
outer_angle: outer_cone_angle,
|
||||
..Default::default()
|
||||
});
|
||||
if let Some(name) = light.name() {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![expect(deprecated)]
|
||||
|
||||
use crate::{
|
||||
CascadeShadowConfig, Cascades, DirectionalLight, Material, PointLight, SpotLight,
|
||||
StandardMaterial,
|
||||
|
@ -97,6 +99,10 @@ pub struct CascadesVisibleEntities {
|
|||
|
||||
/// A component bundle for [`PointLight`] entities.
|
||||
#[derive(Debug, Bundle, Default, Clone)]
|
||||
#[deprecated(
|
||||
since = "0.15.0",
|
||||
note = "Use the `PointLight` component instead. Inserting it will now also insert the other components required by it automatically."
|
||||
)]
|
||||
pub struct PointLightBundle {
|
||||
pub point_light: PointLight,
|
||||
pub cubemap_visible_entities: CubemapVisibleEntities,
|
||||
|
@ -115,6 +121,10 @@ pub struct PointLightBundle {
|
|||
|
||||
/// A component bundle for spot light entities
|
||||
#[derive(Debug, Bundle, Default, Clone)]
|
||||
#[deprecated(
|
||||
since = "0.15.0",
|
||||
note = "Use the `SpotLight` component instead. Inserting it will now also insert the other components required by it automatically."
|
||||
)]
|
||||
pub struct SpotLightBundle {
|
||||
pub spot_light: SpotLight,
|
||||
pub visible_entities: VisibleMeshEntities,
|
||||
|
@ -133,6 +143,10 @@ pub struct SpotLightBundle {
|
|||
|
||||
/// A component bundle for [`DirectionalLight`] entities.
|
||||
#[derive(Debug, Bundle, Default, Clone)]
|
||||
#[deprecated(
|
||||
since = "0.15.0",
|
||||
note = "Use the `DirectionalLight` component instead. Inserting it will now also insert the other components required by it automatically."
|
||||
)]
|
||||
pub struct DirectionalLightBundle {
|
||||
pub directional_light: DirectionalLight,
|
||||
pub frusta: CascadesFrusta,
|
||||
|
|
|
@ -68,6 +68,7 @@ pub use volumetric_fog::{
|
|||
/// The PBR prelude.
|
||||
///
|
||||
/// This includes the most common types in this crate, re-exported for your convenience.
|
||||
#[expect(deprecated)]
|
||||
pub mod prelude {
|
||||
#[doc(hidden)]
|
||||
pub use crate::{
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use bevy_render::{view::Visibility, world_sync::SyncToRenderWorld};
|
||||
|
||||
use super::*;
|
||||
|
||||
/// A Directional light.
|
||||
|
@ -36,8 +38,8 @@ use super::*;
|
|||
///
|
||||
/// Shadows are produced via [cascaded shadow maps](https://developer.download.nvidia.com/SDK/10.5/opengl/src/cascaded_shadow_maps/doc/cascaded_shadow_maps.pdf).
|
||||
///
|
||||
/// To modify the cascade set up, such as the number of cascades or the maximum shadow distance,
|
||||
/// change the [`CascadeShadowConfig`] component of the [`DirectionalLightBundle`].
|
||||
/// To modify the cascade setup, such as the number of cascades or the maximum shadow distance,
|
||||
/// change the [`CascadeShadowConfig`] component of the entity with the [`DirectionalLight`].
|
||||
///
|
||||
/// To control the resolution of the shadow maps, use the [`DirectionalLightShadowMap`] resource:
|
||||
///
|
||||
|
@ -49,6 +51,15 @@ use super::*;
|
|||
/// ```
|
||||
#[derive(Component, Debug, Clone, Reflect)]
|
||||
#[reflect(Component, Default, Debug)]
|
||||
#[require(
|
||||
Cascades,
|
||||
CascadesFrusta,
|
||||
CascadeShadowConfig,
|
||||
CascadesVisibleEntities,
|
||||
Transform,
|
||||
Visibility,
|
||||
SyncToRenderWorld
|
||||
)]
|
||||
pub struct DirectionalLight {
|
||||
/// The color of the light.
|
||||
///
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use bevy_render::{view::Visibility, world_sync::SyncToRenderWorld};
|
||||
|
||||
use super::*;
|
||||
|
||||
/// A light that emits light in all directions from a central point.
|
||||
|
@ -19,6 +21,13 @@ use super::*;
|
|||
/// Source: [Wikipedia](https://en.wikipedia.org/wiki/Lumen_(unit)#Lighting)
|
||||
#[derive(Component, Debug, Clone, Copy, Reflect)]
|
||||
#[reflect(Component, Default, Debug)]
|
||||
#[require(
|
||||
CubemapFrusta,
|
||||
CubemapVisibleEntities,
|
||||
Transform,
|
||||
Visibility,
|
||||
SyncToRenderWorld
|
||||
)]
|
||||
pub struct PointLight {
|
||||
/// The color of this light source.
|
||||
pub color: Color,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use bevy_render::{view::Visibility, world_sync::SyncToRenderWorld};
|
||||
|
||||
use super::*;
|
||||
|
||||
/// A light that emits light in a given direction from a central point.
|
||||
|
@ -7,6 +9,7 @@ use super::*;
|
|||
/// the transform, and can be specified with [`Transform::looking_at`](Transform::looking_at).
|
||||
#[derive(Component, Debug, Clone, Copy, Reflect)]
|
||||
#[reflect(Component, Default, Debug)]
|
||||
#[require(Frustum, VisibleMeshEntities, Transform, Visibility, SyncToRenderWorld)]
|
||||
pub struct SpotLight {
|
||||
/// The color of the light.
|
||||
///
|
||||
|
|
|
@ -30,14 +30,13 @@ fn setup(
|
|||
..default()
|
||||
});
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
transform: Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
|
|
|
@ -116,17 +116,16 @@ fn setup(
|
|||
));
|
||||
}
|
||||
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
intensity: 10_000_000.,
|
||||
range: 100.0,
|
||||
shadow_depth_bias: 0.2,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(8.0, 16.0, 8.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(8.0, 16.0, 8.0),
|
||||
));
|
||||
|
||||
// ground plane
|
||||
commands.spawn(PbrBundle {
|
||||
|
|
|
@ -66,10 +66,10 @@ fn setup(
|
|||
));
|
||||
|
||||
// light
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_translation(Vec3::ONE).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((
|
||||
DirectionalLight::default(),
|
||||
Transform::from_translation(Vec3::ONE).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -252,24 +252,18 @@ fn add_skybox_and_environment_map(
|
|||
|
||||
/// Spawns a rotating directional light.
|
||||
fn spawn_directional_light(commands: &mut Commands) {
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
color: WHITE.into(),
|
||||
illuminance: 3000.0,
|
||||
..default()
|
||||
},
|
||||
commands.spawn(DirectionalLight {
|
||||
color: WHITE.into(),
|
||||
illuminance: 3000.0,
|
||||
..default()
|
||||
});
|
||||
}
|
||||
|
||||
/// Spawns a rotating point light.
|
||||
fn spawn_point_light(commands: &mut Commands) {
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
color: WHITE.into(),
|
||||
intensity: 200000.0,
|
||||
..default()
|
||||
},
|
||||
commands.spawn(PointLight {
|
||||
color: WHITE.into(),
|
||||
intensity: 200000.0,
|
||||
..default()
|
||||
});
|
||||
}
|
||||
|
|
|
@ -281,26 +281,20 @@ fn setup(
|
|||
});
|
||||
|
||||
// Light
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
illuminance: light_consts::lux::FULL_DAYLIGHT,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_rotation(Quat::from_euler(
|
||||
EulerRot::ZYX,
|
||||
0.0,
|
||||
PI * -0.15,
|
||||
PI * -0.15,
|
||||
)),
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, PI * -0.15, PI * -0.15)),
|
||||
CascadeShadowConfigBuilder {
|
||||
maximum_distance: 3.0,
|
||||
first_cascade_far_bound: 0.9,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
.build(),
|
||||
));
|
||||
|
||||
// Camera
|
||||
commands.spawn((
|
||||
|
|
|
@ -58,17 +58,15 @@ fn setup_terrain_scene(
|
|||
.build();
|
||||
|
||||
// Sun
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
color: Color::srgb(0.98, 0.95, 0.82),
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(0.0, 0.0, 0.0)
|
||||
.looking_at(Vec3::new(-0.15, -0.05, 0.25), Vec3::Y),
|
||||
Transform::from_xyz(0.0, 0.0, 0.0).looking_at(Vec3::new(-0.15, -0.05, 0.25), Vec3::Y),
|
||||
cascade_shadow_config,
|
||||
..default()
|
||||
});
|
||||
));
|
||||
|
||||
// Terrain
|
||||
commands.spawn(SceneBundle {
|
||||
|
|
|
@ -110,14 +110,13 @@ fn setup(
|
|||
brightness: 0.0,
|
||||
});
|
||||
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
intensity: 2000.0,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(0.0, 0.0, 0.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(0.0, 0.0, 0.0),
|
||||
));
|
||||
|
||||
commands.spawn(ImageBundle {
|
||||
image: UiImage {
|
||||
|
|
|
@ -167,10 +167,7 @@ fn setup(
|
|||
}
|
||||
|
||||
// Light
|
||||
commands.spawn(PointLightBundle {
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((PointLight::default(), Transform::from_xyz(4.0, 8.0, 4.0)));
|
||||
|
||||
// Camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -188,21 +188,19 @@ fn spawn_scratched_gold_ball(
|
|||
|
||||
/// Spawns a light.
|
||||
fn spawn_light(commands: &mut Commands) {
|
||||
// Add the cascades objects used by the `DirectionalLightBundle`, since the
|
||||
// user can toggle between a point light and a directional light.
|
||||
commands
|
||||
.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
color: WHITE.into(),
|
||||
intensity: 100000.0,
|
||||
..default()
|
||||
},
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
color: WHITE.into(),
|
||||
intensity: 100000.0,
|
||||
..default()
|
||||
})
|
||||
.insert(CascadesFrusta::default())
|
||||
.insert(Cascades::default())
|
||||
.insert(CascadeShadowConfig::default())
|
||||
.insert(CascadesVisibleEntities::default());
|
||||
},
|
||||
// Add the cascades objects used by the `DirectionalLight`, since the
|
||||
// user can toggle between a point light and a directional light.
|
||||
CascadesFrusta::default(),
|
||||
Cascades::default(),
|
||||
CascadeShadowConfig::default(),
|
||||
CascadesVisibleEntities::default(),
|
||||
));
|
||||
}
|
||||
|
||||
/// Spawns a camera with associated skybox and environment map.
|
||||
|
|
|
@ -398,26 +398,20 @@ fn add_basic_scene(commands: &mut Commands, asset_server: &AssetServer) {
|
|||
});
|
||||
|
||||
// Spawn the light.
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
illuminance: 15000.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_rotation(Quat::from_euler(
|
||||
EulerRot::ZYX,
|
||||
0.0,
|
||||
PI * -0.15,
|
||||
PI * -0.15,
|
||||
)),
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, PI * -0.15, PI * -0.15)),
|
||||
CascadeShadowConfigBuilder {
|
||||
maximum_distance: 3.0,
|
||||
first_cascade_far_bound: 0.9,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
.build(),
|
||||
));
|
||||
}
|
||||
|
||||
impl Display for SelectedGlobalColorGradingOption {
|
||||
|
|
|
@ -66,21 +66,20 @@ fn setup(
|
|||
Fxaa::default(),
|
||||
));
|
||||
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
illuminance: 15_000.,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
CascadeShadowConfigBuilder {
|
||||
num_cascades: 3,
|
||||
maximum_distance: 10.0,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
transform: Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, 0.0, -FRAC_PI_4)),
|
||||
..default()
|
||||
});
|
||||
.build(),
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, 0.0, -FRAC_PI_4)),
|
||||
));
|
||||
|
||||
// FlightHelmet
|
||||
let helmet_scene = asset_server
|
||||
|
@ -139,17 +138,16 @@ fn setup(
|
|||
NotShadowCaster,
|
||||
));
|
||||
// Light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
intensity: 800.0,
|
||||
radius: 0.125,
|
||||
shadows_enabled: true,
|
||||
color: sphere_color,
|
||||
..default()
|
||||
},
|
||||
transform: sphere_pos,
|
||||
..default()
|
||||
});
|
||||
sphere_pos,
|
||||
));
|
||||
|
||||
// Spheres
|
||||
for i in 0..6 {
|
||||
|
|
|
@ -113,14 +113,13 @@ fn setup_pyramid_scene(
|
|||
});
|
||||
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
transform: Transform::from_xyz(0.0, 1.0, 0.0),
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(0.0, 1.0, 0.0),
|
||||
));
|
||||
}
|
||||
|
||||
fn setup_instructions(mut commands: Commands) {
|
||||
|
|
|
@ -49,18 +49,16 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
.insert(SyncToRenderWorld);
|
||||
|
||||
// Spawn a bright directional light that illuminates the fog well.
|
||||
commands
|
||||
.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(1.0, 1.0, -0.3).looking_at(vec3(0.0, 0.5, 0.0), Vec3::Y),
|
||||
directional_light: DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
illuminance: 32000.0,
|
||||
..default()
|
||||
},
|
||||
commands.spawn((
|
||||
Transform::from_xyz(1.0, 1.0, -0.3).looking_at(vec3(0.0, 0.5, 0.0), Vec3::Y),
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
illuminance: 32000.0,
|
||||
..default()
|
||||
})
|
||||
},
|
||||
// Make sure to add this for the light to interact with the fog.
|
||||
.insert(VolumetricLight);
|
||||
VolumetricLight,
|
||||
));
|
||||
|
||||
// Spawn a camera.
|
||||
commands
|
||||
|
|
|
@ -60,10 +60,7 @@ fn setup(
|
|||
});
|
||||
|
||||
// Light up the scene.
|
||||
commands.spawn(PointLightBundle {
|
||||
transform: camera_and_light_transform,
|
||||
..default()
|
||||
});
|
||||
commands.spawn((PointLight::default(), camera_and_light_transform));
|
||||
|
||||
// Text to describe the controls.
|
||||
commands.spawn(
|
||||
|
|
|
@ -260,15 +260,14 @@ fn spawn_irradiance_volume(commands: &mut Commands, assets: &ExampleAssets) {
|
|||
}
|
||||
|
||||
fn spawn_light(commands: &mut Commands) {
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
intensity: 250000.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0762, 5.9039, 1.0055),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0762, 5.9039, 1.0055),
|
||||
));
|
||||
}
|
||||
|
||||
fn spawn_sphere(commands: &mut Commands, assets: &ExampleAssets) {
|
||||
|
|
|
@ -130,17 +130,15 @@ fn setup(
|
|||
|
||||
// red point light
|
||||
commands
|
||||
.spawn(PointLightBundle {
|
||||
// transform: Transform::from_xyz(5.0, 8.0, 2.0),
|
||||
transform: Transform::from_xyz(1.0, 2.0, 0.0),
|
||||
point_light: PointLight {
|
||||
.spawn((
|
||||
PointLight {
|
||||
intensity: 100_000.0,
|
||||
color: RED.into(),
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
})
|
||||
Transform::from_xyz(1.0, 2.0, 0.0),
|
||||
))
|
||||
.with_children(|builder| {
|
||||
builder.spawn(PbrBundle {
|
||||
mesh: meshes.add(Sphere::new(0.1).mesh().uv(32, 18)),
|
||||
|
@ -155,10 +153,8 @@ fn setup(
|
|||
|
||||
// green spot light
|
||||
commands
|
||||
.spawn(SpotLightBundle {
|
||||
transform: Transform::from_xyz(-1.0, 2.0, 0.0)
|
||||
.looking_at(Vec3::new(-1.0, 0.0, 0.0), Vec3::Z),
|
||||
spot_light: SpotLight {
|
||||
.spawn((
|
||||
SpotLight {
|
||||
intensity: 100_000.0,
|
||||
color: LIME.into(),
|
||||
shadows_enabled: true,
|
||||
|
@ -166,8 +162,8 @@ fn setup(
|
|||
outer_angle: 0.8,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
})
|
||||
Transform::from_xyz(-1.0, 2.0, 0.0).looking_at(Vec3::new(-1.0, 0.0, 0.0), Vec3::Z),
|
||||
))
|
||||
.with_children(|builder| {
|
||||
builder.spawn(PbrBundle {
|
||||
transform: Transform::from_rotation(Quat::from_rotation_x(PI / 2.0)),
|
||||
|
@ -183,17 +179,15 @@ fn setup(
|
|||
|
||||
// blue point light
|
||||
commands
|
||||
.spawn(PointLightBundle {
|
||||
// transform: Transform::from_xyz(5.0, 8.0, 2.0),
|
||||
transform: Transform::from_xyz(0.0, 4.0, 0.0),
|
||||
point_light: PointLight {
|
||||
.spawn((
|
||||
PointLight {
|
||||
intensity: 100_000.0,
|
||||
color: BLUE.into(),
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
})
|
||||
Transform::from_xyz(0.0, 4.0, 0.0),
|
||||
))
|
||||
.with_children(|builder| {
|
||||
builder.spawn(PbrBundle {
|
||||
mesh: meshes.add(Sphere::new(0.1).mesh().uv(32, 18)),
|
||||
|
@ -207,13 +201,13 @@ fn setup(
|
|||
});
|
||||
|
||||
// directional 'sun' light
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
illuminance: light_consts::lux::OVERCAST_DAY,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform {
|
||||
Transform {
|
||||
translation: Vec3::new(0.0, 2.0, 0.0),
|
||||
rotation: Quat::from_rotation_x(-PI / 4.),
|
||||
..default()
|
||||
|
@ -221,14 +215,13 @@ fn setup(
|
|||
// The default cascade config is designed to handle large scenes.
|
||||
// As this example has a much smaller world, we can tighten the shadow
|
||||
// bounds for better visual quality.
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
CascadeShadowConfigBuilder {
|
||||
first_cascade_far_bound: 4.0,
|
||||
maximum_distance: 10.0,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
.build(),
|
||||
));
|
||||
|
||||
// example instructions
|
||||
let style = TextStyle::default();
|
||||
|
|
|
@ -30,8 +30,8 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
},
|
||||
));
|
||||
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
|
@ -39,14 +39,13 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
// cascade bounds than the default for better quality.
|
||||
// We also adjusted the shadow map to be larger since we're
|
||||
// only using a single cascade.
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
CascadeShadowConfigBuilder {
|
||||
num_cascades: 1,
|
||||
maximum_distance: 1.6,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
.build(),
|
||||
));
|
||||
commands.spawn(SceneBundle {
|
||||
scene: asset_server
|
||||
.load(GltfAssetLabel::Scene(0).from_asset("models/FlightHelmet/FlightHelmet.gltf")),
|
||||
|
|
|
@ -22,11 +22,8 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
..default()
|
||||
});
|
||||
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
commands.spawn(DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
});
|
||||
|
||||
|
|
|
@ -64,26 +64,20 @@ fn setup(
|
|||
CameraController::default(),
|
||||
));
|
||||
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
illuminance: light_consts::lux::FULL_DAYLIGHT,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
CascadeShadowConfigBuilder {
|
||||
num_cascades: 1,
|
||||
maximum_distance: 15.0,
|
||||
..default()
|
||||
}
|
||||
.build(),
|
||||
transform: Transform::from_rotation(Quat::from_euler(
|
||||
EulerRot::ZYX,
|
||||
0.0,
|
||||
PI * -0.15,
|
||||
PI * -0.15,
|
||||
)),
|
||||
..default()
|
||||
});
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, PI * -0.15, PI * -0.15)),
|
||||
));
|
||||
|
||||
// A custom file format storing a [`bevy_render::mesh::Mesh`]
|
||||
// that has been converted to a [`bevy_pbr::meshlet::MeshletMesh`]
|
||||
|
|
|
@ -67,15 +67,14 @@ fn setup_scene(
|
|||
brightness: 300.0,
|
||||
});
|
||||
commands.insert_resource(CameraMode::Chase);
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
illuminance: 3_000.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::default().looking_to(Vec3::new(-1.0, -0.7, -1.0), Vec3::X),
|
||||
..default()
|
||||
});
|
||||
Transform::default().looking_to(Vec3::new(-1.0, -0.7, -1.0), Vec3::X),
|
||||
));
|
||||
// Sky
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Sphere::default()),
|
||||
|
|
|
@ -59,8 +59,5 @@ fn setup(
|
|||
..default()
|
||||
});
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
transform: Transform::from_xyz(3.0, 8.0, 5.0),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((PointLight::default(), Transform::from_xyz(3.0, 8.0, 5.0)));
|
||||
}
|
||||
|
|
|
@ -221,14 +221,13 @@ fn setup(
|
|||
|
||||
// light
|
||||
commands
|
||||
.spawn(PointLightBundle {
|
||||
transform: Transform::from_xyz(2.0, 1.0, -1.1),
|
||||
point_light: PointLight {
|
||||
.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
})
|
||||
Transform::from_xyz(2.0, 1.0, -1.1),
|
||||
))
|
||||
.with_children(|commands| {
|
||||
// represent the light source as a sphere
|
||||
let mesh = meshes.add(Sphere::new(0.05).mesh().ico(3).unwrap());
|
||||
|
|
|
@ -55,10 +55,7 @@ fn setup(
|
|||
});
|
||||
});
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
transform: Transform::from_xyz(4.0, 5.0, -4.0),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((PointLight::default(), Transform::from_xyz(4.0, 5.0, -4.0)));
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
transform: Transform::from_xyz(5.0, 10.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
|
|
|
@ -51,14 +51,13 @@ fn setup(
|
|||
..default()
|
||||
});
|
||||
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(50.0, 50.0, 50.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
illuminance: 1_500.,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(50.0, 50.0, 50.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
|
||||
// labels
|
||||
commands.spawn(
|
||||
|
|
|
@ -185,17 +185,16 @@ fn spawn_light(commands: &mut Commands, app_status: &AppStatus) {
|
|||
// light depending on the settings, we add the union of the components
|
||||
// necessary for this light to behave as all three of those.
|
||||
commands
|
||||
.spawn(DirectionalLightBundle {
|
||||
directional_light: create_directional_light(app_status),
|
||||
transform: Transform::from_rotation(Quat::from_array([
|
||||
.spawn((
|
||||
create_directional_light(app_status),
|
||||
Transform::from_rotation(Quat::from_array([
|
||||
0.6539259,
|
||||
-0.34646285,
|
||||
0.36505926,
|
||||
-0.5648683,
|
||||
]))
|
||||
.with_translation(vec3(57.693, 34.334, -6.422)),
|
||||
..default()
|
||||
})
|
||||
))
|
||||
// These two are needed for point lights.
|
||||
.insert(CubemapVisibleEntities::default())
|
||||
.insert(CubemapFrusta::default())
|
||||
|
|
|
@ -110,26 +110,20 @@ fn spawn_scene(commands: &mut Commands, asset_server: &AssetServer) {
|
|||
});
|
||||
|
||||
// Spawn the light.
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
illuminance: 15000.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_rotation(Quat::from_euler(
|
||||
EulerRot::ZYX,
|
||||
0.0,
|
||||
PI * -0.15,
|
||||
PI * -0.15,
|
||||
)),
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, PI * -0.15, PI * -0.15)),
|
||||
CascadeShadowConfigBuilder {
|
||||
maximum_distance: 3.0,
|
||||
first_cascade_far_bound: 0.9,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
.build(),
|
||||
));
|
||||
}
|
||||
|
||||
/// Spawns the help text at the bottom of the screen.
|
||||
|
|
|
@ -67,8 +67,8 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
},
|
||||
));
|
||||
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
|
@ -76,14 +76,13 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
// cascade bounds than the default for better quality.
|
||||
// We also adjusted the shadow map to be larger since we're
|
||||
// only using a single cascade.
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
CascadeShadowConfigBuilder {
|
||||
num_cascades: 1,
|
||||
maximum_distance: 1.6,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
.build(),
|
||||
));
|
||||
commands.spawn(SceneBundle {
|
||||
scene: asset_server
|
||||
.load(GltfAssetLabel::Scene(0).from_asset("models/GltfPrimitives/gltf_primitives.glb")),
|
||||
|
|
|
@ -81,10 +81,8 @@ fn setup(
|
|||
// Setting the layer to RenderLayers::layer(0) would cause the main view to be lit, but the rendered-to-texture cube to be unlit.
|
||||
// Setting the layer to RenderLayers::layer(1) would cause the rendered-to-texture cube to be lit, but the main view to be unlit.
|
||||
commands.spawn((
|
||||
PointLightBundle {
|
||||
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 10.0)),
|
||||
..default()
|
||||
},
|
||||
PointLight::default(),
|
||||
Transform::from_translation(Vec3::new(0.0, 0.0, 10.0)),
|
||||
RenderLayers::layer(0).with(1),
|
||||
));
|
||||
|
||||
|
|
|
@ -84,12 +84,9 @@ fn spawn_sphere(
|
|||
|
||||
/// Spawns a light.
|
||||
fn spawn_light(commands: &mut Commands) {
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
color: WHITE.into(),
|
||||
intensity: 100000.0,
|
||||
..default()
|
||||
},
|
||||
commands.spawn(PointLight {
|
||||
color: WHITE.into(),
|
||||
intensity: 100000.0,
|
||||
..default()
|
||||
});
|
||||
}
|
||||
|
|
|
@ -70,15 +70,11 @@ fn setup(
|
|||
|
||||
// Spawn a directional light shining at the camera with the VolumetricLight component.
|
||||
commands.spawn((
|
||||
DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(-5.0, 5.0, -7.0)
|
||||
.looking_at(Vec3::new(0.0, 0.0, 0.0), Vec3::Y),
|
||||
directional_light: DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
Transform::from_xyz(-5.0, 5.0, -7.0).looking_at(Vec3::new(0.0, 0.0, 0.0), Vec3::Y),
|
||||
VolumetricLight,
|
||||
));
|
||||
|
||||
|
|
|
@ -54,25 +54,19 @@ fn setup(
|
|||
Lights,
|
||||
))
|
||||
.with_children(|builder| {
|
||||
builder.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
intensity: 0.0,
|
||||
range: spawn_plane_depth,
|
||||
color: Color::WHITE,
|
||||
shadow_depth_bias: 0.0,
|
||||
shadow_normal_bias: 0.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
builder.spawn(PointLight {
|
||||
intensity: 0.0,
|
||||
range: spawn_plane_depth,
|
||||
color: Color::WHITE,
|
||||
shadow_depth_bias: 0.0,
|
||||
shadow_normal_bias: 0.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
});
|
||||
builder.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
shadow_depth_bias: 0.0,
|
||||
shadow_normal_bias: 0.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
builder.spawn(DirectionalLight {
|
||||
shadow_depth_bias: 0.0,
|
||||
shadow_normal_bias: 0.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
});
|
||||
});
|
||||
|
|
|
@ -79,38 +79,31 @@ fn setup(
|
|||
|
||||
println!("Using DirectionalLight");
|
||||
|
||||
commands.spawn(PointLightBundle {
|
||||
transform: Transform::from_xyz(5.0, 5.0, 0.0),
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
intensity: 0.0,
|
||||
range: spawn_plane_depth,
|
||||
color: Color::WHITE,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(5.0, 5.0, 0.0),
|
||||
));
|
||||
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
illuminance: light_consts::lux::OVERCAST_DAY,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_rotation(Quat::from_euler(
|
||||
EulerRot::ZYX,
|
||||
0.0,
|
||||
PI / 2.,
|
||||
-PI / 4.,
|
||||
)),
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, PI / 2., -PI / 4.)),
|
||||
CascadeShadowConfigBuilder {
|
||||
first_cascade_far_bound: 7.0,
|
||||
maximum_distance: 25.0,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
.build(),
|
||||
));
|
||||
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -60,15 +60,13 @@ struct Cubemap {
|
|||
|
||||
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
// directional 'sun' light
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
illuminance: 32000.0,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(0.0, 2.0, 0.0)
|
||||
.with_rotation(Quat::from_rotation_x(-PI / 4.)),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(0.0, 2.0, 0.0).with_rotation(Quat::from_rotation_x(-PI / 4.)),
|
||||
));
|
||||
|
||||
let skybox_handle = asset_server.load(CUBEMAPS[0].0);
|
||||
// camera
|
||||
|
|
|
@ -59,15 +59,10 @@ fn setup(
|
|||
.with_scale(Vec3::splat(radius)),
|
||||
..default()
|
||||
})
|
||||
.with_children(|children| {
|
||||
children.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
radius,
|
||||
color: Color::srgb(0.2, 0.2, 1.0),
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
});
|
||||
.with_child(PointLight {
|
||||
radius,
|
||||
color: Color::srgb(0.2, 0.2, 1.0),
|
||||
..default()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,13 +34,13 @@ fn setup(
|
|||
});
|
||||
|
||||
// Light
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, 1.0, -PI / 4.)),
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, 1.0, -PI / 4.)),
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
CascadeShadowConfigBuilder {
|
||||
num_cascades: if cfg!(all(
|
||||
feature = "webgl2",
|
||||
target_arch = "wasm32",
|
||||
|
@ -55,9 +55,8 @@ fn setup(
|
|||
maximum_distance: 280.0,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
.build(),
|
||||
));
|
||||
|
||||
// Cameras and their dedicated UI
|
||||
for (index, (camera_name, camera_pos)) in [
|
||||
|
|
|
@ -95,10 +95,8 @@ fn setup(
|
|||
let z = z as f32 - 2.0;
|
||||
// red spot_light
|
||||
commands
|
||||
.spawn(SpotLightBundle {
|
||||
transform: Transform::from_xyz(1.0 + x, 2.0, z)
|
||||
.looking_at(Vec3::new(1.0 + x, 0.0, z), Vec3::X),
|
||||
spot_light: SpotLight {
|
||||
.spawn((
|
||||
SpotLight {
|
||||
intensity: 40_000.0, // lumens
|
||||
color: Color::WHITE,
|
||||
shadows_enabled: true,
|
||||
|
@ -106,8 +104,9 @@ fn setup(
|
|||
outer_angle: PI / 4.0,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
})
|
||||
Transform::from_xyz(1.0 + x, 2.0, z)
|
||||
.looking_at(Vec3::new(1.0 + x, 0.0, z), Vec3::X),
|
||||
))
|
||||
.with_children(|builder| {
|
||||
builder.spawn(PbrBundle {
|
||||
mesh: sphere_mesh.clone(),
|
||||
|
|
|
@ -80,19 +80,13 @@ fn setup(
|
|||
SphereMarker,
|
||||
));
|
||||
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_rotation(Quat::from_euler(
|
||||
EulerRot::ZYX,
|
||||
0.0,
|
||||
PI * -0.15,
|
||||
PI * -0.15,
|
||||
)),
|
||||
..default()
|
||||
});
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, PI * -0.15, PI * -0.15)),
|
||||
));
|
||||
|
||||
commands.spawn(
|
||||
TextBundle::from_section("", TextStyle::default()).with_style(Style {
|
||||
|
|
|
@ -118,26 +118,18 @@ fn setup_basic_scene(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
|
||||
// light
|
||||
commands.spawn((
|
||||
DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
illuminance: 15_000.,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_rotation(Quat::from_euler(
|
||||
EulerRot::ZYX,
|
||||
0.0,
|
||||
PI * -0.15,
|
||||
PI * -0.15,
|
||||
)),
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
maximum_distance: 3.0,
|
||||
first_cascade_far_bound: 0.9,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
DirectionalLight {
|
||||
illuminance: 15_000.,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, PI * -0.15, PI * -0.15)),
|
||||
CascadeShadowConfigBuilder {
|
||||
maximum_distance: 3.0,
|
||||
first_cascade_far_bound: 0.9,
|
||||
..default()
|
||||
}
|
||||
.build(),
|
||||
SceneNumber(1),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -318,18 +318,15 @@ fn setup(
|
|||
|
||||
// Candle Light
|
||||
commands.spawn((
|
||||
PointLightBundle {
|
||||
transform: Transform::from_xyz(-1.0, 1.7, 0.0),
|
||||
point_light: PointLight {
|
||||
color: Color::from(
|
||||
LinearRgba::from(ANTIQUE_WHITE).mix(&LinearRgba::from(ORANGE_RED), 0.2),
|
||||
),
|
||||
intensity: 4_000.0,
|
||||
radius: 0.2,
|
||||
range: 5.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
Transform::from_xyz(-1.0, 1.7, 0.0),
|
||||
PointLight {
|
||||
color: Color::from(
|
||||
LinearRgba::from(ANTIQUE_WHITE).mix(&LinearRgba::from(ORANGE_RED), 0.2),
|
||||
),
|
||||
intensity: 4_000.0,
|
||||
radius: 0.2,
|
||||
range: 5.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
Flicker,
|
||||
|
|
|
@ -87,14 +87,13 @@ fn setup(
|
|||
});
|
||||
|
||||
// Light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
|
||||
// Camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -31,14 +31,13 @@ fn setup(
|
|||
});
|
||||
|
||||
// Light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
|
||||
// Camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -16,14 +16,13 @@ fn main() {
|
|||
struct MovedScene;
|
||||
|
||||
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(4.0, 25.0, 8.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
Transform::from_xyz(4.0, 25.0, 8.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
});
|
||||
));
|
||||
commands.spawn((
|
||||
Camera3dBundle {
|
||||
transform: Transform::from_xyz(-0.5, 0.9, 1.5)
|
||||
|
|
|
@ -44,14 +44,13 @@ fn setup(
|
|||
});
|
||||
|
||||
// Light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 5.0, 4.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 5.0, 4.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
|
||||
// Camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -121,26 +121,20 @@ fn setup(
|
|||
.insert(MainModel::LowPoly);
|
||||
|
||||
// Spawn a light.
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
illuminance: FULL_DAYLIGHT,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_rotation(Quat::from_euler(
|
||||
EulerRot::ZYX,
|
||||
0.0,
|
||||
PI * -0.15,
|
||||
PI * -0.15,
|
||||
)),
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, PI * -0.15, PI * -0.15)),
|
||||
CascadeShadowConfigBuilder {
|
||||
maximum_distance: 30.0,
|
||||
first_cascade_far_bound: 0.9,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
.build(),
|
||||
));
|
||||
|
||||
// Spawn a camera.
|
||||
commands
|
||||
|
|
|
@ -90,42 +90,36 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, app_settings: R
|
|||
});
|
||||
|
||||
// Add the point light
|
||||
commands
|
||||
.spawn((
|
||||
PointLightBundle {
|
||||
point_light: PointLight {
|
||||
shadows_enabled: true,
|
||||
range: 150.0,
|
||||
color: RED.into(),
|
||||
intensity: 1000.0,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(-0.4, 1.9, 1.0),
|
||||
..default()
|
||||
},
|
||||
MoveBackAndForthHorizontally {
|
||||
min_x: -1.93,
|
||||
max_x: -0.4,
|
||||
speed: -0.2,
|
||||
},
|
||||
))
|
||||
.insert(VolumetricLight);
|
||||
commands.spawn((
|
||||
Transform::from_xyz(-0.4, 1.9, 1.0),
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
range: 150.0,
|
||||
color: RED.into(),
|
||||
intensity: 1000.0,
|
||||
..default()
|
||||
},
|
||||
VolumetricLight,
|
||||
MoveBackAndForthHorizontally {
|
||||
min_x: -1.93,
|
||||
max_x: -0.4,
|
||||
speed: -0.2,
|
||||
},
|
||||
));
|
||||
|
||||
// Add the spot light
|
||||
commands
|
||||
.spawn(SpotLightBundle {
|
||||
transform: Transform::from_xyz(-1.8, 3.9, -2.7).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
spot_light: SpotLight {
|
||||
intensity: 5000.0, // lumens
|
||||
color: Color::WHITE,
|
||||
shadows_enabled: true,
|
||||
inner_angle: 0.76,
|
||||
outer_angle: 0.94,
|
||||
..default()
|
||||
},
|
||||
commands.spawn((
|
||||
Transform::from_xyz(-1.8, 3.9, -2.7).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
SpotLight {
|
||||
intensity: 5000.0, // lumens
|
||||
color: Color::WHITE,
|
||||
shadows_enabled: true,
|
||||
inner_angle: 0.76,
|
||||
outer_angle: 0.94,
|
||||
..default()
|
||||
})
|
||||
.insert(VolumetricLight);
|
||||
},
|
||||
VolumetricLight,
|
||||
));
|
||||
|
||||
// Add the fog volume.
|
||||
commands.spawn(FogVolumeBundle {
|
||||
|
|
|
@ -100,10 +100,7 @@ fn setup(
|
|||
));
|
||||
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
transform: Transform::from_xyz(2.0, 4.0, 2.0),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((PointLight::default(), Transform::from_xyz(2.0, 4.0, 2.0)));
|
||||
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -66,20 +66,19 @@ fn setup(
|
|||
});
|
||||
|
||||
// Light
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, 1.0, -PI / 4.)),
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, 1.0, -PI / 4.)),
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
CascadeShadowConfigBuilder {
|
||||
first_cascade_far_bound: 200.0,
|
||||
maximum_distance: 400.0,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
.build(),
|
||||
));
|
||||
|
||||
// Fox
|
||||
commands.spawn(SceneBundle {
|
||||
|
|
|
@ -32,14 +32,13 @@ fn setup(
|
|||
});
|
||||
|
||||
// Light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
intensity: 500_000.0,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(0.0, 2.5, 0.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(0.0, 2.5, 0.0),
|
||||
));
|
||||
|
||||
// Let's use the `Name` component to target entities. We can use anything we
|
||||
// like, but names are convenient.
|
||||
|
|
|
@ -223,15 +223,14 @@ fn setup_scene(
|
|||
..default()
|
||||
});
|
||||
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
intensity: 10_000_000.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(-4.0, 8.0, 13.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(-4.0, 8.0, 13.0),
|
||||
));
|
||||
|
||||
commands.spawn(SceneBundle {
|
||||
scene: asset_server.load(GltfAssetLabel::Scene(0).from_asset("models/animated/Fox.glb")),
|
||||
|
|
|
@ -108,15 +108,14 @@ fn setup_scene(
|
|||
});
|
||||
|
||||
// Spawn the light.
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
intensity: 10_000_000.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(-4.0, 8.0, 13.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(-4.0, 8.0, 13.0),
|
||||
));
|
||||
|
||||
// Spawn the fox.
|
||||
commands.spawn(SceneBundle {
|
||||
|
|
|
@ -48,16 +48,15 @@ fn setup(
|
|||
));
|
||||
|
||||
// Some light to see something
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
intensity: 10_000_000.,
|
||||
range: 100.0,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(8., 16., 8.),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(8., 16., 8.),
|
||||
));
|
||||
|
||||
// ground plane
|
||||
commands.spawn(PbrBundle {
|
||||
|
|
|
@ -51,10 +51,10 @@ fn setup(asset_server: Res<AssetServer>, mut commands: Commands) {
|
|||
.load(GltfAssetLabel::Scene(0).from_asset("models/animated/MorphStressTest.gltf")),
|
||||
..default()
|
||||
});
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_rotation(Quat::from_rotation_z(PI / 2.0)),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((
|
||||
DirectionalLight::default(),
|
||||
Transform::from_rotation(Quat::from_rotation_z(PI / 2.0)),
|
||||
));
|
||||
commands.spawn(Camera3dBundle {
|
||||
transform: Transform::from_xyz(3.0, 2.1, 10.2).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
|
|
|
@ -174,14 +174,13 @@ fn setup(
|
|||
..default()
|
||||
});
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
|
||||
commands.spawn(Camera3dBundle {
|
||||
transform: Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
|
|
|
@ -126,10 +126,8 @@ fn setup(
|
|||
|
||||
commands.spawn((
|
||||
Name::new("Point Light"),
|
||||
PointLightBundle {
|
||||
transform: Transform::from_xyz(4.0, 5.0, 4.0),
|
||||
..default()
|
||||
},
|
||||
PointLight::default(),
|
||||
Transform::from_xyz(4.0, 5.0, 4.0),
|
||||
));
|
||||
|
||||
commands.spawn((
|
||||
|
|
|
@ -94,10 +94,7 @@ fn setup(
|
|||
..default()
|
||||
});
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
transform: Transform::from_xyz(4.0, 5.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((PointLight::default(), Transform::from_xyz(4.0, 5.0, 4.0)));
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
transform: Transform::from_xyz(0.0, 3.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
|
|
|
@ -28,11 +28,10 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
..default()
|
||||
});
|
||||
// light
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight::default(),
|
||||
transform: Transform::from_xyz(4.0, 5.0, 4.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((
|
||||
DirectionalLight::default(),
|
||||
Transform::from_xyz(4.0, 5.0, 4.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
transform: Transform::from_xyz(2.0, 2.0, 6.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
|
|
|
@ -214,14 +214,13 @@ fn setup_scene(
|
|||
});
|
||||
|
||||
// Light
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, 1.0, -PI / 4.)),
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
});
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, 1.0, -PI / 4.)),
|
||||
));
|
||||
|
||||
// Plane
|
||||
commands.spawn((
|
||||
|
|
|
@ -83,14 +83,13 @@ fn setup(
|
|||
});
|
||||
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
transform: Transform::from_xyz(0.0, 1.5, 4.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
|
|
|
@ -128,10 +128,7 @@ fn setup_env(mut commands: Commands) {
|
|||
};
|
||||
|
||||
// lights
|
||||
commands.spawn(PointLightBundle {
|
||||
transform: Transform::from_xyz(4.0, 12.0, 15.0),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((PointLight::default(), Transform::from_xyz(4.0, 12.0, 15.0)));
|
||||
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -59,10 +59,10 @@ fn setup(
|
|||
});
|
||||
|
||||
// light
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((
|
||||
DirectionalLight::default(),
|
||||
Transform::from_xyz(4.0, 8.0, 4.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
|
||||
// example instructions
|
||||
commands.spawn(
|
||||
|
|
|
@ -82,10 +82,8 @@ fn setup(
|
|||
|
||||
commands.spawn((
|
||||
Name::new("Light"),
|
||||
PointLightBundle {
|
||||
transform: Transform::from_xyz(3.0, 8.0, 5.0),
|
||||
..default()
|
||||
},
|
||||
PointLight::default(),
|
||||
Transform::from_xyz(3.0, 8.0, 5.0),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -196,15 +196,12 @@ fn spawn_world_model(
|
|||
|
||||
fn spawn_lights(mut commands: Commands) {
|
||||
commands.spawn((
|
||||
PointLightBundle {
|
||||
point_light: PointLight {
|
||||
color: Color::from(tailwind::ROSE_300),
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(-2.0, 4.0, -0.75),
|
||||
PointLight {
|
||||
color: Color::from(tailwind::ROSE_300),
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
Transform::from_xyz(-2.0, 4.0, -0.75),
|
||||
// The light source illuminates both the world model and the view model.
|
||||
RenderLayers::from_layers(&[DEFAULT_RENDER_LAYER, VIEW_MODEL_RENDER_LAYER]),
|
||||
));
|
||||
|
|
|
@ -93,10 +93,8 @@ fn setup(
|
|||
|
||||
commands.spawn((
|
||||
Name::new("Light"),
|
||||
PointLightBundle {
|
||||
transform: Transform::from_xyz(3.0, 8.0, 5.0),
|
||||
..default()
|
||||
},
|
||||
PointLight::default(),
|
||||
Transform::from_xyz(3.0, 8.0, 5.0),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -109,16 +109,11 @@ fn generate_bodies(
|
|||
},
|
||||
Star,
|
||||
))
|
||||
.with_children(|p| {
|
||||
p.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
color: Color::WHITE,
|
||||
range: 100.0,
|
||||
radius: star_radius,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
});
|
||||
.with_child(PointLight {
|
||||
color: Color::WHITE,
|
||||
range: 100.0,
|
||||
radius: star_radius,
|
||||
..default()
|
||||
});
|
||||
commands.spawn(Camera3dBundle {
|
||||
transform: Transform::from_xyz(0.0, 10.5, -30.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
|
|
|
@ -121,16 +121,15 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
|
|||
game.player.j = BOARD_SIZE_J / 2;
|
||||
game.player.move_cooldown = Timer::from_seconds(0.3, TimerMode::Once);
|
||||
|
||||
commands.spawn(PointLightBundle {
|
||||
transform: Transform::from_xyz(4.0, 10.0, 4.0),
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
intensity: 2_000_000.0,
|
||||
shadows_enabled: true,
|
||||
range: 30.0,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 10.0, 4.0),
|
||||
));
|
||||
|
||||
// spawn the game board
|
||||
let cell_scene =
|
||||
|
@ -355,18 +354,15 @@ fn spawn_bonus(
|
|||
scene: game.bonus.handle.clone(),
|
||||
..default()
|
||||
})
|
||||
.with_children(|children| {
|
||||
children.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
color: Color::srgb(1.0, 1.0, 0.0),
|
||||
intensity: 500_000.0,
|
||||
range: 10.0,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(0.0, 2.0, 0.0),
|
||||
.with_child((
|
||||
PointLight {
|
||||
color: Color::srgb(1.0, 1.0, 0.0),
|
||||
intensity: 500_000.0,
|
||||
range: 10.0,
|
||||
..default()
|
||||
});
|
||||
})
|
||||
},
|
||||
Transform::from_xyz(0.0, 2.0, 0.0),
|
||||
))
|
||||
.id(),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -164,14 +164,11 @@ fn load_level_1(
|
|||
|
||||
// Spawn the light.
|
||||
commands.spawn((
|
||||
DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(3.0, 3.0, 2.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
directional_light: DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
Transform::from_xyz(3.0, 3.0, 2.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
LevelComponents,
|
||||
));
|
||||
}
|
||||
|
@ -207,14 +204,11 @@ fn load_level_2(
|
|||
|
||||
// Spawn the light.
|
||||
commands.spawn((
|
||||
DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(3.0, 3.0, 2.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
directional_light: DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
Transform::from_xyz(3.0, 3.0, 2.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
LevelComponents,
|
||||
));
|
||||
}
|
||||
|
|
|
@ -46,14 +46,13 @@ fn setup(
|
|||
..default()
|
||||
});
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
|
||||
// example instructions
|
||||
commands.spawn(
|
||||
|
|
|
@ -47,14 +47,13 @@ fn setup(
|
|||
let mut rng = ChaCha8Rng::seed_from_u64(19878367467713);
|
||||
|
||||
// Lights...
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(2., 6., 0.),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(2., 6., 0.),
|
||||
));
|
||||
|
||||
// Camera...
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -65,18 +65,17 @@ fn setup(
|
|||
|
||||
// Lights.
|
||||
{
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
range: 2.0,
|
||||
color: DARK_CYAN.into(),
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(0.0, 1.5, 0.0),
|
||||
..default()
|
||||
});
|
||||
commands.spawn(SpotLightBundle {
|
||||
spot_light: SpotLight {
|
||||
Transform::from_xyz(0.0, 1.5, 0.0),
|
||||
));
|
||||
commands.spawn((
|
||||
SpotLight {
|
||||
shadows_enabled: true,
|
||||
range: 3.5,
|
||||
color: PURPLE.into(),
|
||||
|
@ -84,19 +83,17 @@ fn setup(
|
|||
inner_angle: PI / 4.0 * 0.8,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 2.0, 0.0).looking_at(Vec3::X * 1.5, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
Transform::from_xyz(4.0, 2.0, 0.0).looking_at(Vec3::X * 1.5, Vec3::Y),
|
||||
));
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
color: GOLD.into(),
|
||||
illuminance: DirectionalLight::default().illuminance * 0.05,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(-4.0, 2.0, 0.0).looking_at(Vec3::NEG_X * 1.5, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(-4.0, 2.0, 0.0).looking_at(Vec3::NEG_X * 1.5, Vec3::Y),
|
||||
));
|
||||
}
|
||||
|
||||
// Camera.
|
||||
|
|
|
@ -155,17 +155,16 @@ fn setup(
|
|||
));
|
||||
|
||||
// Point light for 3D
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
intensity: 10_000_000.,
|
||||
range: 100.0,
|
||||
shadow_depth_bias: 0.2,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(8.0, 12.0, 1.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(8.0, 12.0, 1.0),
|
||||
));
|
||||
|
||||
// Example instructions
|
||||
commands.spawn(
|
||||
|
|
|
@ -82,14 +82,13 @@ fn setup(
|
|||
});
|
||||
|
||||
// A light:
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
|
||||
// A camera:
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -318,15 +318,14 @@ fn setup_ambient_light(mut ambient_light: ResMut<AmbientLight>) {
|
|||
}
|
||||
|
||||
fn setup_lights(mut commands: Commands) {
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
intensity: 5000.0,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_translation(Vec3::new(-LEFT_RIGHT_OFFSET_3D, 2.0, 0.0))
|
||||
Transform::from_translation(Vec3::new(-LEFT_RIGHT_OFFSET_3D, 2.0, 0.0))
|
||||
.looking_at(Vec3::new(-LEFT_RIGHT_OFFSET_3D, 0.0, 0.0), Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
));
|
||||
}
|
||||
|
||||
/// Marker component for header text
|
||||
|
|
|
@ -314,33 +314,29 @@ fn setup(
|
|||
|
||||
// Lights which work as the bulk lighting of the fireflies:
|
||||
commands.spawn((
|
||||
PointLightBundle {
|
||||
point_light: PointLight {
|
||||
range: 4.0,
|
||||
radius: 0.6,
|
||||
intensity: 1.0,
|
||||
shadows_enabled: false,
|
||||
color: Color::LinearRgba(INSIDE_POINT_COLOR),
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_translation(*translation),
|
||||
PointLight {
|
||||
range: 4.0,
|
||||
radius: 0.6,
|
||||
intensity: 1.0,
|
||||
shadows_enabled: false,
|
||||
color: Color::LinearRgba(INSIDE_POINT_COLOR),
|
||||
..default()
|
||||
},
|
||||
Transform::from_translation(*translation),
|
||||
FireflyLights,
|
||||
));
|
||||
}
|
||||
|
||||
// Global light:
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
color: SKY_COLOR,
|
||||
intensity: 2_000.0,
|
||||
shadows_enabled: false,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
|
||||
// A camera:
|
||||
commands.spawn((
|
||||
|
|
|
@ -88,9 +88,8 @@ fn setup_scene(
|
|||
..default()
|
||||
});
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
intensity: 1_000_000.0,
|
||||
// Shadows makes some Android devices segfault, this is under investigation
|
||||
// https://github.com/bevyengine/bevy/issues/8214
|
||||
|
@ -98,8 +97,8 @@ fn setup_scene(
|
|||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
|
|
|
@ -74,15 +74,14 @@ fn setup(
|
|||
));
|
||||
|
||||
// A light:
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
intensity: 15_000_000.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
|
||||
// A camera:
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -74,14 +74,13 @@ fn setup(
|
|||
println!("{click:?}");
|
||||
});
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
transform: Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
|
|
|
@ -41,14 +41,13 @@ fn setup(
|
|||
));
|
||||
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -36,10 +36,10 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
});
|
||||
|
||||
// light
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(3.0, 2.0, 1.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..Default::default()
|
||||
});
|
||||
commands.spawn((
|
||||
DirectionalLight::default(),
|
||||
Transform::from_xyz(3.0, 2.0, 1.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
|
||||
// camera
|
||||
commands.spawn(Camera3dBundle {
|
||||
|
|
|
@ -22,14 +22,13 @@ fn setup(
|
|||
..default()
|
||||
});
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(0.0, 16.0, 8.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(0.0, 16.0, 8.0),
|
||||
));
|
||||
|
||||
let mesh = meshes.add(Cuboid::from_size(Vec3::splat(0.5)));
|
||||
// This example uses the StandardMaterial but it can work with most custom material too
|
||||
|
|
|
@ -342,11 +342,8 @@ fn setup(
|
|||
Rotates,
|
||||
));
|
||||
// light
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
illuminance: 1_000.,
|
||||
..default()
|
||||
},
|
||||
commands.spawn(DirectionalLight {
|
||||
illuminance: 1_000.,
|
||||
..default()
|
||||
});
|
||||
}
|
||||
|
|
|
@ -49,10 +49,8 @@ fn setup(
|
|||
|
||||
// light
|
||||
commands.spawn((
|
||||
DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(1.0, 1.0, 1.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
},
|
||||
DirectionalLight::default(),
|
||||
Transform::from_xyz(1.0, 1.0, 1.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
Rotate,
|
||||
));
|
||||
|
||||
|
|
|
@ -32,10 +32,7 @@ fn setup(
|
|||
material: standard_materials.add(Color::srgb(0.3, 0.5, 0.3)),
|
||||
..default()
|
||||
});
|
||||
commands.spawn(PointLightBundle {
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((PointLight::default(), Transform::from_xyz(4.0, 8.0, 4.0)));
|
||||
|
||||
commands.spawn(MaterialMeshBundle {
|
||||
mesh: meshes.add(Cuboid::default()),
|
||||
|
|
|
@ -127,14 +127,13 @@ fn setup(
|
|||
});
|
||||
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
|
||||
let style = TextStyle::default();
|
||||
|
||||
|
|
|
@ -255,14 +255,13 @@ fn setup(
|
|||
}
|
||||
}
|
||||
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
shadows_enabled: args.shadows,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::IDENTITY.looking_at(Vec3::new(0.0, -1.0, -1.0), Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
Transform::IDENTITY.looking_at(Vec3::new(0.0, -1.0, -1.0), Vec3::Y),
|
||||
));
|
||||
}
|
||||
|
||||
fn init_textures(args: &Args, images: &mut Assets<Image>) -> Vec<Handle<Image>> {
|
||||
|
|
|
@ -208,20 +208,19 @@ fn setup(
|
|||
});
|
||||
|
||||
// Light
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, 1.0, -PI / 4.)),
|
||||
directional_light: DirectionalLight {
|
||||
commands.spawn((
|
||||
Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, 1.0, -PI / 4.)),
|
||||
DirectionalLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
CascadeShadowConfigBuilder {
|
||||
first_cascade_far_bound: 0.9 * radius,
|
||||
maximum_distance: 2.8 * radius,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
.build(),
|
||||
));
|
||||
|
||||
println!("Animation controls:");
|
||||
println!(" - spacebar: play / pause");
|
||||
|
|
|
@ -78,16 +78,15 @@ fn setup(
|
|||
let spherical_polar_theta_phi = fibonacci_spiral_on_sphere(golden_ratio, i, N_LIGHTS);
|
||||
let unit_sphere_p = spherical_polar_to_cartesian(spherical_polar_theta_phi);
|
||||
|
||||
PointLightBundle {
|
||||
point_light: PointLight {
|
||||
(
|
||||
PointLight {
|
||||
range: LIGHT_RADIUS,
|
||||
intensity: LIGHT_INTENSITY,
|
||||
color: Color::hsl(rng.gen_range(0.0..360.0), 1.0, 0.5),
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_translation((RADIUS as f64 * unit_sphere_p).as_vec3()),
|
||||
..default()
|
||||
}
|
||||
Transform::from_translation((RADIUS as f64 * unit_sphere_p).as_vec3()),
|
||||
)
|
||||
}));
|
||||
|
||||
// camera
|
||||
|
|
|
@ -153,10 +153,10 @@ fn setup_scene_after_load(
|
|||
// Spawn a default light if the scene does not have one
|
||||
if !scene_handle.has_light {
|
||||
info!("Spawning a directional light");
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(1.0, 1.0, 0.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((
|
||||
DirectionalLight::default(),
|
||||
Transform::from_xyz(1.0, 1.0, 0.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
|
||||
scene_handle.has_light = true;
|
||||
}
|
||||
|
|
|
@ -41,10 +41,10 @@ fn setup(
|
|||
});
|
||||
|
||||
// Add a light source so we can see clearly.
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(3.0, 3.0, 3.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((
|
||||
DirectionalLight::default(),
|
||||
Transform::from_xyz(3.0, 3.0, 3.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
}
|
||||
|
||||
// This system will rotate any entity in the scene with a Rotatable component around its y-axis.
|
||||
|
|
|
@ -67,14 +67,13 @@ fn setup(
|
|||
});
|
||||
|
||||
// A light source
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 7.0, -4.0),
|
||||
..default()
|
||||
});
|
||||
Transform::from_xyz(4.0, 7.0, -4.0),
|
||||
));
|
||||
|
||||
// Initialize random axes
|
||||
let first = seeded_rng.gen();
|
||||
|
|
|
@ -57,10 +57,10 @@ fn setup(
|
|||
});
|
||||
|
||||
// Add a light source for better 3d visibility.
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(3.0, 3.0, 3.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((
|
||||
DirectionalLight::default(),
|
||||
Transform::from_xyz(3.0, 3.0, 3.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
}
|
||||
|
||||
// This system will check if a scaled entity went above or below the entities scaling bounds
|
||||
|
|
|
@ -86,10 +86,10 @@ fn setup(
|
|||
});
|
||||
|
||||
// Add a light source for better 3d visibility.
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(3.0, 3.0, 3.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((
|
||||
DirectionalLight::default(),
|
||||
Transform::from_xyz(3.0, 3.0, 3.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
}
|
||||
|
||||
// This system will move the cube forward.
|
||||
|
|
|
@ -55,10 +55,10 @@ fn setup(
|
|||
});
|
||||
|
||||
// Add a light source for better 3d visibility.
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(3.0, 3.0, 3.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((
|
||||
DirectionalLight::default(),
|
||||
Transform::from_xyz(3.0, 3.0, 3.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
}
|
||||
|
||||
// This system will move all Movable entities with a Transform
|
||||
|
|
|
@ -51,7 +51,7 @@ fn setup(
|
|||
let image_handle = images.add(image);
|
||||
|
||||
// Light
|
||||
commands.spawn(DirectionalLightBundle::default());
|
||||
commands.spawn(DirectionalLight::default());
|
||||
|
||||
let texture_camera = commands
|
||||
.spawn(Camera2dBundle {
|
||||
|
|
|
@ -179,10 +179,10 @@ pub(crate) mod test_setup {
|
|||
Rotator,
|
||||
));
|
||||
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
transform: Transform::from_xyz(1.0, 1.0, 1.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
});
|
||||
commands.spawn((
|
||||
DirectionalLight::default(),
|
||||
Transform::from_xyz(1.0, 1.0, 1.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
commands.spawn(Camera3dBundle {
|
||||
transform: Transform::from_xyz(-2.0, 2.0, 2.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
..default()
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue