[3d] initial version of 3d viewer (#3968)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Terry Jia
2025-08-11 00:09:19 -04:00
committed by GitHub
parent 8e357c41e3
commit d22d62b670
46 changed files with 2071 additions and 42 deletions

View File

@@ -179,12 +179,16 @@ export class CameraManager implements CameraManagerInterface {
}
handleResize(width: number, height: number): void {
const aspect = width / height
this.updateAspectRatio(aspect)
}
updateAspectRatio(aspect: number): void {
if (this.activeCamera === this.perspectiveCamera) {
this.perspectiveCamera.aspect = width / height
this.perspectiveCamera.aspect = aspect
this.perspectiveCamera.updateProjectionMatrix()
} else {
const frustumSize = 10
const aspect = width / height
this.orthographicCamera.left = (-frustumSize * aspect) / 2
this.orthographicCamera.right = (frustumSize * aspect) / 2
this.orthographicCamera.top = frustumSize / 2