diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 08:03:00 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 08:03:00 +0300 |
| commit | 9bb041a090dab428469647a203a57147a5d09c0b (patch) | |
| tree | 5efbaba33e53c094fa6c0eaafd5c2f5b7bd15b72 /apps | |
| parent | e50b53e7a08d8b5e3393e477b890da95c4c8ef2a (diff) | |
| download | fparkan-9bb041a090dab428469647a203a57147a5d09c0b.tar.xz fparkan-9bb041a090dab428469647a203a57147a5d09c0b.zip | |
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.
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/fparkan-game/src/designer_model.rs | 16 |
1 files changed, 14 insertions, 2 deletions
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<Option<DesignerModel>>); @@ -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, } } } |
