Browse Source

Merge remote-tracking branch 'origin/master'

Nino van Hooff 4 years ago
parent
commit
99f4c1a2d3
4 changed files with 6 additions and 5 deletions
  1. 1 1
      cura/PickingPass.py
  2. 2 1
      cura/Scene/ConvexHullNode.py
  3. 1 1
      cura/XRayPass.py
  4. 2 2
      plugins/SolidView/SolidView.py

+ 1 - 1
cura/PickingPass.py

@@ -54,7 +54,7 @@ class PickingPass(RenderPass):
         # Fill up the batch with objects that can be sliced. `
         for node in DepthFirstIterator(self._scene.getRoot()): #type: ignore #Ignore type error because iter() should get called automatically by Python syntax.
             if node.callDecoration("isSliceable") and node.getMeshData() and node.isVisible():
-                batch.addItem(node.getWorldTransformation(copy = False), node.getMeshData())
+                batch.addItem(node.getWorldTransformation(copy = False), node.getMeshData(), normal_transformation=node.getCachedNormalMatrix())
 
         self.bind()
         batch.render(self._scene.getActiveCamera())

+ 2 - 1
cura/Scene/ConvexHullNode.py

@@ -61,6 +61,7 @@ class ConvexHullNode(SceneNode):
                 if hull_mesh_builder.addConvexPolygon(
                     self._hull.getPoints()[::],  # bottom layer is reversed
                     self._mesh_height, color = self._color):
+                    hull_mesh_builder.resetNormals()
 
                     hull_mesh = hull_mesh_builder.build()
                     self.setMeshData(hull_mesh)
@@ -68,7 +69,7 @@ class ConvexHullNode(SceneNode):
                 if hull_mesh_builder.addConvexPolygonExtrusion(
                     self._hull.getPoints()[::-1],  # bottom layer is reversed
                     self._mesh_height - thickness, self._mesh_height, color = self._color):
-
+                    hull_mesh_builder.resetNormals()
                     hull_mesh = hull_mesh_builder.build()
                     self.setMeshData(hull_mesh)
 

+ 1 - 1
cura/XRayPass.py

@@ -29,7 +29,7 @@ class XRayPass(RenderPass):
         batch = RenderBatch(self._shader, type = RenderBatch.RenderType.NoType, backface_cull = False, blend_mode = RenderBatch.BlendMode.Additive)
         for node in DepthFirstIterator(self._scene.getRoot()):
             if isinstance(node, CuraSceneNode) and node.getMeshData() and node.isVisible():
-                batch.addItem(node.getWorldTransformation(copy = False), node.getMeshData())
+                batch.addItem(node.getWorldTransformation(copy = False), node.getMeshData(), normal_transformation=node.getCachedNormalMatrix())
 
         self.bind()
 

+ 2 - 2
plugins/SolidView/SolidView.py

@@ -244,7 +244,7 @@ class SolidView(View):
                     else:
                         renderer.queueNode(node, shader = self._non_printing_shader, transparent = True)
                 elif getattr(node, "_outside_buildarea", False):
-                    disabled_batch.addItem(node.getWorldTransformation(copy = False), node.getMeshData())
+                    disabled_batch.addItem(node.getWorldTransformation(copy = False), node.getMeshData(), normal_transformation = node.getCachedNormalMatrix())
                 elif per_mesh_stack and node.callDecoration("isSupportMesh"):
                     # Render support meshes with a vertical stripe that is darker
                     shade_factor = 0.6
@@ -256,7 +256,7 @@ class SolidView(View):
                     ]
                     renderer.queueNode(node, shader = self._support_mesh_shader, uniforms = uniforms)
                 else:
-                    normal_object_batch.addItem(node.getWorldTransformation(copy=False), node.getMeshData(), uniforms=uniforms)
+                    normal_object_batch.addItem(node.getWorldTransformation(copy=False), node.getMeshData(), uniforms=uniforms, normal_transformation = node.getCachedNormalMatrix())
             if node.callDecoration("isGroup") and Selection.isSelected(node):
                 renderer.queueNode(scene.getRoot(), mesh = node.getBoundingBoxMesh(), mode = RenderBatch.RenderMode.LineLoop)