From a536da503bf374f5db0fec5180e9989294f77c22 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 13 Mar 2018 20:40:41 +0100 Subject: [PATCH] Rename DepthPass to PickingPass The map created by the shader is not strictly a depth map; not only is the "depth" encoded in the rgb channels, but it is also a distance to the camera instead of a "scene depth". --- cura/{DepthPass.py => PickingPass.py} | 4 ++-- plugins/SupportEraser/SupportEraser.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) rename cura/{DepthPass.py => PickingPass.py} (97%) diff --git a/cura/DepthPass.py b/cura/PickingPass.py similarity index 97% rename from cura/DepthPass.py rename to cura/PickingPass.py index 4435d533ff..4bd893e926 100644 --- a/cura/DepthPass.py +++ b/cura/PickingPass.py @@ -15,9 +15,9 @@ from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator # The texture is used to map a 2d location (eg the mouse location) to a world space position # # Note that in order to increase precision, the 24 bit depth value is encoded into all three of the R,G & B channels -class DepthPass(RenderPass): +class PickingPass(RenderPass): def __init__(self, width: int, height: int): - super().__init__("depth", width, height) + super().__init__("picking", width, height) self._renderer = Application.getInstance().getRenderer() diff --git a/plugins/SupportEraser/SupportEraser.py b/plugins/SupportEraser/SupportEraser.py index 0ddfed0cf1..35713805bc 100644 --- a/plugins/SupportEraser/SupportEraser.py +++ b/plugins/SupportEraser/SupportEraser.py @@ -13,7 +13,7 @@ from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator from cura.Scene.BuildPlateDecorator import BuildPlateDecorator from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator -from cura.DepthPass import DepthPass +from cura.PickingPass import PickingPass import os import os.path @@ -30,13 +30,13 @@ class SupportEraser(Tool): if event.type == Event.MousePressEvent and self._controller.getToolsEnabled(): active_camera = self._controller.getScene().getActiveCamera() - # Create depth pass for picking - depth_pass = DepthPass(active_camera.getViewportWidth(), active_camera.getViewportHeight()) - depth_pass.render() + # Create a pass for picking a world-space location from the mouse location + picking_pass = PickingPass(active_camera.getViewportWidth(), active_camera.getViewportHeight()) + picking_pass.render() - picked_position = depth_pass.getPickedPosition(event.x, event.y) + picked_position = picking_pass.getPickedPosition(event.x, event.y) - # Add the anto_overhang_mesh cube: + # Add the anti_overhang_mesh cube at the picked location self._createEraserMesh(picked_position) def _createEraserMesh(self, position: Vector):