Skip to content

Commit

Permalink
fix camera desync issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed May 5, 2024
1 parent 228d600 commit d1d47b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion prismarine-viewer/viewer/lib/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export class Viewer {
scene: THREE.Scene
ambientLight: THREE.AmbientLight
directionalLight: THREE.DirectionalLight
camera: THREE.PerspectiveCamera
world: WorldRendererCommon
entities: Entities
// primitives: Primitives
Expand All @@ -25,6 +24,13 @@ export class Viewer {
renderingUntilNoUpdates = false
processEntityOverrides = (e, overrides) => overrides

get camera () {
return this.world.camera
}
set camera (camera) {
this.world.camera = camera
}

constructor(public renderer: THREE.WebGLRenderer, worldConfig = defaultWorldRendererConfig) {
// https://discourse.threejs.org/t/updates-to-color-management-in-three-js-r152/50791
THREE.ColorManagement.enabled = false
Expand Down
1 change: 1 addition & 0 deletions prismarine-viewer/viewer/lib/worldrendererCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export abstract class WorldRendererCommon<WorkerSend = any, WorkerReceive = any>
allChunksFinished = false
handleResize = () => { }
mesherConfig = defaultMesherConfig
camera: THREE.PerspectiveCamera

abstract outputFormat: 'threeJs' | 'webgl'

Expand Down

0 comments on commit d1d47b3

Please sign in to comment.