mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-06-26 01:15:28 -06:00
Merge pull request #20240 from Ultimaker/CURA-11978_retract-and-unretract-in-a-travel
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
conan-package-resources / conan-package (push) Has been cancelled
conan-package / conan-package (push) Has been cancelled
printer-linter-format / Printer linter auto format (push) Has been cancelled
unit-test / Run unit tests (push) Has been cancelled
conan-package-resources / signal-curator (push) Has been cancelled
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
conan-package-resources / conan-package (push) Has been cancelled
conan-package / conan-package (push) Has been cancelled
printer-linter-format / Printer linter auto format (push) Has been cancelled
unit-test / Run unit tests (push) Has been cancelled
conan-package-resources / signal-curator (push) Has been cancelled
CURA-11978 Retract and unretract in a travel
This commit is contained in:
commit
248efa51a8
13 changed files with 305 additions and 109 deletions
|
@ -80,9 +80,13 @@ class LayerDataBuilder(MeshBuilder):
|
||||||
material_colors = numpy.zeros((line_dimensions.shape[0], 4), dtype=numpy.float32)
|
material_colors = numpy.zeros((line_dimensions.shape[0], 4), dtype=numpy.float32)
|
||||||
for extruder_nr in range(material_color_map.shape[0]):
|
for extruder_nr in range(material_color_map.shape[0]):
|
||||||
material_colors[extruders == extruder_nr] = material_color_map[extruder_nr]
|
material_colors[extruders == extruder_nr] = material_color_map[extruder_nr]
|
||||||
# Set material_colors with indices where line_types (also numpy array) == MoveCombingType
|
# Set material_colors with indices where line_types (also numpy array) == MoveUnretractedType
|
||||||
material_colors[line_types == LayerPolygon.MoveCombingType] = colors[line_types == LayerPolygon.MoveCombingType]
|
material_colors[line_types == LayerPolygon.MoveUnretractedType] = colors[line_types == LayerPolygon.MoveUnretractedType]
|
||||||
material_colors[line_types == LayerPolygon.MoveRetractionType] = colors[line_types == LayerPolygon.MoveRetractionType]
|
material_colors[line_types == LayerPolygon.MoveRetractedType] = colors[line_types == LayerPolygon.MoveRetractedType]
|
||||||
|
material_colors[line_types == LayerPolygon.MoveWhileRetractingType] = colors[
|
||||||
|
line_types == LayerPolygon.MoveWhileRetractingType]
|
||||||
|
material_colors[line_types == LayerPolygon.MoveWhileUnretractingType] = colors[
|
||||||
|
line_types == LayerPolygon.MoveWhileUnretractingType]
|
||||||
|
|
||||||
attributes = {
|
attributes = {
|
||||||
"line_dimensions": {
|
"line_dimensions": {
|
||||||
|
|
|
@ -19,15 +19,22 @@ class LayerPolygon:
|
||||||
SkirtType = 5
|
SkirtType = 5
|
||||||
InfillType = 6
|
InfillType = 6
|
||||||
SupportInfillType = 7
|
SupportInfillType = 7
|
||||||
MoveCombingType = 8
|
MoveUnretractedType = 8
|
||||||
MoveRetractionType = 9
|
MoveRetractedType = 9
|
||||||
SupportInterfaceType = 10
|
SupportInterfaceType = 10
|
||||||
PrimeTowerType = 11
|
PrimeTowerType = 11
|
||||||
__number_of_types = 12
|
MoveWhileRetractingType = 12
|
||||||
|
MoveWhileUnretractingType = 13
|
||||||
|
StationaryRetractUnretract = 14
|
||||||
|
__number_of_types = 15
|
||||||
|
|
||||||
__jump_map = numpy.logical_or(numpy.logical_or(numpy.arange(__number_of_types) == NoneType,
|
__jump_map = numpy.logical_or(numpy.logical_or(numpy.logical_or(
|
||||||
numpy.arange(__number_of_types) == MoveCombingType),
|
numpy.arange(__number_of_types) == NoneType,
|
||||||
numpy.arange(__number_of_types) == MoveRetractionType)
|
numpy.arange(__number_of_types) == MoveUnretractedType),
|
||||||
|
numpy.logical_or(
|
||||||
|
numpy.arange(__number_of_types) == MoveRetractedType,
|
||||||
|
numpy.arange(__number_of_types) == MoveWhileRetractingType)),
|
||||||
|
numpy.arange(__number_of_types) == MoveWhileUnretractingType)
|
||||||
|
|
||||||
def __init__(self, extruder: int, line_types: numpy.ndarray, data: numpy.ndarray,
|
def __init__(self, extruder: int, line_types: numpy.ndarray, data: numpy.ndarray,
|
||||||
line_widths: numpy.ndarray, line_thicknesses: numpy.ndarray, line_feedrates: numpy.ndarray) -> None:
|
line_widths: numpy.ndarray, line_thicknesses: numpy.ndarray, line_feedrates: numpy.ndarray) -> None:
|
||||||
|
@ -269,10 +276,13 @@ class LayerPolygon:
|
||||||
theme.getColor("layerview_skirt").getRgbF(), # SkirtType
|
theme.getColor("layerview_skirt").getRgbF(), # SkirtType
|
||||||
theme.getColor("layerview_infill").getRgbF(), # InfillType
|
theme.getColor("layerview_infill").getRgbF(), # InfillType
|
||||||
theme.getColor("layerview_support_infill").getRgbF(), # SupportInfillType
|
theme.getColor("layerview_support_infill").getRgbF(), # SupportInfillType
|
||||||
theme.getColor("layerview_move_combing").getRgbF(), # MoveCombingType
|
theme.getColor("layerview_move_combing").getRgbF(), # MoveUnretractedType
|
||||||
theme.getColor("layerview_move_retraction").getRgbF(), # MoveRetractionType
|
theme.getColor("layerview_move_retraction").getRgbF(), # MoveRetractedType
|
||||||
theme.getColor("layerview_support_interface").getRgbF(), # SupportInterfaceType
|
theme.getColor("layerview_support_interface").getRgbF(), # SupportInterfaceType
|
||||||
theme.getColor("layerview_prime_tower").getRgbF() # PrimeTowerType
|
theme.getColor("layerview_prime_tower").getRgbF(), # PrimeTowerType
|
||||||
|
theme.getColor("layerview_move_while_retracting").getRgbF(), # MoveWhileRetracting
|
||||||
|
theme.getColor("layerview_move_while_unretracting").getRgbF(), # MoveWhileUnretracting
|
||||||
|
theme.getColor("layerview_move_retraction").getRgbF(), # StationaryRetractUnretract
|
||||||
])
|
])
|
||||||
|
|
||||||
return cls.__color_map
|
return cls.__color_map
|
||||||
|
|
|
@ -78,10 +78,14 @@ message Polygon {
|
||||||
SkirtType = 5;
|
SkirtType = 5;
|
||||||
InfillType = 6;
|
InfillType = 6;
|
||||||
SupportInfillType = 7;
|
SupportInfillType = 7;
|
||||||
MoveCombingType = 8;
|
MoveUnretracted = 8;
|
||||||
MoveRetractionType = 9;
|
MoveRetracted = 9;
|
||||||
SupportInterfaceType = 10;
|
SupportInterfaceType = 10;
|
||||||
PrimeTowerType = 11;
|
PrimeTowerType = 11;
|
||||||
|
MoveWhileRetracting = 12;
|
||||||
|
MoveWhileUnretracting = 13;
|
||||||
|
StationaryRetractUnretract = 14;
|
||||||
|
NumPrintFeatureTypes = 15;
|
||||||
}
|
}
|
||||||
Type type = 1; // Type of move
|
Type type = 1; // Type of move
|
||||||
bytes points = 2; // The points of the polygon, or two points if only a line segment (Currently only line segments are used)
|
bytes points = 2; // The points of the polygon, or two points if only a line segment (Currently only line segments are used)
|
||||||
|
|
|
@ -133,7 +133,10 @@ class FlavorParser:
|
||||||
if i > 0:
|
if i > 0:
|
||||||
line_feedrates[i - 1] = point[3]
|
line_feedrates[i - 1] = point[3]
|
||||||
line_types[i - 1] = point[5]
|
line_types[i - 1] = point[5]
|
||||||
if point[5] in [LayerPolygon.MoveCombingType, LayerPolygon.MoveRetractionType]:
|
if point[5] in [LayerPolygon.MoveUnretractedType,
|
||||||
|
LayerPolygon.MoveRetractedType,
|
||||||
|
LayerPolygon.MoveWhileRetractingType,
|
||||||
|
LayerPolygon.MoveWhileUnretractingType]:
|
||||||
line_widths[i - 1] = 0.1
|
line_widths[i - 1] = 0.1
|
||||||
line_thicknesses[i - 1] = 0.0 # Travels are set as zero thickness lines
|
line_thicknesses[i - 1] = 0.0 # Travels are set as zero thickness lines
|
||||||
else:
|
else:
|
||||||
|
@ -196,7 +199,7 @@ class FlavorParser:
|
||||||
path.append([x, y, z, f, new_extrusion_value + self._extrusion_length_offset[self._extruder_number], self._layer_type]) # extrusion
|
path.append([x, y, z, f, new_extrusion_value + self._extrusion_length_offset[self._extruder_number], self._layer_type]) # extrusion
|
||||||
self._previous_extrusion_value = new_extrusion_value
|
self._previous_extrusion_value = new_extrusion_value
|
||||||
else:
|
else:
|
||||||
path.append([x, y, z, f, new_extrusion_value + self._extrusion_length_offset[self._extruder_number], LayerPolygon.MoveRetractionType]) # retraction
|
path.append([x, y, z, f, new_extrusion_value + self._extrusion_length_offset[self._extruder_number], LayerPolygon.MoveRetractedType]) # retraction
|
||||||
e[self._extruder_number] = new_extrusion_value
|
e[self._extruder_number] = new_extrusion_value
|
||||||
|
|
||||||
# Only when extruding we can determine the latest known "layer height" which is the difference in height between extrusions
|
# Only when extruding we can determine the latest known "layer height" which is the difference in height between extrusions
|
||||||
|
@ -205,9 +208,9 @@ class FlavorParser:
|
||||||
self._current_layer_thickness = z - self._previous_z # allow a tiny overlap
|
self._current_layer_thickness = z - self._previous_z # allow a tiny overlap
|
||||||
self._previous_z = z
|
self._previous_z = z
|
||||||
elif self._previous_extrusion_value > e[self._extruder_number]:
|
elif self._previous_extrusion_value > e[self._extruder_number]:
|
||||||
path.append([x, y, z, f, e[self._extruder_number] + self._extrusion_length_offset[self._extruder_number], LayerPolygon.MoveRetractionType])
|
path.append([x, y, z, f, e[self._extruder_number] + self._extrusion_length_offset[self._extruder_number], LayerPolygon.MoveRetractedType])
|
||||||
else:
|
else:
|
||||||
path.append([x, y, z, f, e[self._extruder_number] + self._extrusion_length_offset[self._extruder_number], LayerPolygon.MoveCombingType])
|
path.append([x, y, z, f, e[self._extruder_number] + self._extrusion_length_offset[self._extruder_number], LayerPolygon.MoveUnretractedType])
|
||||||
return self._position(x, y, z, f, e)
|
return self._position(x, y, z, f, e)
|
||||||
|
|
||||||
|
|
||||||
|
@ -419,7 +422,7 @@ class FlavorParser:
|
||||||
self._createPolygon(self._current_layer_thickness, current_path, self._extruder_offsets.get(self._extruder_number, [0, 0]))
|
self._createPolygon(self._current_layer_thickness, current_path, self._extruder_offsets.get(self._extruder_number, [0, 0]))
|
||||||
current_path.clear()
|
current_path.clear()
|
||||||
# Start the new layer at the end position of the last layer
|
# Start the new layer at the end position of the last layer
|
||||||
current_path.append([current_position.x, current_position.y, current_position.z, current_position.f, current_position.e[self._extruder_number], LayerPolygon.MoveCombingType])
|
current_path.append([current_position.x, current_position.y, current_position.z, current_position.f, current_position.e[self._extruder_number], LayerPolygon.MoveUnretractedType])
|
||||||
|
|
||||||
# When using a raft, the raft layers are stored as layers < 0, it mimics the same behavior
|
# When using a raft, the raft layers are stored as layers < 0, it mimics the same behavior
|
||||||
# as in ProcessSlicedLayersJob
|
# as in ProcessSlicedLayersJob
|
||||||
|
@ -461,9 +464,9 @@ class FlavorParser:
|
||||||
|
|
||||||
# When changing tool, store the end point of the previous path, then process the code and finally
|
# When changing tool, store the end point of the previous path, then process the code and finally
|
||||||
# add another point with the new position of the head.
|
# add another point with the new position of the head.
|
||||||
current_path.append([current_position.x, current_position.y, current_position.z, current_position.f, current_position.e[self._extruder_number], LayerPolygon.MoveCombingType])
|
current_path.append([current_position.x, current_position.y, current_position.z, current_position.f, current_position.e[self._extruder_number], LayerPolygon.MoveUnretractedType])
|
||||||
current_position = self.processTCode(global_stack, T, line, current_position, current_path)
|
current_position = self.processTCode(global_stack, T, line, current_position, current_path)
|
||||||
current_path.append([current_position.x, current_position.y, current_position.z, current_position.f, current_position.e[self._extruder_number], LayerPolygon.MoveCombingType])
|
current_path.append([current_position.x, current_position.y, current_position.z, current_position.f, current_position.e[self._extruder_number], LayerPolygon.MoveUnretractedType])
|
||||||
|
|
||||||
if line.startswith("M"):
|
if line.startswith("M"):
|
||||||
M = self._getInt(line, "M")
|
M = self._getInt(line, "M")
|
||||||
|
|
|
@ -203,9 +203,9 @@ class SimulationPass(RenderPass):
|
||||||
self._layer_shader.setUniformValue("u_next_vertex", not_a_vector)
|
self._layer_shader.setUniformValue("u_next_vertex", not_a_vector)
|
||||||
self._layer_shader.setUniformValue("u_last_line_ratio", 1.0)
|
self._layer_shader.setUniformValue("u_last_line_ratio", 1.0)
|
||||||
|
|
||||||
# The first line does not have a previous line: add a MoveCombingType in front for start detection
|
# The first line does not have a previous line: add a MoveUnretractedType in front for start detection
|
||||||
# this way the first start of the layer can also be drawn
|
# this way the first start of the layer can also be drawn
|
||||||
prev_line_types = numpy.concatenate([numpy.asarray([LayerPolygon.MoveCombingType], dtype = numpy.float32), layer_data._attributes["line_types"]["value"]])
|
prev_line_types = numpy.concatenate([numpy.asarray([LayerPolygon.MoveUnretractedType], dtype = numpy.float32), layer_data._attributes["line_types"]["value"]])
|
||||||
# Remove the last element
|
# Remove the last element
|
||||||
prev_line_types = prev_line_types[0:layer_data._attributes["line_types"]["value"].size]
|
prev_line_types = prev_line_types[0:layer_data._attributes["line_types"]["value"].size]
|
||||||
layer_data._attributes["prev_line_types"] = {'opengl_type': 'float', 'value': prev_line_types, 'opengl_name': 'a_prev_line_type'}
|
layer_data._attributes["prev_line_types"] = {'opengl_type': 'float', 'value': prev_line_types, 'opengl_name': 'a_prev_line_type'}
|
||||||
|
|
|
@ -608,8 +608,10 @@ class SimulationView(CuraView):
|
||||||
visible_line_types.append(LayerPolygon.SupportInterfaceType)
|
visible_line_types.append(LayerPolygon.SupportInterfaceType)
|
||||||
visible_line_types_with_extrusion = visible_line_types.copy() # Copy before travel moves are added
|
visible_line_types_with_extrusion = visible_line_types.copy() # Copy before travel moves are added
|
||||||
if self.getShowTravelMoves():
|
if self.getShowTravelMoves():
|
||||||
visible_line_types.append(LayerPolygon.MoveCombingType)
|
visible_line_types.append(LayerPolygon.MoveUnretractedType)
|
||||||
visible_line_types.append(LayerPolygon.MoveRetractionType)
|
visible_line_types.append(LayerPolygon.MoveRetractedType)
|
||||||
|
visible_line_types.append(LayerPolygon.MoveWhileRetractingType)
|
||||||
|
visible_line_types.append(LayerPolygon.MoveWhileUnretractingType)
|
||||||
|
|
||||||
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
||||||
layer_data = node.callDecoration("getLayerData")
|
layer_data = node.callDecoration("getLayerData")
|
||||||
|
|
|
@ -227,29 +227,52 @@ Cura.ExpandableComponent
|
||||||
id: typesLegendModel
|
id: typesLegendModel
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
|
const travelsTypesModel = [
|
||||||
|
{
|
||||||
|
label: catalog.i18nc("@label", "Not retracted"),
|
||||||
|
colorId: "layerview_move_combing"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: catalog.i18nc("@label", "Retracted"),
|
||||||
|
colorId: "layerview_move_retraction"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: catalog.i18nc("@label", "Retracting"),
|
||||||
|
colorId: "layerview_move_while_retracting"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: catalog.i18nc("@label", "Priming"),
|
||||||
|
colorId: "layerview_move_while_unretracting"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
typesLegendModel.append({
|
typesLegendModel.append({
|
||||||
label: catalog.i18nc("@label", "Travels"),
|
label: catalog.i18nc("@label", "Travels"),
|
||||||
initialValue: viewSettings.show_travel_moves,
|
initialValue: viewSettings.show_travel_moves,
|
||||||
preference: "layerview/show_travel_moves",
|
preference: "layerview/show_travel_moves",
|
||||||
colorId: "layerview_move_combing"
|
colorId: "layerview_move_combing",
|
||||||
|
subTypesModel: travelsTypesModel
|
||||||
});
|
});
|
||||||
typesLegendModel.append({
|
typesLegendModel.append({
|
||||||
label: catalog.i18nc("@label", "Helpers"),
|
label: catalog.i18nc("@label", "Helpers"),
|
||||||
initialValue: viewSettings.show_helpers,
|
initialValue: viewSettings.show_helpers,
|
||||||
preference: "layerview/show_helpers",
|
preference: "layerview/show_helpers",
|
||||||
colorId: "layerview_support"
|
colorId: "layerview_support",
|
||||||
|
subTypesModel: []
|
||||||
});
|
});
|
||||||
typesLegendModel.append({
|
typesLegendModel.append({
|
||||||
label: catalog.i18nc("@label", "Shell"),
|
label: catalog.i18nc("@label", "Shell"),
|
||||||
initialValue: viewSettings.show_skin,
|
initialValue: viewSettings.show_skin,
|
||||||
preference: "layerview/show_skin",
|
preference: "layerview/show_skin",
|
||||||
colorId: "layerview_inset_0"
|
colorId: "layerview_inset_0",
|
||||||
|
subTypesModel: []
|
||||||
});
|
});
|
||||||
typesLegendModel.append({
|
typesLegendModel.append({
|
||||||
label: catalog.i18nc("@label", "Infill"),
|
label: catalog.i18nc("@label", "Infill"),
|
||||||
initialValue: viewSettings.show_infill,
|
initialValue: viewSettings.show_infill,
|
||||||
preference: "layerview/show_infill",
|
preference: "layerview/show_infill",
|
||||||
colorId: "layerview_infill"
|
colorId: "layerview_infill",
|
||||||
|
subTypesModel: []
|
||||||
});
|
});
|
||||||
if (! UM.SimulationView.compatibilityMode)
|
if (! UM.SimulationView.compatibilityMode)
|
||||||
{
|
{
|
||||||
|
@ -257,7 +280,8 @@ Cura.ExpandableComponent
|
||||||
label: catalog.i18nc("@label", "Starts"),
|
label: catalog.i18nc("@label", "Starts"),
|
||||||
initialValue: viewSettings.show_starts,
|
initialValue: viewSettings.show_starts,
|
||||||
preference: "layerview/show_starts",
|
preference: "layerview/show_starts",
|
||||||
colorId: "layerview_starts"
|
colorId: "layerview_starts",
|
||||||
|
subTypesModel: []
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,6 +297,7 @@ Cura.ExpandableComponent
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
|
id: rectangleColor
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: legendModelCheckBox.right
|
anchors.right: legendModelCheckBox.right
|
||||||
width: UM.Theme.getSize("layerview_legend_size").width
|
width: UM.Theme.getSize("layerview_legend_size").width
|
||||||
|
@ -281,6 +306,58 @@ Cura.ExpandableComponent
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: UM.Theme.getColor("lining")
|
border.color: UM.Theme.getColor("lining")
|
||||||
visible: viewSettings.show_legend
|
visible: viewSettings.show_legend
|
||||||
|
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
enabled: subTypesModel.count > 0
|
||||||
|
|
||||||
|
onEntered: tooltip.show()
|
||||||
|
onExited: tooltip.hide()
|
||||||
|
|
||||||
|
UM.ToolTip
|
||||||
|
{
|
||||||
|
id: tooltip
|
||||||
|
delay: 0
|
||||||
|
width: subTypesColumn.implicitWidth + 2 * UM.Theme.getSize("thin_margin").width
|
||||||
|
height: subTypesColumn.implicitHeight + 2 * UM.Theme.getSize("thin_margin").width
|
||||||
|
|
||||||
|
contentItem: Column
|
||||||
|
{
|
||||||
|
id: subTypesColumn
|
||||||
|
padding: 0
|
||||||
|
spacing: UM.Theme.getSize("layerview_row_spacing").height
|
||||||
|
|
||||||
|
Repeater
|
||||||
|
{
|
||||||
|
model: subTypesModel
|
||||||
|
UM.Label
|
||||||
|
{
|
||||||
|
text: label
|
||||||
|
|
||||||
|
height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
|
||||||
|
width: UM.Theme.getSize("layerview_menu_size").width
|
||||||
|
color: UM.Theme.getColor("tooltip_text")
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
width: UM.Theme.getSize("layerview_legend_size").width
|
||||||
|
height: UM.Theme.getSize("layerview_legend_size").height
|
||||||
|
|
||||||
|
color: UM.Theme.getColor(model.colorId)
|
||||||
|
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
border.color: UM.Theme.getColor("lining")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.Label
|
UM.Label
|
||||||
|
|
|
@ -22,8 +22,8 @@ vertex =
|
||||||
gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
|
gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
|
||||||
// shade the color depending on the extruder index
|
// shade the color depending on the extruder index
|
||||||
v_color = a_color;
|
v_color = a_color;
|
||||||
// 8 and 9 are travel moves
|
// 8, 9, 12 and 13 are travel moves
|
||||||
if ((a_line_type != 8.0) && (a_line_type != 9.0)) {
|
if ((a_line_type != 8.0) && (a_line_type != 9.0) && (a_line_type != 12.0) && (a_line_type != 13.0)) {
|
||||||
v_color = (a_extruder == u_active_extruder) ? v_color : vec4(u_shade_factor * v_color.rgb, v_color.a);
|
v_color = (a_extruder == u_active_extruder) ? v_color : vec4(u_shade_factor * v_color.rgb, v_color.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,9 @@ fragment =
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
if ((u_show_travel_moves == 0) && (v_line_type >= 7.5) && (v_line_type <= 9.5)) { // actually, 8 and 9
|
// travel moves: 8, 9, 12, 13
|
||||||
|
if ((u_show_travel_moves == 0) && (((v_line_type >= 7.5) && (v_line_type <= 9.5)) ||
|
||||||
|
((v_line_type >= 11.5) && (v_line_type <= 13.5)))) {
|
||||||
// discard movements
|
// discard movements
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +102,7 @@ vertex41core =
|
||||||
{
|
{
|
||||||
gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
|
gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
|
||||||
v_color = a_color;
|
v_color = a_color;
|
||||||
if ((a_line_type != 8) && (a_line_type != 9)) {
|
if ((a_line_type != 8) && (a_line_type != 9) && (a_line_type != 12) && (a_line_type != 13)) {
|
||||||
v_color = (a_extruder == u_active_extruder) ? v_color : vec4(u_shade_factor * v_color.rgb, v_color.a);
|
v_color = (a_extruder == u_active_extruder) ? v_color : vec4(u_shade_factor * v_color.rgb, v_color.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +122,9 @@ fragment41core =
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
if ((u_show_travel_moves == 0) && (v_line_type >= 7.5) && (v_line_type <= 9.5)) { // actually, 8 and 9
|
// travel moves: 8, 9, 12, 13
|
||||||
|
if ((u_show_travel_moves == 0) && (((v_line_type >= 7.5) && (v_line_type <= 9.5)) ||
|
||||||
|
((v_line_type >= 11.5) && (v_line_type <= 13.5)))) {
|
||||||
// discard movements
|
// discard movements
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,22 +228,26 @@ geometry41core =
|
||||||
{
|
{
|
||||||
highp mat4 viewProjectionMatrix = u_projectionMatrix * u_viewMatrix;
|
highp mat4 viewProjectionMatrix = u_projectionMatrix * u_viewMatrix;
|
||||||
|
|
||||||
vec4 g_vertex_delta;
|
// Vertices are declared as vec4 so that they can be used for calculations with gl_in[x].gl_Position
|
||||||
vec3 g_vertex_normal_horz; // horizontal and vertical in respect to layers
|
vec3 g_vertex_delta;
|
||||||
vec4 g_vertex_offset_horz; // vec4 to match gl_in[x].gl_Position
|
vec3 g_vertex_normal_horz;
|
||||||
|
vec4 g_vertex_offset_horz;
|
||||||
vec3 g_vertex_normal_vert;
|
vec3 g_vertex_normal_vert;
|
||||||
vec4 g_vertex_offset_vert;
|
vec4 g_vertex_offset_vert;
|
||||||
vec3 g_vertex_normal_horz_head;
|
vec3 g_vertex_normal_horz_head;
|
||||||
vec4 g_vertex_offset_horz_head;
|
vec4 g_vertex_offset_horz_head;
|
||||||
|
vec3 g_axial_plan_vector;
|
||||||
|
vec3 g_radial_plan_vector;
|
||||||
|
|
||||||
float size_x;
|
float size_x;
|
||||||
float size_y;
|
float size_y;
|
||||||
|
|
||||||
if ((v_extruder_opacity[0][int(mod(v_extruder[0], 4))][v_extruder[0] / 4] == 0.0) && (v_line_type[0] != 8) && (v_line_type[0] != 9)) {
|
if ((v_extruder_opacity[0][int(mod(v_extruder[0], 4))][v_extruder[0] / 4] == 0.0) &&
|
||||||
|
(v_line_type[0] != 8) && (v_line_type[0] != 9) && (v_line_type[0] != 12) && (v_line_type[0] != 13)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// See LayerPolygon; 8 is MoveCombingType, 9 is RetractionType
|
// See LayerPolygon; 8 is MoveUnretractedType, 9 is RetractionType, 12 is MoveWhileRetractingType, 13 is MoveWhileUnretractingType
|
||||||
if ((u_show_travel_moves == 0) && ((v_line_type[0] == 8) || (v_line_type[0] == 9))) {
|
if ((u_show_travel_moves == 0) && ((v_line_type[0] == 8) || (v_line_type[0] == 9) || (v_line_type[0] == 12) || (v_line_type[0] == 13))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((u_show_helpers == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 5) || (v_line_type[0] == 7) || (v_line_type[0] == 10) || v_line_type[0] == 11)) {
|
if ((u_show_helpers == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 5) || (v_line_type[0] == 7) || (v_line_type[0] == 10) || v_line_type[0] == 11)) {
|
||||||
|
@ -256,7 +260,7 @@ geometry41core =
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) {
|
if ((v_line_type[0] == 8) || (v_line_type[0] == 9) || (v_line_type[0] == 12) || (v_line_type[0] == 13)) {
|
||||||
// fixed size for movements
|
// fixed size for movements
|
||||||
size_x = 0.05;
|
size_x = 0.05;
|
||||||
} else {
|
} else {
|
||||||
|
@ -264,26 +268,47 @@ geometry41core =
|
||||||
}
|
}
|
||||||
size_y = v_line_dim[1].y / 2 + 0.01;
|
size_y = v_line_dim[1].y / 2 + 0.01;
|
||||||
|
|
||||||
g_vertex_delta = gl_in[1].gl_Position - gl_in[0].gl_Position; //Actual movement exhibited by the line.
|
g_vertex_delta = (gl_in[1].gl_Position - gl_in[0].gl_Position).xyz; //Actual movement exhibited by the line.
|
||||||
g_vertex_normal_horz_head = normalize(vec3(-g_vertex_delta.x, -g_vertex_delta.y, -g_vertex_delta.z)); //Lengthwise normal vector pointing backwards.
|
|
||||||
g_vertex_offset_horz_head = vec4(g_vertex_normal_horz_head * size_x, 0.0); //Lengthwise offset vector pointing backwards.
|
|
||||||
|
|
||||||
g_vertex_normal_horz = normalize(vec3(g_vertex_delta.z, g_vertex_delta.y, -g_vertex_delta.x)); //Normal vector pointing right.
|
if (g_vertex_delta == vec3(0.0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_vertex_delta.y == 0.0)
|
||||||
|
{
|
||||||
|
// vector is in the horizontal plan, radial vector is a simple rotation around Y axis
|
||||||
|
g_radial_plan_vector = vec3(g_vertex_delta.z, 0.0, -g_vertex_delta.x);
|
||||||
|
}
|
||||||
|
else if(g_vertex_delta.x == 0.0 && g_vertex_delta.z == 0.0)
|
||||||
|
{
|
||||||
|
// delta vector is purely vertical, display the line rotated vertically so that it is visible in front and side views
|
||||||
|
g_radial_plan_vector = vec3(1.0, 0.0, -1.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// delta vector is completely 3D
|
||||||
|
g_axial_plan_vector = vec3(g_vertex_delta.x, 0.0, g_vertex_delta.z); // Vector projected in the horizontal plan
|
||||||
|
g_radial_plan_vector = cross(g_vertex_delta, g_axial_plan_vector); // Radial vector in the horizontal plan, pointing right.
|
||||||
|
}
|
||||||
|
|
||||||
|
g_vertex_normal_horz_head = normalize(g_vertex_delta); //Lengthwise normal vector
|
||||||
|
g_vertex_offset_horz_head = vec4(g_vertex_normal_horz_head * size_x, 0.0); //Lengthwise offset vector
|
||||||
|
|
||||||
|
g_vertex_normal_horz = normalize(g_radial_plan_vector); //Normal vector pointing right.
|
||||||
g_vertex_offset_horz = vec4(g_vertex_normal_horz * size_x, 0.0); //Offset vector pointing right.
|
g_vertex_offset_horz = vec4(g_vertex_normal_horz * size_x, 0.0); //Offset vector pointing right.
|
||||||
|
|
||||||
g_vertex_normal_vert = vec3(0.0, 1.0, 0.0); //Upwards normal vector.
|
g_vertex_normal_vert = vec3(0.0, 1.0, 0.0); //Upwards normal vector.
|
||||||
g_vertex_offset_vert = vec4(g_vertex_normal_vert * size_y, 0.0); //Upwards offset vector. Goes up by half the layer thickness.
|
g_vertex_offset_vert = vec4(g_vertex_normal_vert * size_y, 0.0); //Upwards offset vector. Goes up by half the layer thickness.
|
||||||
|
|
||||||
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) { //Travel or retraction moves.
|
if ((v_line_type[0] == 8) || (v_line_type[0] == 9) || (v_line_type[0] == 12) || (v_line_type[0] == 13)) { //Travel or retraction moves.
|
||||||
vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert);
|
vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz_head + g_vertex_offset_vert);
|
||||||
vec4 va_up = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
vec4 va_up = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
||||||
vec4 va_down = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
vec4 va_down = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
||||||
vec4 vb_head = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head + g_vertex_offset_vert);
|
vec4 vb_head = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert);
|
||||||
vec4 vb_down = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
vec4 vb_down = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
||||||
vec4 vb_up = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
vec4 vb_up = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
||||||
|
|
||||||
// Travels: flat plane with pointy ends
|
// Travels: flat plane with pointy ends
|
||||||
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_up);
|
|
||||||
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_head);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_head);
|
||||||
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_down);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_down);
|
||||||
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_up);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_up);
|
||||||
|
@ -308,8 +333,8 @@ geometry41core =
|
||||||
vec4 vb_p_horz = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz); //Line end, right vertex.
|
vec4 vb_p_horz = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz); //Line end, right vertex.
|
||||||
vec4 va_m_vert = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert); //Line start, bottom vertex.
|
vec4 va_m_vert = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert); //Line start, bottom vertex.
|
||||||
vec4 vb_m_vert = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert); //Line end, bottom vertex.
|
vec4 vb_m_vert = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert); //Line end, bottom vertex.
|
||||||
vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head); //Line start, tip.
|
vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz_head); //Line start, tip.
|
||||||
vec4 vb_head = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head); //Line end, tip.
|
vec4 vb_head = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz_head); //Line end, tip.
|
||||||
|
|
||||||
// All normal lines are rendered as 3d tubes.
|
// All normal lines are rendered as 3d tubes.
|
||||||
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
|
||||||
|
@ -328,14 +353,14 @@ geometry41core =
|
||||||
// left side
|
// left side
|
||||||
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
|
||||||
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_p_vert);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_p_vert);
|
||||||
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz_head, va_head);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz_head, va_head);
|
||||||
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz, va_p_horz);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz, va_p_horz);
|
||||||
|
|
||||||
EndPrimitive();
|
EndPrimitive();
|
||||||
|
|
||||||
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz, va_p_horz);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz, va_p_horz);
|
||||||
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_vert, va_m_vert);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_vert, va_m_vert);
|
||||||
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz_head, va_head);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz_head, va_head);
|
||||||
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
|
||||||
|
|
||||||
EndPrimitive();
|
EndPrimitive();
|
||||||
|
@ -343,14 +368,14 @@ geometry41core =
|
||||||
// right side
|
// right side
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_p_vert);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_p_vert);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, vb_head);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz_head, vb_head);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
||||||
|
|
||||||
EndPrimitive();
|
EndPrimitive();
|
||||||
|
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, vb_m_vert);
|
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, vb_m_vert);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, vb_head);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz_head, vb_head);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
||||||
|
|
||||||
EndPrimitive();
|
EndPrimitive();
|
||||||
|
|
|
@ -95,22 +95,26 @@ geometry41core =
|
||||||
{
|
{
|
||||||
highp mat4 viewProjectionMatrix = u_projectionMatrix * u_viewMatrix;
|
highp mat4 viewProjectionMatrix = u_projectionMatrix * u_viewMatrix;
|
||||||
|
|
||||||
vec4 g_vertex_delta;
|
// Vertices are declared as vec4 so that they can be used for calculations with gl_in[x].gl_Position
|
||||||
vec3 g_vertex_normal_horz; // horizontal and vertical in respect to layers
|
vec3 g_vertex_delta;
|
||||||
vec4 g_vertex_offset_horz; // vec4 to match gl_in[x].gl_Position
|
vec3 g_vertex_normal_horz;
|
||||||
|
vec4 g_vertex_offset_horz;
|
||||||
vec3 g_vertex_normal_vert;
|
vec3 g_vertex_normal_vert;
|
||||||
vec4 g_vertex_offset_vert;
|
vec4 g_vertex_offset_vert;
|
||||||
vec3 g_vertex_normal_horz_head;
|
vec3 g_vertex_normal_horz_head;
|
||||||
vec4 g_vertex_offset_horz_head;
|
vec4 g_vertex_offset_horz_head;
|
||||||
|
vec3 g_axial_plane_vector;
|
||||||
|
vec3 g_radial_plane_vector;
|
||||||
|
|
||||||
float size_x;
|
float size_x;
|
||||||
float size_y;
|
float size_y;
|
||||||
|
|
||||||
if ((v_extruder_opacity[0][int(mod(v_extruder[0], 4))][v_extruder[0] / 4] == 0.0) && (v_line_type[0] != 8) && (v_line_type[0] != 9)) {
|
if ((v_extruder_opacity[0][int(mod(v_extruder[0], 4))][v_extruder[0] / 4] == 0.0) &&
|
||||||
|
(v_line_type[0] != 8) && (v_line_type[0] != 9) && (v_line_type[0] != 12) && (v_line_type[0] != 13)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// See LayerPolygon; 8 is MoveCombingType, 9 is RetractionType
|
// See LayerPolygon; 8 is MoveUnretractedType, 9 is RetractionType, 12 is MoveWhileRetractingType, 13 is MoveWhileUnretractingType
|
||||||
if ((u_show_travel_moves == 0) && ((v_line_type[0] == 8) || (v_line_type[0] == 9))) {
|
if ((u_show_travel_moves == 0) && ((v_line_type[0] == 8) || (v_line_type[0] == 9) || (v_line_type[0] == 12) || (v_line_type[0] == 13))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((u_show_helpers == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 5) || (v_line_type[0] == 7) || (v_line_type[0] == 10))) {
|
if ((u_show_helpers == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 5) || (v_line_type[0] == 7) || (v_line_type[0] == 10))) {
|
||||||
|
@ -123,7 +127,7 @@ geometry41core =
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) {
|
if ((v_line_type[0] == 8) || (v_line_type[0] == 9) || (v_line_type[0] == 12) || (v_line_type[0] == 13)) {
|
||||||
// fixed size for movements
|
// fixed size for movements
|
||||||
size_x = 0.05;
|
size_x = 0.05;
|
||||||
} else {
|
} else {
|
||||||
|
@ -131,93 +135,114 @@ geometry41core =
|
||||||
}
|
}
|
||||||
size_y = v_line_dim[1].y / 2 + 0.01;
|
size_y = v_line_dim[1].y / 2 + 0.01;
|
||||||
|
|
||||||
g_vertex_delta = gl_in[1].gl_Position - gl_in[0].gl_Position;
|
g_vertex_delta = (gl_in[1].gl_Position - gl_in[0].gl_Position).xyz; //Actual movement exhibited by the line.
|
||||||
g_vertex_normal_horz_head = normalize(vec3(-g_vertex_delta.x, -g_vertex_delta.y, -g_vertex_delta.z));
|
|
||||||
g_vertex_offset_horz_head = vec4(g_vertex_normal_horz_head * size_x, 0.0);
|
|
||||||
|
|
||||||
g_vertex_normal_horz = normalize(vec3(g_vertex_delta.z, g_vertex_delta.y, -g_vertex_delta.x));
|
if (g_vertex_delta == vec3(0.0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
g_vertex_offset_horz = vec4(g_vertex_normal_horz * size_x, 0.0); //size * g_vertex_normal_horz;
|
if (g_vertex_delta.y == 0.0)
|
||||||
g_vertex_normal_vert = vec3(0.0, 1.0, 0.0);
|
{
|
||||||
g_vertex_offset_vert = vec4(g_vertex_normal_vert * size_y, 0.0);
|
// vector is in the horizontal plane, radial vector is a simple rotation around Y axis
|
||||||
|
g_radial_plane_vector = vec3(g_vertex_delta.z, 0.0, -g_vertex_delta.x);
|
||||||
|
}
|
||||||
|
else if(g_vertex_delta.x == 0.0 && g_vertex_delta.z == 0.0)
|
||||||
|
{
|
||||||
|
// delta vector is purely vertical, display the line rotated vertically so that it is visible in front and side views
|
||||||
|
g_radial_plane_vector = vec3(1.0, 0.0, -1.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// delta vector is completely 3D
|
||||||
|
g_axial_plane_vector = vec3(g_vertex_delta.x, 0.0, g_vertex_delta.z); // Vector projected in the horizontal plane
|
||||||
|
g_radial_plane_vector = cross(g_vertex_delta, g_axial_plane_vector); // Radial vector in the horizontal plane, pointing right.
|
||||||
|
}
|
||||||
|
|
||||||
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) {
|
g_vertex_normal_horz_head = normalize(g_vertex_delta); //Lengthwise normal vector
|
||||||
vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert);
|
g_vertex_offset_horz_head = vec4(g_vertex_normal_horz_head * size_x, 0.0); //Lengthwise offset vector
|
||||||
|
|
||||||
|
g_vertex_normal_horz = normalize(g_radial_plane_vector); //Normal vector pointing right.
|
||||||
|
g_vertex_offset_horz = vec4(g_vertex_normal_horz * size_x, 0.0); //Offset vector pointing right.
|
||||||
|
|
||||||
|
g_vertex_normal_vert = vec3(0.0, 1.0, 0.0); //Upwards normal vector.
|
||||||
|
g_vertex_offset_vert = vec4(g_vertex_normal_vert * size_y, 0.0); //Upwards offset vector. Goes up by half the layer thickness.
|
||||||
|
|
||||||
|
if ((v_line_type[0] == 8) || (v_line_type[0] == 9) || (v_line_type[0] == 12) || (v_line_type[0] == 13)) {
|
||||||
|
vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz_head + g_vertex_offset_vert);
|
||||||
vec4 va_up = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
vec4 va_up = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
||||||
vec4 va_down = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
vec4 va_down = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
||||||
vec4 vb_head = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head + g_vertex_offset_vert);
|
vec4 vb_head = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert);
|
||||||
vec4 vb_down = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
vec4 vb_down = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert);
|
||||||
vec4 vb_up = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
vec4 vb_up = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert);
|
||||||
|
|
||||||
// Travels: flat plane with pointy ends
|
// Travels: flat plane with pointy ends
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_up);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_head);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_head);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_down);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_down);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_up);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_up);
|
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_down);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_down);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_up);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_up);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_head);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_head);
|
||||||
//And reverse so that the line is also visible from the back side.
|
//And reverse so that the line is also visible from the back side.
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_up);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_up);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_down);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_down);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_up);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_up);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_down);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_down);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_head);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_head);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_up);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_up);
|
||||||
|
|
||||||
EndPrimitive();
|
EndPrimitive();
|
||||||
} else {
|
} else {
|
||||||
vec4 va_m_horz = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz);
|
vec4 va_m_horz = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz); //Line start, left vertex.
|
||||||
vec4 vb_m_horz = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz);
|
vec4 vb_m_horz = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz); //Line end, left vertex.
|
||||||
vec4 va_p_vert = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_vert);
|
vec4 va_p_vert = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_vert); //Line start, top vertex.
|
||||||
vec4 vb_p_vert = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_vert);
|
vec4 vb_p_vert = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_vert); //Line end, top vertex.
|
||||||
vec4 va_p_horz = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz);
|
vec4 va_p_horz = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz); //Line start, right vertex.
|
||||||
vec4 vb_p_horz = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz);
|
vec4 vb_p_horz = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz); //Line end, right vertex.
|
||||||
vec4 va_m_vert = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert);
|
vec4 va_m_vert = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert); //Line start, bottom vertex.
|
||||||
vec4 vb_m_vert = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert);
|
vec4 vb_m_vert = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert); //Line end, bottom vertex.
|
||||||
vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head);
|
vec4 va_head = viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz_head); //Line start, tip.
|
||||||
vec4 vb_head = viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head);
|
vec4 vb_head = viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz_head); //Line end, tip.
|
||||||
|
|
||||||
// All normal lines are rendered as 3d tubes.
|
// All normal lines are rendered as 3d tubes.
|
||||||
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, va_m_horz);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_p_vert);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_p_vert);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_p_vert);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_p_vert);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, va_p_horz);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz, va_p_horz);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_vert, va_m_vert);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_vert, va_m_vert);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, vb_m_vert);
|
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, vb_m_vert);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, va_m_horz);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
||||||
|
|
||||||
EndPrimitive();
|
EndPrimitive();
|
||||||
|
|
||||||
// left side
|
// left side
|
||||||
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, va_m_horz);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, va_p_vert);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_vert, va_p_vert);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz_head, va_head);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz_head, va_head);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, va_p_horz);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz, va_p_horz);
|
||||||
|
|
||||||
EndPrimitive();
|
EndPrimitive();
|
||||||
|
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, va_p_horz);
|
myEmitVertex(v_vertex[0], v_color[1], g_vertex_normal_horz, va_p_horz);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_vert, va_m_vert);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_vert, va_m_vert);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz_head, va_head);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz_head, va_head);
|
||||||
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, va_m_horz);
|
myEmitVertex(v_vertex[0], v_color[1], -g_vertex_normal_horz, va_m_horz);
|
||||||
|
|
||||||
EndPrimitive();
|
EndPrimitive();
|
||||||
|
|
||||||
// right side
|
// right side
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_p_vert);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, vb_p_vert);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, vb_head);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz_head, vb_head);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
||||||
|
|
||||||
EndPrimitive();
|
EndPrimitive();
|
||||||
|
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, vb_m_horz);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, vb_m_vert);
|
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, vb_m_vert);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, vb_head);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz_head, vb_head);
|
||||||
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, vb_p_horz);
|
||||||
|
|
||||||
EndPrimitive();
|
EndPrimitive();
|
||||||
|
|
|
@ -48,8 +48,10 @@ fragment =
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
if ((u_show_travel_moves == 0) && (v_line_type >= 7.5) && (v_line_type <= 9.5))
|
// travel moves: 8, 9, 12, 13
|
||||||
{ // actually, 8 and 9
|
if ((u_show_travel_moves == 0) && (((v_line_type >= 7.5) && (v_line_type <= 9.5)) ||
|
||||||
|
((v_line_type >= 11.5) && (v_line_type <= 13.5)))) {
|
||||||
|
{
|
||||||
// discard movements
|
// discard movements
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +126,9 @@ fragment41core =
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
if ((u_show_travel_moves == 0) && (v_line_type >= 7.5) && (v_line_type <= 9.5)) { // actually, 8 and 9
|
// travel moves: 8, 9, 12, 13
|
||||||
|
if ((u_show_travel_moves == 0) && (((v_line_type >= 7.5) && (v_line_type <= 9.5)) ||
|
||||||
|
((v_line_type >= 11.5) && (v_line_type <= 13.5)))) {
|
||||||
// discard movements
|
// discard movements
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9311,6 +9311,42 @@
|
||||||
"default_value": true,
|
"default_value": true,
|
||||||
"settable_per_mesh": true
|
"settable_per_mesh": true
|
||||||
},
|
},
|
||||||
|
"retraction_during_travel_ratio":
|
||||||
|
{
|
||||||
|
"label": "Retraction During Travel Move",
|
||||||
|
"description": "<html>The ratio of retraction performed during the travel move, with the remainder completed while the nozzle is stationary, before traveling<ul><li>When 0, the entire retraction is performed while stationary, before the travel begins</li><li>When 100, the entire retraction is performed during the travel move, bypassing the stationary phase</li></ul></html>",
|
||||||
|
"unit": "%",
|
||||||
|
"type": "float",
|
||||||
|
"default_value": 0,
|
||||||
|
"minimum_value": 0,
|
||||||
|
"maximum_value": 100,
|
||||||
|
"enabled": "retraction_enable and not machine_firmware_retract and machine_gcode_flavor != \"UltiGCode\" and machine_gcode_flavor != \"BFB\"",
|
||||||
|
"settable_per_mesh": false,
|
||||||
|
"settable_per_extruder": true
|
||||||
|
},
|
||||||
|
"keep_retracting_during_travel":
|
||||||
|
{
|
||||||
|
"label": "Keep Retracting During Travel",
|
||||||
|
"description": "When retraction during travel is enabled, and there is more than enough time to perform a full retract during a travel move, spread the retraction over the whole travel move with a lower retraction speed, so that we do not travel with a non-retracting nozzle. This can help reducing oozing.",
|
||||||
|
"type": "bool",
|
||||||
|
"default_value": false,
|
||||||
|
"enabled": "retraction_enable and not machine_firmware_retract and machine_gcode_flavor != \"UltiGCode\" and machine_gcode_flavor != \"BFB\" and retraction_during_travel_ratio > 0",
|
||||||
|
"settable_per_mesh": false,
|
||||||
|
"settable_per_extruder": true
|
||||||
|
},
|
||||||
|
"prime_during_travel_ratio":
|
||||||
|
{
|
||||||
|
"label": "Prime During Travel Move",
|
||||||
|
"description": "<html>The ratio of priming performed during the travel move, with the remainder completed while the nozzle is stationary, after traveling<ul><li>When 0, the entire priming is performed while stationary, after the travel ends</li><li>When 100, the entire priming is performed during the travel move, allowing the print to start immediately</li></ul></html>",
|
||||||
|
"unit": "%",
|
||||||
|
"type": "float",
|
||||||
|
"default_value": 0,
|
||||||
|
"minimum_value": 0,
|
||||||
|
"maximum_value": 100,
|
||||||
|
"enabled": "retraction_enable and not machine_firmware_retract and machine_gcode_flavor != \"UltiGCode\" and machine_gcode_flavor != \"BFB\"",
|
||||||
|
"settable_per_mesh": false,
|
||||||
|
"settable_per_extruder": true
|
||||||
|
},
|
||||||
"scarf_joint_seam_length":
|
"scarf_joint_seam_length":
|
||||||
{
|
{
|
||||||
"label": "Scarf Seam Length",
|
"label": "Scarf Seam Length",
|
||||||
|
|
|
@ -463,6 +463,8 @@
|
||||||
"layerview_support_infill": [0, 230, 230, 127],
|
"layerview_support_infill": [0, 230, 230, 127],
|
||||||
"layerview_move_combing": [0, 0, 255, 255],
|
"layerview_move_combing": [0, 0, 255, 255],
|
||||||
"layerview_move_retraction": [128, 127, 255, 255],
|
"layerview_move_retraction": [128, 127, 255, 255],
|
||||||
|
"layerview_move_while_retracting": [127, 255, 255, 255],
|
||||||
|
"layerview_move_while_unretracting": [255, 127, 255, 255],
|
||||||
"layerview_support_interface": [63, 127, 255, 127],
|
"layerview_support_interface": [63, 127, 255, 127],
|
||||||
"layerview_prime_tower": [0, 255, 255, 255],
|
"layerview_prime_tower": [0, 255, 255, 255],
|
||||||
"layerview_nozzle": [224, 192, 16, 64],
|
"layerview_nozzle": [224, 192, 16, 64],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue