From c20d5b21e1419c81fc85cbe8851f074d7b2cd42a Mon Sep 17 00:00:00 2001 From: minsung Date: Tue, 14 Apr 2026 19:42:23 +0900 Subject: [PATCH] =?UTF-8?q?viewer:=20--features=20occt=20=EC=8B=9C=20OcctK?= =?UTF-8?q?ernel=20B-rep=20=EB=A0=8C=EB=8D=94=EB=A7=81=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - viewer/Cargo.toml: occt feature → cimery-kernel/occt 전파 - lib.rs: cfg(feature = "occt") 분기 - OcctKernel: OCCT B-rep PSC-I + BRepMesh 테셀레이션 - PureRustKernel: 기본값 (occt 없을 때) - 타이틀 자동: "OcctKernel B-rep" vs "PSC-I PureRustKernel" Co-Authored-By: Claude Opus 4.6 (1M context) --- cimery/crates/viewer/Cargo.toml | 5 +++++ cimery/crates/viewer/src/lib.rs | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cimery/crates/viewer/Cargo.toml b/cimery/crates/viewer/Cargo.toml index 1014301..1a224a2 100644 --- a/cimery/crates/viewer/Cargo.toml +++ b/cimery/crates/viewer/Cargo.toml @@ -3,6 +3,11 @@ name = "cimery-viewer" version.workspace = true edition.workspace = true +[features] +# Enable OcctKernel (requires OCCT — see cimery/CLAUDE.md). +# Build: cargo run -p cimery-viewer --features occt +occt = ["cimery-kernel/occt"] + [[bin]] name = "cimery-viewer" path = "src/main.rs" diff --git a/cimery/crates/viewer/src/lib.rs b/cimery/crates/viewer/src/lib.rs index af0f16f..f157057 100644 --- a/cimery/crates/viewer/src/lib.rs +++ b/cimery/crates/viewer/src/lib.rs @@ -25,7 +25,11 @@ use winit::{ use wgpu::util::DeviceExt; use cimery_core::{MaterialGrade, SectionType}; use cimery_ir::{FeatureId, GirderIR, PscISectionParams, SectionParams}; -use cimery_kernel::{GeomKernel, PureRustKernel}; +#[cfg(feature = "occt")] +use cimery_kernel::OcctKernel; +#[cfg(not(feature = "occt"))] +use cimery_kernel::PureRustKernel; +use cimery_kernel::GeomKernel; use camera::Camera; // ─── Vertex ─────────────────────────────────────────────────────────────────── @@ -148,7 +152,9 @@ impl RenderState { spacing: 0.0, material: MaterialGrade::C50, }; - // Sprint 3: replace PureRustKernel with OcctKernel (--features occt) + #[cfg(feature = "occt")] + let mesh = OcctKernel.girder_mesh(&test_ir).expect("OcctKernel mesh"); + #[cfg(not(feature = "occt"))] let mesh = PureRustKernel.girder_mesh(&test_ir).expect("PureRustKernel mesh"); let verts: Vec = mesh.vertices.iter().zip(mesh.normals.iter()) @@ -377,7 +383,11 @@ impl Default for CimeryApp { impl ApplicationHandler for CimeryApp { fn resumed(&mut self, event_loop: &ActiveEventLoop) { let attrs = Window::default_attributes() - .with_title("cimery viewer [Sprint 2 — PSC-I PureRustKernel]") + .with_title(if cfg!(feature = "occt") { + "cimery viewer [Sprint 3 — OcctKernel B-rep]" + } else { + "cimery viewer [Sprint 2 — PSC-I PureRustKernel]" + }) .with_inner_size(winit::dpi::LogicalSize::new(1280u32, 720u32)); let window = Arc::new( event_loop.create_window(attrs).expect("create window"),