Skip to content

Commit

Permalink
Fix precomputed mesh positions (#6588)
Browse files Browse the repository at this point in the history
* fix precomputed mesh positions by scaling the whole group instead of each chunk on its own
* update changelog
* Merge branch 'master' into fix-mesh-positions
* Merge branch 'master' into fix-mesh-positions
  • Loading branch information
daniel-wer authored Oct 25, 2022
1 parent 8e067e0 commit 27966b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released

### Fixed
- Fixed a rare crash in newer Firefox versions. [#6561](https://github.com/scalableminds/webknossos/pull/6561)
- Fixed the positions of precomputed meshes when using a v3 mesh file. [#6588](https://github.com/scalableminds/webknossos/pull/6588)

### Removed

Expand Down
4 changes: 4 additions & 0 deletions frontend/javascripts/oxalis/controller/scene_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ class SceneController {
segmentationId: number,
passive: boolean = false,
offset: Vector3 | null = null,
scale: Vector3 | null = null,
): void {
if (this.isosurfacesGroupsPerSegmentationId[segmentationId] == null) {
const newGroup = new THREE.Group();
Expand All @@ -279,6 +280,9 @@ class SceneController {
newGroup.cellId = segmentationId;
// @ts-ignore
newGroup.passive = passive;
if (scale != null) {
newGroup.scale.copy(new THREE.Vector3(...scale));
}
}
const mesh = this.constructIsosurfaceMesh(segmentationId, geometry, passive);
if (offset) {
Expand Down
6 changes: 2 additions & 4 deletions frontend/javascripts/oxalis/model/sagas/isosurface_saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,17 +680,15 @@ function* loadPrecomputedMeshForSegmentId(
const geometry = yield* call(loader.decodeDracoFileAsync, dracoData);
// Compute vertex normals to achieve smooth shading
geometry.computeVertexNormals();
// Apply the scale from the segment info, which includes dataset scale and mag
if (scale != null) {
geometry.scale(...scale);
}

yield* call(
{ context: sceneController, fn: sceneController.addIsosurfaceFromGeometry },
geometry,
id,
false,
chunk.position,
// Apply the scale from the segment info, which includes dataset scale and mag
scale,
);
} else {
// V0
Expand Down

0 comments on commit 27966b9

Please sign in to comment.