private static GeometryModel3D BuildDot_Visual(Model3DGroup modelGroup, MeshGeometry3D dotGeometry, SortedList <string, MaterialGroup> dotMaterials, SpecularMaterial specular, Color color, TranslateTransform3D translate) { string colorKey = UtilityWPF.ColorToHex(color); // Material MaterialGroup material; if (!dotMaterials.TryGetValue(colorKey, out material)) { material = new MaterialGroup(); material.Children.Add(new DiffuseMaterial(new SolidColorBrush(color))); material.Children.Add(specular); dotMaterials.Add(colorKey, material); } // Geometry GeometryModel3D retVal = new GeometryModel3D() { Material = material, BackMaterial = material, Geometry = dotGeometry, Transform = translate, }; modelGroup.Children.Add(retVal); return(retVal); }
public static string ToHex(this Color color, bool includeAlpha = true, bool includePound = true) { return(UtilityWPF.ColorToHex(color, includeAlpha, includePound)); }