mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-28 15:53:00 +00:00
Let the viewport composite over what is behind it
Background colour gains a meaningful alpha. Below 1 the viewport composites over whatever the host has stacked behind it rather than painting a colour of its own; at 0 it clears to nothing, so the model draws over another 3D view, a map, or ordinary page content. There is no depth interaction -- the layer behind is strictly behind and cannot occlude the model. Honouring the alpha needs a premultiplied surface. configureSurface asks for one only when the platform advertises it, the same way it picks a present mode, and falls back to Auto otherwise -- this machine's Vulkan surface offers opaque compositing only, so hardcoding premultiplied would have requested a mode it does not support. The clear follows that choice: scaled by alpha when premultiplied, held at 1 when not, since scaling would otherwise just darken the colour for an alpha nobody reads. ViewportWindow::setBackgroundColor now forwards to core rather than writing through a reference proxy, dropping one more member from the friend declaration it is meant to shrink. The screenshot QImage is tagged premultiplied to match what the main pass leaves in the buffer. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -635,6 +635,15 @@ extern "C" EMSCRIPTEN_KEEPALIVE void ifcv_set_ortho_c(int on) {
|
||||
if (bool(on) != g_app->core.projectionOrtho()) g_app->core.toggleProjection();
|
||||
}
|
||||
|
||||
// Background colour, RGBA in [0..1]. Alpha 0 clears the canvas to nothing, so
|
||||
// whatever the host page has stacked behind it shows through. See
|
||||
// ViewportCore::setBackgroundColor.
|
||||
extern "C" EMSCRIPTEN_KEEPALIVE void ifcv_set_background_c(float r, float g,
|
||||
float b, float a) {
|
||||
if (!g_app || !g_app->ready) return;
|
||||
g_app->core.setBackgroundColor(r, g, b, a);
|
||||
}
|
||||
|
||||
// Mouse navigation scheme: "blender" | "rhino" | "revit" | "web". The preset
|
||||
// only rewrites the button/modifier table classifyPress reads, so unlike the
|
||||
// rest of the scripting API it does not need the GPU app to be live — a host
|
||||
|
||||
Reference in New Issue
Block a user