Compare commits

...

1 Commits

Author SHA1 Message Date
Terry Jia
e4bb21506f fix: replace deprecated THREE.Clock with THREE.Timer in Load3d viewport 2026-07-09 14:51:54 -04:00
2 changed files with 5 additions and 5 deletions

View File

@@ -517,7 +517,7 @@ describe('Load3d', () => {
STATUS_MOUSE_ON_SCENE: false,
STATUS_MOUSE_ON_VIEWER: false,
INITIAL_RENDER_DONE: false,
clock: new THREE.Clock(),
timer: new THREE.Timer(),
animationManager: {
update: animationUpdate,
isAnimationPlaying: false,

View File

@@ -30,7 +30,7 @@ export type Viewport3dDeps = {
}
export class Viewport3d extends WebGLViewport {
protected clock: THREE.Clock
protected timer: THREE.Timer
private renderLoop: RenderLoopHandle | null = null
private onContextMenuCallback?: (event: MouseEvent) => void
private getDimensionsCallback?: () => { width: number; height: number } | null
@@ -64,7 +64,7 @@ export class Viewport3d extends WebGLViewport {
options: Load3DOptions = {}
) {
super(deps.renderer)
this.clock = new THREE.Clock()
this.timer = new THREE.Timer()
this.isViewerMode = options.isViewerMode || false
this.onContextMenuCallback = options.onContextMenu
this.getDimensionsCallback = options.getDimensions
@@ -157,7 +157,7 @@ export class Viewport3d extends WebGLViewport {
}
forceRender(): void {
const delta = this.clock.getDelta()
const delta = this.timer.update().getDelta()
this.tickPerFrame(delta)
this.renderMainScene()
@@ -267,7 +267,7 @@ export class Viewport3d extends WebGLViewport {
protected startAnimation(): void {
this.renderLoop = startRenderLoop({
tick: () => {
const delta = this.clock.getDelta()
const delta = this.timer.update().getDelta()
this.tickPerFrame(delta)
this.renderMainScene()
this.resetViewport()