Skip to content

Shape List: per-shape render mode (Solid / Wire / Mesh) #115

Description

@trailcode

Summary

Add a per-shape rendering mode in the Shape List, alongside the existing solid/wire toggle. Include a new mesh / triangulation preview mode that shows the tessellation (the dense line-grid look sometimes seen on OCCT 8 wasm) as an intentional display option.

Must work on all platforms (desktop OpenGL and Emscripten/WebGL), not wasm-only.

Motivation

Shape List today has a binary solid/wire checkbox (AIS_Shaded vs AIS_WireFrame). That is useful but coarse:

  • Solid — Phong-shaded surfaces
  • Wire — B-rep edges only
  • Mesh (new) — triangulation / mesh edges visible (x-ray / analysis aesthetic)

The mesh look appeared accidentally during OCCT 8 wasm shaded-mode work and is visually distinct from wireframe. It should be a first-class, user-selectable mode.

UI proposal

Replace (or extend) the current solid/wire checkbox with a compact control per shape row, e.g.:

  • Dropdown / combo with labels such as: Solid, Wire, Mesh
  • Tooltip on (?) help explaining each mode
  • Same row layout as today: name | visibility | render mode | material

Prefer a dropdown over a third checkbox — scales better if more modes are added later.

Behavior

Mode Expected presentation
Solid Current shaded (AIS_Shaded), no mesh edges
Wire Current wireframe (AIS_WireFrame)
Mesh Shaded or edge-only triangulation overlay; mesh/triangle edges visible, optional reduced/no fill (TBD — match the accidental wasm look where possible)
  • Changing mode should Redisplay the shape immediately (same pattern as material change).
  • Default for new shapes: Solid (unchanged).
  • Hide all and visibility checkbox behavior unchanged.

Persistence

  • Save/load render mode per shape in .ezy JSON (e.g. "render_mode": "solid" | "wire" | "mesh").
  • Today only material is persisted; disp_mode is not — add as part of this work.
  • Backward compatible: missing key → Solid.

Implementation notes

Existing code:

  • Shp::m_disp_mode + set_disp_mode()src/shp.cpp, src/shp.h
  • Shape List UI — src/gui.cpp (~solid/wire checkbox)
  • JSON save/load — src/occt_view.cpp (material only today)

Mesh mode (OCCT):

  • Likely stays on AIS_Shaded with drawer/aspect tweaks, e.g. Graphic3d_AspectFillArea3d::SetDrawEdges(true) and/or iso-line settings on Prs3d_Drawer
  • May require BRepMesh_IncrementalMesh before display so triangulation exists
  • Verify identical behavior on desktop and wasm; do not rely on wasm bug side effects

Refactor suggestion:

  • Introduce an app-level enum (e.g. Shp_render_mode) mapped to OCCT display + aspect setup, rather than overloading AIS_DisplayMode alone.

Acceptance criteria

  • Shape List shows render mode control (dropdown or equivalent) per shape
  • Solid, Wire, and Mesh modes work on Windows desktop and wasm
  • Mode persists in .ezy and restores on File → Open / undo-redo
  • New shapes default to Solid
  • No regression to material picker, visibility, or selection

Out of scope (separate issues)

  • Fixing OCCT 8 wasm first-display shaded bug (if it remains after Solid mode work)
  • Global default render mode in Settings (could follow later)

Related

  • Shape List solid/wire checkbox: src/gui.cpp
  • Shp::set_disp_mode(): src/shp.cpp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions