Skip to content

Commit

Permalink
Merge pull request #19799 from Ultimaker/CURA-12188_build_plate_z_fig…
Browse files Browse the repository at this point in the history
…hting

[CURA-12188] Fix build plate z-fighting
  • Loading branch information
HellAholic authored Nov 8, 2024
2 parents 32833df + 8632f79 commit 2c42766
Show file tree
Hide file tree
Showing 36 changed files with 5,140 additions and 3,477 deletions.
12 changes: 8 additions & 4 deletions cura/BuildVolume.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,19 +252,23 @@ def render(self, renderer):
if not self.getMeshData() or not self.isVisible():
return True

theme = self._application.getTheme()
if not self._shader:
self._shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "default.shader"))
self._grid_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "grid.shader"))
theme = self._application.getTheme()
self._grid_shader.setUniformValue("u_plateColor", Color(*theme.getColor("buildplate").getRgb()))
self._grid_shader.setUniformValue("u_gridColor0", Color(*theme.getColor("buildplate_grid").getRgb()))
self._grid_shader.setUniformValue("u_gridColor1", Color(*theme.getColor("buildplate_grid_minor").getRgb()))

plate_color = Color(*theme.getColor("buildplate").getRgb())
if self._global_container_stack.getMetaDataEntry("has_textured_buildplate", False):
plate_color.setA(0.5)
self._grid_shader.setUniformValue("u_plateColor", plate_color)

renderer.queueNode(self, mode = RenderBatch.RenderMode.Lines)
renderer.queueNode(self, mesh = self._origin_mesh, backface_cull = True)
renderer.queueNode(self, mesh = self._grid_mesh, shader = self._grid_shader, backface_cull = True)
renderer.queueNode(self, mesh = self._grid_mesh, shader = self._grid_shader, backface_cull = True, transparent = True, sort = -10)
if self._disallowed_area_mesh:
renderer.queueNode(self, mesh = self._disallowed_area_mesh, shader = self._shader, transparent = True, backface_cull = True, sort = -9)
renderer.queueNode(self, mesh = self._disallowed_area_mesh, shader = self._shader, transparent = True, backface_cull = True, sort = -5)

