tirbofish/dropbear · diff
fix: general bug fixes with textures. refactor officially done, time to merge Unverified
@@ -271,7 +271,10 @@ impl Light { label: Option<&str>, ) -> Self { let forward = DVec3::new(0.0, 0.0, -1.0); - let direction = transform.rotation * forward; + let mut direction = transform.rotation * forward; + if matches!(light.light_type, LightType::Directional) { + direction = -direction; + } let uniform = LightUniform { position: dvec3_to_uniform_array(transform.position), @@ -340,7 +343,10 @@ impl Light { self.uniform.position = dvec3_to_uniform_array(transform.position); let forward = DVec3::new(0.0, 0.0, -1.0); - let direction = transform.rotation * forward; + let mut direction = transform.rotation * forward; + if matches!(light.light_type, LightType::Directional) { + direction = -direction; + } self.uniform.direction = dvec3_direction_to_uniform_array(direction, light.outer_cutoff_angle); @@ -71,8 +71,8 @@ impl DropbearShaderPipeline for LightCubePipeline { primitive: wgpu::PrimitiveState { topology: wgpu::PrimitiveTopology::TriangleList, strip_index_format: None, - front_face: wgpu::FrontFace::Ccw, - cull_mode: Some(wgpu::Face::Back), + front_face: wgpu::FrontFace::Cw, + cull_mode: Some(wgpu::Face::Back), polygon_mode: wgpu::PolygonMode::Fill, unclipped_depth: false, conservative: false, @@ -66,7 +66,7 @@ impl DropbearShaderPipeline for MainRenderPipeline { primitive: wgpu::PrimitiveState { topology: wgpu::PrimitiveTopology::TriangleList, strip_index_format: None, - front_face: wgpu::FrontFace::Ccw, + front_face: wgpu::FrontFace::Cw, cull_mode: Some(wgpu::Face::Back), polygon_mode: wgpu::PolygonMode::Fill, unclipped_depth: false, @@ -723,7 +723,7 @@ pub async fn build_jvm( let gradle_cmd = get_gradle_command(project_root); - let _ = status_sender.send(BuildStatus::Building(format!("Running: {}", gradle_cmd))); + let _ = status_sender.send(BuildStatus::Building(format!("Running: {} fatJar", gradle_cmd))); let mut child = Command::new(&gradle_cmd) .current_dir(project_root) @@ -2,7 +2,7 @@ use std::sync::Arc; use std::collections::HashMap; use dropbear_engine::pipelines::DropbearShaderPipeline; -use eucalyptus_core::egui::{CentralPanel, MenuBar, TopBottomPanel}; +use eucalyptus_core::egui::CentralPanel; use eucalyptus_core::physics::collider::ColliderGroup; use eucalyptus_core::physics::collider::ColliderShapeKey; use eucalyptus_core::physics::collider::shader::ColliderInstanceRaw; @@ -367,10 +367,10 @@ impl Scene for PlayMode { if let Some(l) = &mut self.light_cube_pipeline { l.update(graphics.clone(), &self.world); } - + #[cfg(feature = "debug")] - TopBottomPanel::top("menu_bar").show(&graphics.get_egui_context(), |ui| { - MenuBar::new().ui(ui, |ui| { + egui::TopBottomPanel::top("menu_bar").show(&graphics.get_egui_context(), |ui| { + egui::MenuBar::new().ui(ui, |ui| { ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { ui.group(|ui| { ui.add_enabled_ui(true, |ui| { @@ -564,11 +564,29 @@ impl Scene for PlayMode { } { + let _ = frame_ctx.encoder.begin_render_pass(&wgpu::RenderPassDescriptor { + label: Some("runtime surface clear pass"), + color_attachments: &[Some(wgpu::RenderPassColorAttachment { + view: &frame_ctx.view, + depth_slice: None, + resolve_target: None, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(clear_color), + store: wgpu::StoreOp::Store, + }, + })], + depth_stencil_attachment: None, + occlusion_query_set: None, + timestamp_writes: None, + }); + } + + { let mut render_pass = frame_ctx.encoder .begin_render_pass(&wgpu::RenderPassDescriptor { label: Some("light cube render pass"), color_attachments: &[Some(wgpu::RenderPassColorAttachment { - view: &frame_ctx.view, + view: &graphics.viewport_texture.view, depth_slice: None, resolve_target: None, ops: wgpu::Operations { @@ -619,7 +637,7 @@ impl Scene for PlayMode { .begin_render_pass(&wgpu::RenderPassDescriptor { label: Some("model render pass"), color_attachments: &[Some(wgpu::RenderPassColorAttachment { - view: &frame_ctx.view, + view: &graphics.viewport_texture.view, depth_slice: None, resolve_target: None, ops: wgpu::Operations { @@ -668,7 +686,7 @@ impl Scene for PlayMode { .begin_render_pass(&wgpu::RenderPassDescriptor { label: Some("model render pass"), color_attachments: &[Some(wgpu::RenderPassColorAttachment { - view: &frame_ctx.view, + view: &graphics.viewport_texture.view, depth_slice: None, resolve_target: None, ops: wgpu::Operations {