Skip to content

Commit

Permalink
Fix node picking regression (#7732)
Browse files Browse the repository at this point in the history
* Fix node picking regression that allowed to select nodes that were not visible. Fix far clipping distance for flight/oblique mode.

* update changelog
  • Loading branch information
daniel-wer authored Apr 3, 2024
1 parent c5a52fe commit 162ac5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Fixed that the Command modifier on MacOS wasn't treated correctly for some shortcuts. Also, instead of the Alt key, the ⌥ key is shown as a hint in the status bar on MacOS. [#7659](https://github.com/scalableminds/webknossos/pull/7659)
- Moving from the time tracking overview to its detail view, the selected user was not preselected in the next view. [#7722](https://github.com/scalableminds/webknossos/pull/7722)
- Fixed incorrect position of WEBKNOSSOS logo in screenshots. [#7726](https://github.com/scalableminds/webknossos/pull/7726)
- Fixed that invisible nodes could be selected when using the skeleton tool. [#7732](https://github.com/scalableminds/webknossos/pull/7732)

### Removed

Expand Down
19 changes: 11 additions & 8 deletions frontend/javascripts/oxalis/view/rendering_utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as THREE from "three";
import { saveAs } from "file-saver";
import Store from "oxalis/store";
import { OrthoView } from "oxalis/constants";
import { ARBITRARY_CAM_DISTANCE, OrthoView } from "oxalis/constants";
import constants, {
ArbitraryViewport,
OrthoViewColors,
Expand Down Expand Up @@ -59,25 +59,28 @@ export function renderToTexture(
// Don't respect withFarClipping for the TDViewport as we don't do any clipping for
// nodes there.
if (withFarClipping && plane !== OrthoViews.TDView) {
function adaptCameraToCurrentClippingDistance(
camera: THREE.OrthographicCamera | THREE.PerspectiveCamera,
) {
function adaptCameraToCurrentClippingDistance<
T extends THREE.OrthographicCamera | THREE.PerspectiveCamera,
>(camera: T): T {
const isArbitraryMode = constants.MODES_ARBITRARY.includes(
state.temporaryConfiguration.viewMode,
);
camera = camera.clone();
camera = camera.clone() as T;
// The near value is already set in the camera (done in the CameraController/ArbitraryView).
if (isArbitraryMode) {
camera.far = state.userConfiguration.clippingDistanceArbitrary;
// The far value has to be set, since in normal rendering the far clipping is
// achieved by the data plane which is not rendered during node picking
camera.far = ARBITRARY_CAM_DISTANCE;
} else {
// The near value is already set in the camera (done in the CameraController).
// The far value has to be set, since in normal rendering the far clipping is
// achieved by offsetting the plane instead of setting the far property.
camera.far = state.userConfiguration.clippingDistance;
}
camera.updateProjectionMatrix();
return camera;
}

adaptCameraToCurrentClippingDistance(camera);
camera = adaptCameraToCurrentClippingDistance(camera);
}

clearColor = clearColor != null ? clearColor : 0x000000;
Expand Down

0 comments on commit 162ac5a

Please sign in to comment.