Add overload for user supplied default material color
- Previously hard-coded at material 0 (as used in gcode viewer)
This commit is contained in:
parent
565ef95c16
commit
9876abfba5
1 changed files with 16 additions and 0 deletions
|
|
@ -211,11 +211,27 @@ namespace MatterHackers.MeshVisualizer
|
|||
GL.Enable(EnableCap.Lighting);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the color for a given extruder, falling back to extruder 0 color on -1 (unassigned)
|
||||
/// </summary>
|
||||
/// <param name="materialIndex">The extruder/material index to resolve</param>
|
||||
/// <returns>The color for the given extruder</returns>
|
||||
public static Color Color(int materialIndex)
|
||||
{
|
||||
return ColorF.FromHSL(Math.Max(materialIndex, 0) / 10.0, .99, .49).ToColor();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the color for a given extruder, falling back to the supplied color on -1 (unassigned)
|
||||
/// </summary>
|
||||
/// <param name="materialIndex">The extruder/material index to resolve</param>
|
||||
/// <param name="unassignedColor">The color to use when the extruder/material has not been assigned</param>
|
||||
/// <returns>The color for the given extruder</returns>
|
||||
public static Color Color(int materialIndex, Color unassignedColor)
|
||||
{
|
||||
return (materialIndex == -1) ? unassignedColor : ColorF.FromHSL(materialIndex / 10.0, .99, .49).ToColor();
|
||||
}
|
||||
|
||||
public static bool InsideBuildVolume(this PrinterConfig printerConfig, IObject3D item)
|
||||
{
|
||||
if(item.Mesh == null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue