Lands the Render workspace (R3), bounded preview-image jobs with cancellation and atomic PNG export (R4a), and opaque PBR looks as one change. - Render workspace: an overlay-free product preview on the installed GPU device. Returning to Design restores its camera. render.scene and render.settings.apply are added. - Image jobs: render.preflight/start/status/cancel/export run bounded CPU preview jobs. Export captures the job, overwrite choice and document, and checks the caller's file scope before writing. - Opaque PBR: looks can carry metal fraction, roughness and dielectric IOR. The product viewport and preview PNG use them; geometry and mass are unchanged. The v1 catalog export refuses PBR rather than dropping it. - Render setups and PBR looks are saved under design format 21. Labels are in en/de/ja/ko/zh/ru. Supersedes #706 and #800. Refs #620, #673, #756, #1004. Contributed by @0xlillith. Co-authored-by: lillith <[email protected]>
43 lines
1.2 KiB
Rust
43 lines
1.2 KiB
Rust
//! Renderer-independent product geometry. No modelling overlays or device resources.
|
|
|
|
use std::sync::Arc;
|
|
|
|
use solidcraft_geom::{Aabb3, Mesh};
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct FaceAppearance {
|
|
/// The existing mesh's B-rep face index, resolved by the document's appearance policy.
|
|
pub face: u32,
|
|
pub color: [u8; 3],
|
|
pub opacity: f64,
|
|
pub surface: Option<crate::surface::OpaqueSurface>,
|
|
}
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub struct ProductMesh {
|
|
/// Existing computed body name, including occurrence identity where applicable.
|
|
pub name: String,
|
|
/// Established world-space mesh. Adapters must not apply occurrence transforms again.
|
|
pub mesh: Arc<Mesh>,
|
|
pub color: [u8; 3],
|
|
pub opacity: f64,
|
|
pub surface: Option<crate::surface::OpaqueSurface>,
|
|
pub faces: Vec<FaceAppearance>,
|
|
}
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub struct ProductScene {
|
|
pub meshes: Vec<ProductMesh>,
|
|
pub bounds: Aabb3,
|
|
}
|
|
|
|
impl ProductScene {
|
|
pub fn required_features(&self) -> Vec<crate::RenderFeature> {
|
|
if self.meshes.iter().any(|m| m.surface.is_some() || m.faces.iter().any(|f| f.surface.is_some())) {
|
|
vec![crate::RenderFeature::Pbr]
|
|
} else {
|
|
Vec::new()
|
|
}
|
|
}
|
|
}
|