Repository navigation
feat(viewer): colour elements with no material by their category - #350
Merged
Merged
Conversation
DrunkOnJava
enabled auto-merge (squash)
September 23, 2026 12:53
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_c471d085-a5aa-4aa5-9e00-62041925e192) |
DrunkOnJava
force-pushed
the
feat/viewer-category-colours
branch
from
September 23, 2026 13:19
0574249 to
4396a42
Compare
9 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Sep 23, 2026
…cheme (#352) ## Summary The browser viewer is restyled on one design system, and gains a light scheme that follows the system setting. - A black 56px header over a white sheet with rounded top corners. One blue accent carries every primary action, link, focus ring and selection. - Pill buttons, 8px fields and panels, 12px cards, hairline borders instead of shadows. - Every label is sans serif and sentence case. Figures that line up use tabular numerals, not a monospace face. - The 3D canvas, grid, lights, axes and selection highlight read their colours from the same tokens and switch with the scheme. - The category colours (#350) and the plan export's palette now come from the design system's gray, blue, red, green and amber ramps. Blue-6 is left to the selection highlight. ## Motivation The viewer is the first thing most people see of rvt-rs. It was dark only, with an ad hoc palette and a monospace face on data, and the 3D view drew every category darker than its colour. ## Changes - viewer/src/tokens.css (new): the design system's tokens. The web-font import is left out, so the viewer still makes no network requests, and the two monospace tokens point at the sans face. - viewer/src/styles.css (new): every viewer selector restyled on the tokens. It replaces the 1,180-line inline style block in index.html, and the link colours set inline in the markup. - viewer/src/main.ts: - The scene theme comes from the tokens, rebuilt on a scheme change. - Light intensities are set for three.js physical units: a matte face returns its colour times its light over pi, so the old 0.8 and 0.7 drew every face at about half its colour. - Status, progress and badge copy is sentence case. - viewer/index.html: the wordmark, Export IFC as the one filled primary action, and sentence-case placeholders. - viewer/scripts/stage-demos.mjs: demo thumbnails are flat tiles in the tint of their kind, with a building mark that reads at the card's 72 x 40. - src/ifc/gltf.rs, src/ifc/sheet.rs: palettes on the ramps. The plan's border and label grays match. - The CHANGELOG, including the #350 entry's colour list, and the README's plan-export row. ## Testing - [x] Playwright: all 15 tests pass against Einhoven. The case-sensitive status assertions now expect sentence case. - [x] npm run typecheck and npm run build. - [x] The wasm network-import audit passes. - [x] Light and dark screenshots of the empty state, Einhoven and Core Interior. Each category draws in its token colour. - [x] cargo fmt, clippy -D warnings, rustdoc -D warnings, and the full workspace suite. ## What this does not do - There is no theme toggle in the page. The scheme follows the system; `data-theme` on the root element forces one. - Elements still carry no real materials. The colours are per category. ## Audit-honesty checklist - [x] No capability claims change. - [x] No emojis, private paths or personal data. ## Legal and contribution hygiene - [x] Apache-2.0 - [x] No format-RE content. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Mostly UI, styling, and colour constants; no auth, parsing, or export logic changes beyond palette values and viewer lighting. > > **Overview** > Restyles the browser viewer on a shared **Sonic Console** token set (`viewer/src/tokens.css`, `viewer/src/styles.css`), replacing the large inline stylesheet in `index.html`. The UI follows **system light/dark** (semantic tokens + `prefers-color-scheme` / optional `data-theme`), with a black header, white sheet, pill controls, sentence-case copy, and tabular numerals instead of monospace. > > The **Three.js** scene now reads canvas, grid, lights, axes, and selection colours from those CSS tokens via `applySceneTheme()`, with brighter hemisphere/directional lighting so category colours read closer to their intended sRGB values. > > **Export visuals stay in sync:** `category_colour` in `gltf.rs` and plan SVG strokes/fills in `sheet.rs` move to the same gray/blue/red/green/amber ramps (e.g. doors amber, windows translucent blue); docs and changelog reflect the new hues. Demo gallery thumbnails become flat tinted tiles with a simple building icon (`stage-demos.mjs`). > > Playwright expectations update for sentence-case status strings (`Ready` / `Loaded`). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 70c753d. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The 3D viewer colours each element by its category when it has no material of its own. Record-backed elements carry no material yet, so every model drew as one grey mass.
Now the colours follow the hues of the plan export's existing palette:
Rooms (IfcSpace) are drawn at 12% opacity, so they no longer hide the building they fill. An element's own material, when it has one, still wins.
Changes
Testing
What this does not do
These are category colours, not materials: nothing is claimed about what an element is made of. The palette is a default that can change.
Legal and contribution hygiene
Note
Low Risk
Viewer-only glTF material assignment with no changes to IFC export, auth, or data handling; regression risk is limited to 3D appearance and glTF material counts.
Overview
The 3D glTF export no longer leaves record-backed elements as an undifferentiated grey mass when they have no
material_index. Meshes without an assigned material now get a category fallback that reuses the plan view palette via new publicgltf::category_colour.During
build_gltf, one shared glTF material is created per IFC type (after the model's own materials), with sRGB colours linearised for PBR. Translucent categories (IFCWINDOW,IFCPLATE,IFCSPACE) useBLENDand double-sided rendering so faint rooms and glass-like panels read correctly in the viewer.An element's own material still wins when
material_indexis set. CHANGELOG anddocs/viewer-api.mddocument the behaviour; unit tests cover per-category sharing, door blue / space faint blend, and material precedence.Reviewed by Cursor Bugbot for commit 05742492ad145e09819a338246d3b38080da5011. Configure here.