diff --git a/mini-game/assets/shaders/post_processing.wgsl b/mini-game/assets/shaders/post_processing.wgsl index 8110b66..bc47c65 100644 --- a/mini-game/assets/shaders/post_processing.wgsl +++ b/mini-game/assets/shaders/post_processing.wgsl @@ -50,9 +50,8 @@ fn fragment(in: FullscreenVertexOutput) -> @location(0) vec4 { let x: i32 = i32(uvx * settings.scale) % 8; let y: i32 = i32(uvy * settings.scale) % 8; - let final_gray = find_closest(x, y, grayscale); /// not even used?! + let final_gray = find_closest(x, y, grayscale); - // Sample each color channel with an arbitrary shift return vec4( final_gray, final_gray, final_gray, 0.0 ); diff --git a/mini-game/src/main.rs b/mini-game/src/main.rs index 1d22674..a81fff0 100644 --- a/mini-game/src/main.rs +++ b/mini-game/src/main.rs @@ -1,9 +1,10 @@ -use std::f32::consts::PI; +use std::f32::consts::*; use std::time::Duration; use bevy::app::ScheduleRunnerPlugin; use bevy::camera::RenderTarget; use bevy::color::Color; +use bevy::color::palettes::css::WHITE; use bevy::prelude::*; use wgpu::{TextureFormat, TextureUsages}; @@ -12,12 +13,11 @@ mod post_process; use crate::post_process::PostProcessSettings; use crate::renderer::{G13Resource, ImageExport, ImageExportPlugin, ImageExportSource}; -use crate::shared::Spinner; mod renderer; mod shared; -const USE_G13: bool = false; +const USE_G13: bool = true; fn main() { let mut app = App::new(); @@ -42,14 +42,20 @@ fn main() { ))); } - app.insert_resource(ClearColor(Color::linear_rgba(0.0, 0.0, 0.0, 0.0))) - .add_systems(Startup, (setup_camera, shared::spawn_3d_scene)) + app.insert_resource(GlobalAmbientLight { + color: WHITE.into(), + brightness: 400.0, + ..default() + }); + + app.insert_resource(ClearColor(Color::linear_rgba(0.01, 0.01, 0.01, 1.0))) + .add_systems(Startup, (setup_player, shared::spawn_3d_scene)) // .add_systems(PostStartup, spawn_ui) - .add_systems(Update, rotate_cube) + .add_systems(Update, camera_controller) .run(); } -fn setup_camera( +fn setup_player( mut commands: Commands, mut images: ResMut>, mut export_sources: ResMut>, @@ -57,7 +63,7 @@ fn setup_camera( let mut camera_commands = commands.spawn(( Camera3d::default(), Camera::default(), - Transform::from_xyz(0.0, 1.0, 2.5).looking_at(Vec3::ZERO, Vec3::Y), + Transform::from_xyz(0.0, 1.0, 2.5), UiAntiAlias::Off, bevy::core_pipeline::prepass::DepthPrepass, bevy::core_pipeline::prepass::NormalPrepass, @@ -68,6 +74,19 @@ fn setup_camera( ..default() }, PostProcessSettings { scale: 1.0 }, + children![ + SpotLight { + color: Color::WHITE, + intensity: light_consts::lumens::VERY_LARGE_CINEMA_LIGHT * 5.0, + range: 32.0, + inner_angle: FRAC_PI_8, + outer_angle: FRAC_PI_2, + shadows_enabled: true, + affects_lightmapped_mesh_diffuse: true, + ..default() + }, + Transform::from_xyz(0., 0., 0.), + ], )); if USE_G13 { @@ -115,13 +134,18 @@ fn setup_camera( // )); // } -fn rotate_cube( - mut cubes: Query<(&mut Transform, &Spinner)>, +fn camera_controller( + camera: Single<(&mut Transform), With>, timer: Res