viewer: --features occt 시 OcctKernel B-rep 렌더링 연결

- 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) <noreply@anthropic.com>
This commit is contained in:
minsung
2026-04-14 19:42:23 +09:00
parent 0bc3f12688
commit c20d5b21e1
2 changed files with 18 additions and 3 deletions

View File

@@ -3,6 +3,11 @@ name = "cimery-viewer"
version.workspace = true version.workspace = true
edition.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]] [[bin]]
name = "cimery-viewer" name = "cimery-viewer"
path = "src/main.rs" path = "src/main.rs"

View File

@@ -25,7 +25,11 @@ use winit::{
use wgpu::util::DeviceExt; use wgpu::util::DeviceExt;
use cimery_core::{MaterialGrade, SectionType}; use cimery_core::{MaterialGrade, SectionType};
use cimery_ir::{FeatureId, GirderIR, PscISectionParams, SectionParams}; 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; use camera::Camera;
// ─── Vertex ─────────────────────────────────────────────────────────────────── // ─── Vertex ───────────────────────────────────────────────────────────────────
@@ -148,7 +152,9 @@ impl RenderState {
spacing: 0.0, spacing: 0.0,
material: MaterialGrade::C50, 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 mesh = PureRustKernel.girder_mesh(&test_ir).expect("PureRustKernel mesh");
let verts: Vec<Vertex> = mesh.vertices.iter().zip(mesh.normals.iter()) let verts: Vec<Vertex> = mesh.vertices.iter().zip(mesh.normals.iter())
@@ -377,7 +383,11 @@ impl Default for CimeryApp {
impl ApplicationHandler for CimeryApp { impl ApplicationHandler for CimeryApp {
fn resumed(&mut self, event_loop: &ActiveEventLoop) { fn resumed(&mut self, event_loop: &ActiveEventLoop) {
let attrs = Window::default_attributes() 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)); .with_inner_size(winit::dpi::LogicalSize::new(1280u32, 720u32));
let window = Arc::new( let window = Arc::new(
event_loop.create_window(attrs).expect("create window"), event_loop.create_window(attrs).expect("create window"),