public static IEnumerable <ColorOrNormalised> ToColorChannel(this IIfcSurfaceStyleShading ss) { return(new ColorOrNormalised[] { new ColorOrNormalised() { Channel = ColorChannel.Albedo, Color = ss.SurfaceColour.ToColor(1.0f - (float)(ss.Transparency ?? 0)) } }); }
private void AddColour(IIfcSurfaceStyleShading shading) { var alpha = 1.0; if (shading.Transparency.HasValue) { alpha = 1.0 - (double)(shading.Transparency); } ColourMap.Add(new XbimColour(shading.SurfaceColour, alpha)); }
private XbimTexture CreateTexture(IIfcSurfaceStyleShading shading) { DefinedObjectId = shading.EntityLabel; ColourMap.Clear(); if (shading is IIfcSurfaceStyleRendering) { AddColour((IIfcSurfaceStyleRendering)shading); } else { AddColour(shading); } return(this); }
public static Material ToMaterial(this IIfcSurfaceStyleShading shading) { if (shading is IIfcSurfaceStyleRendering) { return(((IIfcSurfaceStyleRendering)shading).ToMaterial()); } byte red = Convert.ToByte(shading.SurfaceColour.Red * 255); byte green = Convert.ToByte(shading.SurfaceColour.Green * 255); byte blue = Convert.ToByte(shading.SurfaceColour.Blue * 255); Color col = Color.FromRgb(red, green, blue); Brush brush = new SolidColorBrush(col); Material mat = new DiffuseMaterial(brush); return(mat); }
public static XbimTexture Create(IIfcSurfaceStyleShading shading) { var texture = new XbimTexture(); return(texture.CreateTexture(shading)); }