Skip to content

Commit

Permalink
trying to get ortho camera to work
Browse files Browse the repository at this point in the history
  • Loading branch information
frasercl committed Oct 11, 2024
1 parent 1a9d435 commit 1bbcfd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/visGeometry/VolumeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ export default class VolumeModel {
}

public getObject3D(): Object3D | undefined {
// TODO showing bounding box for debugging purposes.
// Do we want it on by default in production? Probably not?
this.drawable?.setShowBoundingBox(true);
return this.drawable?.sceneRoot;
}

Expand All @@ -101,9 +98,15 @@ export default class VolumeModel {
public onBeforeRender(
context: HasThreeJsContext,
width: number,
height: number
height: number,
orthoScale: number | undefined
): void {
if (this.drawable) {
const isOrtho = orthoScale !== undefined;
this.drawable.setIsOrtho(isOrtho);
if (isOrtho) {
this.drawable.setOrthoScale(orthoScale);
}
this.drawable.setResolution(width, height);

Check failure on line 110 in src/visGeometry/VolumeModel.ts

View workflow job for this annotation

GitHub Actions / Type Check

Expected 1 arguments, but got 2.
this.drawable.onAnimate(context);
}
Expand Down
8 changes: 7 additions & 1 deletion src/visGeometry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1040,10 +1040,16 @@ class VisGeometry {
} else if (displayType === GeometryDisplayType.VOLUME) {
const volObj = entry.geometry.getObject3D();
if (volObj) {
const isOrtho = (this.camera as OrthographicCamera)
.isOrthographicCamera;
const orthoScale = isOrtho
? this.camera.zoom
: undefined;
entry.geometry.onBeforeRender(
volRenderContext,
canvasWidth,
canvasHeight
canvasHeight,
orthoScale
);
this.tempVolumeGroup.add(volObj);
}
Expand Down

0 comments on commit 1bbcfd9

Please sign in to comment.