public override void CreateRender3DData(VectorPOD <ColorVertexData> colorVertexData, VectorPOD <int> indexData, GCodeRenderInfo renderInfo) { if ((renderInfo.CurrentRenderType & RenderType.Retractions) == RenderType.Retractions) { Vector3 position = new Vector3(this.position); RGBA_Bytes color = MeshViewerWidget.GetMaterialColor(extruderIndex + 1); if (extruderIndex == 0) { if (extrusionAmount > 0) { color = RGBA_Bytes.Blue; } else { color = RGBA_Bytes.Red; } } if (extrusionAmount > 0) { // unretraction CreatePointer(colorVertexData, indexData, position + new Vector3(0, 0, 1.3), position + new Vector3(0, 0, .3), Radius(1), 5, color); } else { // retraction CreatePointer(colorVertexData, indexData, position + new Vector3(0, 0, .3), position + new Vector3(0, 0, 1.3), Radius(1), 5, color); } } }
public override void Render(Graphics2D graphics2D, GCodeRenderInfo renderInfo) { if ((renderInfo.CurrentRenderType & RenderType.Extrusions) == RenderType.Extrusions) { double extrusionLineWidths = GetRadius(renderInfo.CurrentRenderType) * 2 * renderInfo.LayerScale; RGBA_Bytes extrusionColor = RGBA_Bytes.Black; if (extruderIndex > 0) { extrusionColor = MeshViewerWidget.GetMaterialColor(extruderIndex + 1); } if ((renderInfo.CurrentRenderType & RenderType.SpeedColors) == RenderType.SpeedColors) { extrusionColor = color; } PathStorage pathStorage = new PathStorage(); VertexSourceApplyTransform transformedPathStorage = new VertexSourceApplyTransform(pathStorage, renderInfo.Transform); Stroke stroke = new Stroke(transformedPathStorage, extrusionLineWidths); stroke.line_cap(LineCap.Round); stroke.line_join(LineJoin.Round); Vector3Float start = this.GetStart(renderInfo); Vector3Float end = this.GetEnd(renderInfo); pathStorage.Add(start.x, start.y, ShapePath.FlagsAndCommand.CommandMoveTo); pathStorage.Add(end.x, end.y, ShapePath.FlagsAndCommand.CommandLineTo); graphics2D.Render(stroke, 0, extrusionColor); } }
public override void Render(Graphics2D graphics2D, GCodeRenderInfo renderInfo) { if (renderInfo.CurrentRenderType.HasFlag(RenderType.Extrusions)) { double extrusionLineWidths = GetExtrusionWidth(renderInfo.CurrentRenderType) * 2 * renderInfo.LayerScale; Color extrusionColor = Color.Black; if (extruderIndex > 0) { extrusionColor = MeshViewerWidget.GetMaterialColor(extruderIndex + 1); } if (renderInfo.CurrentRenderType.HasFlag(RenderType.SpeedColors)) { extrusionColor = color; } if (renderInfo.CurrentRenderType.HasFlag(RenderType.TransparentExtrusion)) { extrusionColor = new Color(extrusionColor, 200); } // render the part using opengl Graphics2DOpenGL graphics2DGl = graphics2D as Graphics2DOpenGL; if (graphics2DGl != null) { Vector3Float startF = this.GetStart(renderInfo); Vector3Float endF = this.GetEnd(renderInfo); Vector2 start = new Vector2(startF.X, startF.Y); renderInfo.Transform.transform(ref start); Vector2 end = new Vector2(endF.X, endF.Y); renderInfo.Transform.transform(ref end); graphics2DGl.DrawAALineRounded(start, end, extrusionLineWidths / 2, extrusionColor); } else { VertexStorage pathStorage = new VertexStorage(); VertexSourceApplyTransform transformedPathStorage = new VertexSourceApplyTransform(pathStorage, renderInfo.Transform); Stroke stroke = new Stroke(transformedPathStorage, extrusionLineWidths / 2); stroke.LineCap = LineCap.Round; stroke.LineJoin = LineJoin.Round; Vector3Float start = this.GetStart(renderInfo); Vector3Float end = this.GetEnd(renderInfo); pathStorage.Add(start.X, start.Y, ShapePath.FlagsAndCommand.MoveTo); pathStorage.Add(end.X, end.Y, ShapePath.FlagsAndCommand.LineTo); graphics2D.Render(stroke, extrusionColor); } } }
public override void CreateRender3DData(VectorPOD <ColorVertexData> colorVertexData, VectorPOD <int> indexData, GCodeRenderInfo renderInfo) { if ((renderInfo.CurrentRenderType & RenderType.Retractions) == RenderType.Retractions) { Vector3 position = new Vector3(this.position); if (renderInfo.CurrentRenderType.HasFlag(RenderType.HideExtruderOffsets)) { Vector2 offset = renderInfo.GetExtruderOffset(extruderIndex); position = position + new Vector3(offset); } Color color = MeshViewerWidget.GetMaterialColor(extruderIndex + 1); if (extruderIndex == 0) { if (extrusionAmount > 0) { color = Color.Blue; } else { color = Color.Red; } } if (extrusionAmount > 0) { // unretraction CreatePointer(colorVertexData, indexData, position + new Vector3(0, 0, 1.3), position + new Vector3(0, 0, .3), Radius(1), 5, color); } else { // retraction CreatePointer(colorVertexData, indexData, position + new Vector3(0, 0, .3), position + new Vector3(0, 0, 1.3), Radius(1), 5, color); } } }
public override void CreateRender3DData(VectorPOD <ColorVertexData> colorVertexData, VectorPOD <int> indexData, GCodeRenderInfo renderInfo) { if ((renderInfo.CurrentRenderType & RenderType.Extrusions) == RenderType.Extrusions) { Vector3Float start = this.GetStart(renderInfo); Vector3Float end = this.GetEnd(renderInfo); double radius = GetRadius(renderInfo.CurrentRenderType); if ((renderInfo.CurrentRenderType & RenderType.SpeedColors) == RenderType.SpeedColors) { CreateCylinder(colorVertexData, indexData, new Vector3(start), new Vector3(end), radius, 6, color, layerHeight); } else { if (extruderIndex == 0) { CreateCylinder(colorVertexData, indexData, new Vector3(start), new Vector3(end), radius, 6, GCodeRenderer.ExtrusionColor, layerHeight); } else { CreateCylinder(colorVertexData, indexData, new Vector3(start), new Vector3(end), radius, 6, MeshViewerWidget.GetMaterialColor(extruderIndex + 1), layerHeight); } } } }