Пример #1
0
        private void AddColour(IfcSurfaceStyleRendering rendering)
        {
            if (rendering.DiffuseColour is IfcNormalisedRatioMeasure)
            {
                ColourMap.Add(new XbimColour(
                    rendering.SurfaceColour,
                    rendering.Transparency.HasValue ? 1.0 - rendering.Transparency.Value : 1.0,
                    (IfcNormalisedRatioMeasure)rendering.DiffuseColour
                    ));

            }
            else if (rendering.DiffuseColour is IfcColourRgb)
            {
                ColourMap.Add(new XbimColour(
                    (IfcColourRgb)rendering.DiffuseColour,
                    rendering.Transparency.HasValue ? 1.0 - rendering.Transparency.Value : 1.0
                    ));

            }
            else if (rendering.DiffuseColour == null)
            {
                ColourMap.Add(new XbimColour(
                    rendering.SurfaceColour,
                    rendering.Transparency.HasValue ? 1.0 - rendering.Transparency.Value : 1.0
                    ));
            }
            else if (rendering.SpecularColour is IfcNormalisedRatioMeasure) //getting key duplication on some ifc models so add else if
            {
                ColourMap.Add(new XbimColour(
                    rendering.SurfaceColour,
                    rendering.Transparency.HasValue ? 1.0 - rendering.Transparency.Value : 1.0,
                    1.0,
                    (IfcNormalisedRatioMeasure)(rendering.SpecularColour)
                    ));
            }
            else if (rendering.SpecularColour is IfcColourRgb)
            {
                ColourMap.Add(new XbimColour(
                    (IfcColourRgb)rendering.SpecularColour,
                    rendering.Transparency.HasValue ? 1.0 - rendering.Transparency.Value : 1.0
                    ));

            }
        }
Пример #2
0
 public XbimTexture CreateTexture(IfcSurfaceStyleRendering rendering)
 {
     DefinedObjectId = (int)rendering.EntityLabel;
     ColourMap.Clear();
     AddColour(rendering);
     return this;
 }
Пример #3
0
 public XbimTexture CreateTexture(IfcSurfaceStyleRendering rendering)
 {
     ColourMap.Clear();
     AddColour(rendering);
     return this;
 }