Pass the cached normal transformation to the rendere

CURA-7106
This commit is contained in:
Jaime van Kessel 2020-06-30 13:39:32 +02:00
parent ccd9a17be4
commit 440474b1e8
No known key found for this signature in database
GPG key ID: 3710727397403C91
3 changed files with 4 additions and 4 deletions

View file

@ -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())

View file

@ -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()

View file

@ -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)