Exemplo n.º 1
0
 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))
         }
     });
 }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
0
 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);
        }
Exemplo n.º 5
0
        public static XbimTexture Create(IIfcSurfaceStyleShading shading)
        {
            var texture = new XbimTexture();

            return(texture.CreateTexture(shading));
        }