Improving travel retractions rendering
This commit is contained in:
parent
54fdca9a07
commit
83e083fcd6
4 changed files with 30 additions and 8 deletions
|
|
@ -43,7 +43,7 @@ namespace MatterHackers.GCodeVisualizer
|
|||
private Color gray;
|
||||
|
||||
public RenderFeatureExtrusion(int instructionIndex, Vector3 start, Vector3 end, int toolIndex, double travelSpeed, double totalExtrusionMm, double filamentDiameterMm, double layerHeight, Color color, Color gray)
|
||||
: base(instructionIndex, start, end, toolIndex, travelSpeed)
|
||||
: base(instructionIndex, start, end, toolIndex, travelSpeed, false)
|
||||
{
|
||||
this.color = color;
|
||||
this.gray = gray;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ namespace MatterHackers.GCodeVisualizer
|
|||
else if (extrusionAmount > 0)
|
||||
{
|
||||
// unretraction
|
||||
retractionColor = new Color(Color.Blue, 200);
|
||||
retractionColor = Color.Blue.WithAlpha(120);
|
||||
}
|
||||
|
||||
if (graphics2D is Graphics2DOpenGL graphics2DGl)
|
||||
|
|
|
|||
|
|
@ -40,25 +40,27 @@ namespace MatterHackers.GCodeVisualizer
|
|||
protected Vector3Float end;
|
||||
|
||||
protected float travelSpeed;
|
||||
private bool retractionTravel;
|
||||
|
||||
public Vector3Float Start => start;
|
||||
|
||||
public Vector3Float End => end;
|
||||
|
||||
public RenderFeatureTravel(int instructionIndex, Vector3 start, Vector3 end, int toolIndex, double travelSpeed)
|
||||
public RenderFeatureTravel(int instructionIndex, Vector3 start, Vector3 end, int toolIndex, double travelSpeed, bool retractionTravel)
|
||||
: base(instructionIndex, toolIndex)
|
||||
{
|
||||
this.toolIndex = toolIndex;
|
||||
this.start = new Vector3Float(start);
|
||||
this.end = new Vector3Float(end);
|
||||
this.travelSpeed = (float)travelSpeed;
|
||||
this.retractionTravel = retractionTravel;
|
||||
}
|
||||
|
||||
public override void CreateRender3DData(VectorPOD<ColorVertexData> colorVertexData, VectorPOD<int> indexData, GCodeRenderInfo renderInfo)
|
||||
{
|
||||
if ((renderInfo.CurrentRenderType & RenderType.Moves) == RenderType.Moves)
|
||||
{
|
||||
CreateCylinder(colorVertexData, indexData, new Vector3(start), new Vector3(end), .1, 6, GCodeRenderer.TravelColor, .2);
|
||||
CreateCylinder(colorVertexData, indexData, new Vector3(start), new Vector3(end), .1, 6, retractionTravel ? GCodeRenderer.RetractionColor : GCodeRenderer.TravelColor, .2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -84,9 +86,14 @@ namespace MatterHackers.GCodeVisualizer
|
|||
var endPoint = new Vector2(end.X, end.Y);
|
||||
renderInfo.Transform.transform(ref endPoint);
|
||||
|
||||
if (retractionTravel)
|
||||
{
|
||||
movementColor = GCodeRenderer.RetractionColor;
|
||||
}
|
||||
|
||||
if (renderInfo.CurrentRenderType.HasFlag(RenderType.TransparentExtrusion))
|
||||
{
|
||||
movementColor = new Color(movementColor, 200);
|
||||
movementColor = movementColor.WithAlpha(120);
|
||||
}
|
||||
|
||||
graphics2DGl.DrawAALineRounded(startPoint, endPoint, movementLineWidth, movementColor);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue