示例#1
0
        private Material SetMaterial(PartColors materialColor)
        {
            _partColor = KnownPartColors.GetColor(materialColor);

            //SolidColorBrush sb = new SolidColorBrush(color.Color);
            //if (color.Alpha > 0)
            //    sb.Opacity = color.Alpha / 255.0;

            return(new DiffuseMaterial(_partColor.Color));
        }
示例#2
0
        private static void ColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Part3D s = (Part3D)d;

            if (s.Visual3DModel == null)
            {
                return;
            }

            s.PartColor = (PartColors)e.NewValue;
            Model3DGroup    mg  = (Model3DGroup)s.Visual3DModel;
            DiffuseMaterial mat = ((GeometryModel3D)mg.Children[0]).Material as DiffuseMaterial;

            s._partColor = KnownPartColors.GetColor(s.PartColor);
            if (mat != null)
            {
                mat.Brush = s._partColor.Color;
            }
        }