From 07587532729544157bbe9b581f5d9a46315f5ffc Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Sun, 1 Jun 2025 16:25:54 +0300 Subject: [PATCH] feat(demo): simplify lighting --- crates/bevy_dice_demo/Cargo.toml | 2 ++ crates/bevy_dice_demo/src/main.rs | 35 +++++++++++-------------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/crates/bevy_dice_demo/Cargo.toml b/crates/bevy_dice_demo/Cargo.toml index 4d4ace0..8127670 100644 --- a/crates/bevy_dice_demo/Cargo.toml +++ b/crates/bevy_dice_demo/Cargo.toml @@ -15,6 +15,8 @@ bevy_dice = { path = "../bevy_dice" } avian3d = { version = "0.3", default-features = false } bevy = { version = "0.16", default-features = false, features = [ "async_executor", + "bevy_core_pipeline", + "bevy_pbr", "bevy_render", "bevy_state", "bevy_window", diff --git a/crates/bevy_dice_demo/src/main.rs b/crates/bevy_dice_demo/src/main.rs index a7fa0df..a252cba 100644 --- a/crates/bevy_dice_demo/src/main.rs +++ b/crates/bevy_dice_demo/src/main.rs @@ -4,16 +4,10 @@ * This file is licensed under MIT, see LICENSE for more information. */ -use std::{collections::HashMap, f32::consts::PI}; +use std::collections::HashMap; use avian3d::prelude::*; -use bevy::{ - asset::LoadState, - core_pipeline::bloom::Bloom, - pbr::{Atmosphere, light_consts::lux::RAW_SUNLIGHT}, - prelude::*, - render::camera::Exposure, -}; +use bevy::{asset::LoadState, prelude::*}; use bevy_dice::{DicePlugin, DicePluginConfig, Die, DieVariant, ThrowDie}; use bevy_egui::{EguiContextPass, EguiContexts, EguiPlugin, egui}; use bevy_embedded_assets::EmbeddedAssetPlugin; @@ -65,7 +59,7 @@ fn main() { app.init_resource::() .add_systems(EguiContextPass, ui); - app.add_systems(Update, rotate_sun); + app.add_systems(Update, rotate_light); app.add_observer(despawn_dice); @@ -109,24 +103,16 @@ fn setup( )); commands.spawn(( - DirectionalLight { + PointLight { shadows_enabled: true, - illuminance: RAW_SUNLIGHT, ..default() }, - Transform::from_xyz(1.0, 3.0, 0.0).looking_at(Vec3::ZERO, Vec3::Y), + Transform::from_xyz(4.0, 8.0, 0.0), )); commands.spawn(( Camera3d::default(), - Camera { - hdr: true, - ..Default::default() - }, Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Dir3::Y), - Atmosphere::EARTH, - Exposure::SUNLIGHT, - Bloom::NATURAL, )); commands.insert_resource(DicePluginConfig { @@ -218,8 +204,11 @@ fn despawn_dice( } } -fn rotate_sun(mut q_suns: Query<&mut Transform, With>, r_time: Res