mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
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".
This commit is contained in:
parent
d88724aff5
commit
a536da503b
2 changed files with 8 additions and 8 deletions
|
@ -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
|
# 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
|
# 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):
|
def __init__(self, width: int, height: int):
|
||||||
super().__init__("depth", width, height)
|
super().__init__("picking", width, height)
|
||||||
|
|
||||||
self._renderer = Application.getInstance().getRenderer()
|
self._renderer = Application.getInstance().getRenderer()
|
||||||
|
|
|
@ -13,7 +13,7 @@ from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator
|
||||||
from cura.Scene.BuildPlateDecorator import BuildPlateDecorator
|
from cura.Scene.BuildPlateDecorator import BuildPlateDecorator
|
||||||
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
||||||
from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator
|
from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator
|
||||||
from cura.DepthPass import DepthPass
|
from cura.PickingPass import PickingPass
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
@ -30,13 +30,13 @@ class SupportEraser(Tool):
|
||||||
if event.type == Event.MousePressEvent and self._controller.getToolsEnabled():
|
if event.type == Event.MousePressEvent and self._controller.getToolsEnabled():
|
||||||
active_camera = self._controller.getScene().getActiveCamera()
|
active_camera = self._controller.getScene().getActiveCamera()
|
||||||
|
|
||||||
# Create depth pass for picking
|
# Create a pass for picking a world-space location from the mouse location
|
||||||
depth_pass = DepthPass(active_camera.getViewportWidth(), active_camera.getViewportHeight())
|
picking_pass = PickingPass(active_camera.getViewportWidth(), active_camera.getViewportHeight())
|
||||||
depth_pass.render()
|
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)
|
self._createEraserMesh(picked_position)
|
||||||
|
|
||||||
def _createEraserMesh(self, position: Vector):
|
def _createEraserMesh(self, position: Vector):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue