feat(render): phase 0 — render-mode pick_list + 3-flag pipeline plumbing
Replaces the binary Wireframe/Solid toggle with a 7-mode dropdown that maps onto acadrust's `ViewportRenderMode` enum: Wireframe 2D / Wireframe 3D / Hidden Line / Flat Shaded / Gouraud Shaded / Flat Shaded + Edges / Gouraud Shaded + Edges. Per-tab state lives on `DocumentTab::render_mode`; the old `SetWireframe` message forwards to `SetRenderMode` so the ribbon + WIREFRAME / SOLID command line keep working. `scene::render::render_mode_flags()` translates the mode into three pipeline-facing booleans (`face3d_fill`, `mesh_fill`, `show_3d_edges`); `mesh_fill` / `show_3d_edges` are stubs that the upcoming phases will consume. `Primitive` carries the derived `view_wireframe` plus the two new fields through to `prepare()`. `Pipeline::upload_face3d` takes a `wireframe_only` flag that drops 3DFACE quad fills (built from `key_vertices`) while keeping the `all_wires.fill_tris` channel — that channel carries text-LOD greek rectangles and PolyfaceMesh face triangles which must stay visible in wireframe mode. 3DFACE edges stay on regardless of mode. Solid3D mesh wireframe rendering, Hidden Line z-prepass, and Flat / Gouraud shader uniforms come in phases 1–4. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
5ea996d5fe
commit
2145ab8a66
8 changed files with 273 additions and 90 deletions
|
|
@ -654,19 +654,41 @@ impl OpenCADStudio {
|
|||
}
|
||||
|
||||
Message::SetWireframe(w) => {
|
||||
let i = self.active_tab;
|
||||
self.tabs[i].wireframe = w;
|
||||
self.ribbon.set_wireframe(w);
|
||||
self.tabs[i].visual_style = if w {
|
||||
"Wireframe".into()
|
||||
// Back-compat shim: forward to the new render-mode path so
|
||||
// the ribbon button + WIREFRAME / SOLID command line still
|
||||
// work without duplicating the rendering plumbing.
|
||||
let mode = if w {
|
||||
acadrust::entities::ViewportRenderMode::Wireframe2D
|
||||
} else {
|
||||
"Shaded".into()
|
||||
acadrust::entities::ViewportRenderMode::FlatShaded
|
||||
};
|
||||
self.command_line.push_output(if w {
|
||||
"Visual style: Wireframe"
|
||||
} else {
|
||||
"Visual style: Shaded"
|
||||
});
|
||||
Task::done(Message::SetRenderMode(mode))
|
||||
}
|
||||
|
||||
Message::SetRenderMode(mode) => {
|
||||
use acadrust::entities::ViewportRenderMode as M;
|
||||
let i = self.active_tab;
|
||||
self.tabs[i].render_mode = mode;
|
||||
// Keep the legacy `wireframe` bool synced — both wireframe
|
||||
// modes set it, everything else clears it.
|
||||
let wf = matches!(mode, M::Wireframe2D | M::Wireframe3D);
|
||||
self.tabs[i].wireframe = wf;
|
||||
self.ribbon.set_wireframe(wf);
|
||||
let label = match mode {
|
||||
M::Wireframe2D => "Wireframe 2D",
|
||||
M::Wireframe3D => "Wireframe 3D",
|
||||
M::HiddenLine => "Hidden Line",
|
||||
M::FlatShaded => "Flat Shaded",
|
||||
M::GouraudShaded => "Gouraud Shaded",
|
||||
M::FlatShadedWithEdges => "Flat Shaded + Edges",
|
||||
M::GouraudShadedWithEdges => "Gouraud Shaded + Edges",
|
||||
};
|
||||
self.tabs[i].visual_style = label.into();
|
||||
// Re-upload face3d fills on the next frame — the render
|
||||
// pipeline keys its upload cache off `geometry_epoch`.
|
||||
self.tabs[i].scene.bump_geometry();
|
||||
self.command_line
|
||||
.push_output(&format!("Visual style: {label}"));
|
||||
Task::none()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue