aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/designer_model.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 06:24:01 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 06:24:01 +0300
commitb0c3a064c29c2bf97981f45806696c2dd0d4dd90 (patch)
treea677357a8519520a49cd4ccad3daa9cfde68d28e /apps/fparkan-game/src/designer_model.rs
parent7b3a106ff7a376b95b3bb9e52d3186ebe1a9bcaa (diff)
downloadfparkan-b0c3a064c29c2bf97981f45806696c2dd0d4dd90.tar.xz
fparkan-b0c3a064c29c2bf97981f45806696c2dd0d4dd90.zip
feat(ui): preview new warbot geometry during a mission
On stock Field Camp, open a compatible Unit DAT created after start, resize the preview, switch to a resident project, reopen the new project, and return to the mission with Vulkan validation clean. The factory reserve for new geometry is still prepared at mission load.
Diffstat (limited to 'apps/fparkan-game/src/designer_model.rs')
-rw-r--r--apps/fparkan-game/src/designer_model.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/fparkan-game/src/designer_model.rs b/apps/fparkan-game/src/designer_model.rs
index 19f3fba2..9bf24600 100644
--- a/apps/fparkan-game/src/designer_model.rs
+++ b/apps/fparkan-game/src/designer_model.rs
@@ -13,7 +13,7 @@ const HALF_FOV: f32 = std::f32::consts::FRAC_PI_6;
pub(super) struct DesignerModels(Vec<Option<DesignerModel>>);
-struct DesignerModel {
+pub(super) struct DesignerModel {
draws: Range<usize>,
counts: Vec<u32>,
center: [f32; 3],
@@ -67,6 +67,14 @@ impl DesignerModels {
}
impl DesignerModel {
+ pub(super) fn uploaded(draws: Range<usize>, center: [f32; 3], radius: f32) -> Self {
+ Self {
+ draws,
+ counts: Vec::new(),
+ center,
+ radius,
+ }
+ }
fn prepare(root: usize, scene: &mut StaticPreviewScene) -> Result<Option<Self>, String> {
let source = scene.dynamic_component_geometry[root]
.iter()
@@ -151,7 +159,7 @@ impl DesignerModel {
}))
}
- fn view(&self, elapsed_ms: u32, drawable: [f32; 2]) -> VulkanModelPreview {
+ pub(super) fn view(&self, elapsed_ms: u32, drawable: [f32; 2]) -> VulkanModelPreview {
let yaw = elapsed_ms as f64 * f64::from(SPIN_RADIANS_PER_MS);
let (sin_yaw, cos_yaw) = yaw.sin_cos();
let (sin_elevation, cos_elevation) = ELEVATION.sin_cos();
@@ -190,6 +198,7 @@ impl DesignerModel {
};
VulkanModelPreview {
ranges: self.draws.clone(),
+ draw_before: None,
viewport,
camera,
eye,