From 9bb041a090dab428469647a203a57147a5d09c0b Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 2 Dec 2026 09:03:00 +0400 Subject: fix(render): use the native lamps in the designer viewport Use the pair of local directional lamps from iron3d.dll and convert their directions into the model coordinates as Terrain.dll does. Keep world point lights out of the model viewport. Verified the light vectors against the native setter and the assembled model in the stock Field Camp Vulkan window. --- apps/fparkan-game/src/designer_model.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'apps/fparkan-game/src') diff --git a/apps/fparkan-game/src/designer_model.rs b/apps/fparkan-game/src/designer_model.rs index 9bf24600..3070a688 100644 --- a/apps/fparkan-game/src/designer_model.rs +++ b/apps/fparkan-game/src/designer_model.rs @@ -3,12 +3,14 @@ use super::{ VulkanSmokeRenderer, VulkanStaticCamera, }; use fparkan_assets::designer_screen::MODEL_VIEWPORT; -use fparkan_render_vulkan::VulkanModelPreview; +use fparkan_render::designer_lighting::{light_directions, ELEVATION, LIGHT_RGB}; +use fparkan_render_vulkan::{ + VulkanDirectionalLight, VulkanModelPreview, VULKAN_DIRECTIONAL_LIGHT_COUNT, +}; use fparkan_runtime::{factory_project_root, factory_project_schemes, Engine}; use std::ops::Range; const SPIN_RADIANS_PER_MS: f32 = f32::from_bits(0x3a449ba6); -const ELEVATION: f32 = 0.5; const HALF_FOV: f32 = std::f32::consts::FRAC_PI_6; pub(super) struct DesignerModels(Vec>); @@ -196,12 +198,22 @@ impl DesignerModel { aspect, ), }; + let mut lights = [VulkanDirectionalLight::default(); VULKAN_DIRECTIONAL_LIGHT_COUNT]; + for (light, direction) in lights.iter_mut().zip(light_directions(yaw)) { + *light = VulkanDirectionalLight { + direction, + rgb: LIGHT_RGB, + active: true, + ..VulkanDirectionalLight::default() + }; + } VulkanModelPreview { ranges: self.draws.clone(), draw_before: None, viewport, camera, eye, + lights, } } } -- cgit v1.2.3