Expand description
Visibility, colour, opacity, and glTF PBR materials (ifcx_alpha).
NodePresentation::from_attributes decodes one node’s own presentation
attributes. The functions is_visible, resolve_basic_material, and
resolve_mesh_material apply the precedence of the upstream reference
viewer (src/viewer/render.ts at buildingSMART/IFC5-development
1a63082) to a node and its ancestors. crate::scene applies them
while walking a composed tree, dropping invisible subtrees.
| Attribute | Value |
|---|---|
usd::usdgeom::visibility | {"visibility": "inherited" | "invisible"} |
bsi::ifc::presentation::diffuseColor | [r, g, b], linear, 0..=1 |
bsi::ifc::presentation::opacity | number, 0..=1 |
gltf::material | glTF 2.0 material subset, see GltfMaterial |
§Material bindings
In ifcx_alpha a node binds a material by inheriting from the material
node ("inherits": {"material": "<path>"}); composition then gives the node
the material’s bsi::ifc::presentation::* and gltf::material attributes.
The pre-alpha usd::usdshade::material::outputs::surface connections were
converted to that form upstream: no upstream example uses them, and the
reference viewer only lists the name for an outline icon. They are
therefore not read here.
§Precedence
Given a node followed by its ancestors, nearest first:
- A node is drawn only if neither it nor any ancestor is
invisible. - A mesh uses the
gltf::materialof the nearest node that has one, with glTF defaults for missing factors, and ignores thebsi::ifc::presentationattributes. - Otherwise, and always for curves, colour comes from the nearest node
with
diffuseColor, and opacity from that same node only. Without anydiffuseColorthe colour isBasicMaterial::DEFAULT, grey 0.6 and opaque.
Point clouds use neither; they carry their own per-point colours.
Three choices differ from the reference viewer where its behaviour follows from JavaScript truthiness or branch order rather than intent:
- Opacity
0is fully transparent; the viewer skips falsy opacity values and draws such objects opaque. visibility: "inherited"hides nothing; the viewer also skips the geometry of any node that merely has the attribute.- A
gltf::materialwhose members are allfalseor0still selects PBR; the viewer skips it.
Structs§
- Basic
Material - Colour and opacity from
bsi::ifc::presentation. - Gltf
Material - A
gltf::materialvalue with glTF 2.0 defaults filled in. - Node
Presentation - One node’s own presentation attributes, before any inheritance.
- Normal
Texture - A normal map reference. The texture is recorded, not loaded.
- Occlusion
Texture - An occlusion map reference. The texture is recorded, not loaded.
Enums§
- Alpha
Mode - glTF
alphaMode. - Material
- The material a mesh is drawn with.
- Visibility
- USD visibility token of one node.
Constants§
- DIFFUSE_
COLOR - Attribute id of the IFC diffuse colour.
- GLTF_
MATERIAL - Attribute id of a glTF PBR material.
- OPACITY
- Attribute id of the IFC opacity.
- VISIBILITY
- Attribute id of USD visibility.
Functions§
- is_
visible - Whether a node is drawn, given whether its parent is (
truefor a root) and the node’s own visibility. Aninvisiblenode hides its subtree; a descendant cannot become visible again. - resolve_
basic_ material - Colour and opacity for a node, from the node and its ancestors given
nearest first. The nearest
diffuseColorwins, and opacity comes from that same node (default 1); an opacity on a node withoutdiffuseColoris not used. Used for curves, and for meshes without a glTF material. - resolve_
mesh_ material - The material for a mesh node, from the node and its ancestors given
nearest first. The nearest
gltf::materialwins over anybsi::ifc::presentationattribute; without one, seeresolve_basic_material.