Allow for IfcSurfaceStyleShading.Transparency (IFC4+)#2055
Open
cvillagrasa wants to merge 1 commit into
Open
Conversation
GetColor only read Transparency for IfcSurfaceStyleRendering; a plain IfcSurfaceStyleShading always came out opaque because only its SurfaceColour was read and IfcColourRgb hardcodes alpha 1. Since IFC4, Transparency belongs to IfcSurfaceStyleShading (Rendering inherits it) and sits at argument index 1 in every schema, so the Rendering case handles both entities: merge the two cases. IFC2X3 Shading has a single argument and safely yields a non-REAL token at offset 1, keeping the colour opaque. Adds a spec with inline IFC4 and IFC2X3 models covering Shading with transparency, Rendering with transparency and IFC2X3 plain Shading.
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.
Now, a surface style expressed as a plain
IfcSurfaceStyleShadingwith aTransparencyvalue always renders fully opaque, withGetFlatMeshreporting alpha 1.0. But anIfcSurfaceStyleRenderingworks:It seems to come from
IfcGeometryLoader::GetColor, which readsTransparencyonly in theIFCSURFACESTYLERENDERINGcase. TheIFCSURFACESTYLESHADINGcase reads only attribute 0 (SurfaceColour) and recurses intoIFCCOLOURRGB, which hardcodes alpha 1. That matches IFC2X3, whereIfcSurfaceStyleShadinghad noTransparency, but in IFC4 and IFC4X3 the attribute was moved up fromRenderingtoShading(withRenderinginheriting it).This PR enables
IfcSurfaceStyleShading.Transparencyto also have an effect.tests/functional/ShadingTransparency.spec.tscovers three cases with inline models: IFC4 plain Shading withTransparency 0.8gives mesh alpha 0.2, IFC4 Rendering withTransparency 0.8gives alpha 0.2 (passes before and after), and IFC2X3 single-argument Shading stays at alpha 1.0 with no parse error.