if self._error_mesh:
renderer.queueNode(self, mesh=self._error_mesh, shader=self._shader, transparent=True,
Expand Down
4 changes: 2 additions & 2 deletions plugins/SimulationView/layers3d.shader
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@ geometry41core =
((v_prev_line_type[0] != 1) && (v_line_type[0] == 1)) ||
((v_prev_line_type[0] != 4) && (v_line_type[0] == 4))
)) {
float w = size_x;
float h = size_y;
float w = max(0.05, size_x);
float h = max(0.05, size_y);

myEmitVertex(v_vertex[0] + vec3( w, h, w), u_starts_color, normalize(vec3( 1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, w, 0.0))); // Front-top-left
myEmitVertex(v_vertex[0] + vec3(-w, h, w), u_starts_color, normalize(vec3(-1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, w, 0.0))); // Front-top-right
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/ankermake_m5.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "ankermake_m5_platform.obj",
"has_machine_quality": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "ankermake_m5_extruder_0" },
"platform_texture": "ankermake_m5.png",
"preferred_material": "generic_pla",
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/ankermake_m5c.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "ankermake_m5c_platform.obj",
"has_machine_quality": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "ankermake_m5c_extruder_0" },
"platform_texture": "ankermake_m5c.png",
"preferred_material": "generic_pla",
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/dagoma_sigma_pro.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"platform": "dagoma_sigma_pro.obj",
"first_start_actions": [ "MachineSettingsAction" ],
"has_machine_quality": true,
"has_textured_buildplate": true,
"has_variants": true,
"machine_extruder_trains": { "0": "dagoma_sigma_pro_extruder" },
"platform_texture": "dagoma_sigma_pro.png",
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/dagoma_sigma_pro_dual.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"platform": "dagoma_sigma_pro.obj",
"first_start_actions": [ "MachineSettingsAction" ],
"has_machine_quality": true,
"has_textured_buildplate": true,
"has_variants": true,
"machine_extruder_trains":
{
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/fdmprinter.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"preferred_material": "generic_pla",
"preferred_quality_type": "normal",
"machine_extruder_trains": { "0": "fdmextruder" },
"has_textured_buildplate": false,
"supports_usb_connection": true,
"supports_network_connection": false,
"supports_abstract_color": false,
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/flyingbear_ghost_4s.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"visible": true,
"author": "oducceu",
"platform": "flyingbear_platform.obj",
"has_textured_buildplate": true,
"platform_texture": "flyingbear_platform.png",
"quality_definition": "flyingbear_base"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/flyingbear_ghost_5.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"visible": true,
"author": "oducceu",
"platform": "flyingbear_platform.obj",
"has_textured_buildplate": true,
"platform_texture": "flyingbear_platform.png",
"quality_definition": "flyingbear_base"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/flyingbear_ghost_6.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"visible": true,
"author": "barrnet",
"platform": "flyingbear_platform.obj",
"has_textured_buildplate": true,
"platform_texture": "flyingbear_platform.png",
"quality_definition": "flyingbear_base"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_adonis.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "hellbot_adonis.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_adonis_extruder" },
"platform_offset": [
0,
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_hidra.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "hellbot_hidra.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_hidra_extruder_0",
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_hidra_plus.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "hellbot_hidra_plus.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_hidra_plus_extruder_0",
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_2_230.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_230.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_2_230_extruder_0" },
"platform_texture": "Magna2_230.png"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_2_230_dual.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_230.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_magna_2_230_dual_extruder_0",
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_2_300.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_300.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_2_300_extruder_0" },
"platform_texture": "Magna2_300.png"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_2_300_dual.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_300.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_magna_2_300_dual_extruder_0",
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_2_400.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_400.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_2_400_extruder_0" },
"platform_texture": "Magna2_400.png"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_2_400_dual.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_400.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_magna_2_400_dual_extruder_0",
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_2_500.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_500.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_2_500_extruder_0" },
"platform_texture": "Magna2_500.png"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_2_500_dual.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_500.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_magna_2_500_dual_extruder_0",
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_I.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "hellbot_magna.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_i_extruder" },
"platform_offset": [
0,
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_SE.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "hellbot_magna_SE.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_SE_extruder" },
"platform_texture": "hellbot_magna_SE.png"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_SE_300.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_SE_300.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_SE_300_extruder" },
"platform_texture": "Hellbot_Magna_SE_300.png"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_SE_Pro.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_SE_Pro.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_SE_Pro_extruder" },
"platform_texture": "Hellbot_magna_SE_Pro.png"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/hellbot_magna_dual.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "hellbot_magna.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_magna_dual_extruder_1",
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/koonovo_base.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"first_start_actions": [ "MachineSettingsAction" ],
"has_machine_quality": true,
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "koonovo_base_extruder_0" },
"platform_texture": "koonovo.png",
"preferred_material": "generic_pla",
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/peopoly_moai.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"platform": "moai.obj",
"has_machine_quality": true,
"has_materials": false,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "peopoly_moai_extruder_0" },
"platform_texture": "moai.jpg"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/ultimaker_sketch_sprint.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
],
"has_machine_quality": true,
"has_materials": true,
"has_textured_buildplate": true,
"has_variants": true,
"machine_extruder_trains": { "0": "ultimaker_sketch_sprint_extruder" },
"platform_offset": [
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/uni_200.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"visible": true,
"author": "Nail` Gimadeev (C)",
"platform": "uni_200_platform.stl",
"has_textured_buildplate": true,
"platform_texture": "uni.png",
"quality_definition": "uni_base"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/uni_250.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"visible": true,
"author": "Nail` Gimadeev (C)",
"platform": "uni_250_platform.stl",
"has_textured_buildplate": true,
"platform_texture": "uni.png",
"quality_definition": "uni_base"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/uni_300.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"visible": true,
"author": "Nail` Gimadeev (C)",
"platform": "uni_300_platform.stl",
"has_textured_buildplate": true,
"platform_texture": "uni.png",
"quality_definition": "uni_base"
},
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/uni_mini.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"visible": true,
"author": "Nail` Gimadeev (C)",
"platform": "uni_mini_platform.stl",
"has_textured_buildplate": true,
"platform_texture": "uni.png",
"quality_definition": "uni_base"
},
Expand Down
Binary file modified resources/images/MakerbotSketchSprint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2c42766

Please sign in to comment.