Skip to content

Commit b01cfe4

Browse files
committed
change color and fix rsbuild hoisting var bug
1 parent 22483d7 commit b01cfe4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

renderer/viewer/three/panorama.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ export class PanoramaRenderer {
3131
private readonly abortController = new AbortController()
3232
private worldRenderer: WorldRendererCommon | WorldRendererThree | undefined
3333
public WorldRendererClass = WorldRendererThree
34+
public startTimes = new Map<THREE.MeshBasicMaterial, number>()
3435

3536
constructor (private readonly documentRenderer: DocumentRenderer, private readonly options: GraphicsInitOptions, private readonly doWorldBlocksPanorama = false) {
3637
this.scene = new THREE.Scene()
37-
// dark blue background
38-
this.scene.background = new THREE.Color(0x00_22_11)
38+
// #324568
39+
this.scene.background = new THREE.Color(0x32_45_68)
3940

4041
// Add ambient light
4142
this.ambientLight = new THREE.AmbientLight(0xcc_cc_cc)
@@ -73,13 +74,15 @@ export class PanoramaRenderer {
7374
const panorGeo = new THREE.BoxGeometry(1000, 1000, 1000)
7475
const loader = new THREE.TextureLoader()
7576
const panorMaterials = [] as THREE.MeshBasicMaterial[]
76-
const startTimes = new Map<THREE.MeshBasicMaterial, number>()
7777
const fadeInDuration = 200
7878

7979
for (const file of panoramaFiles) {
80+
// eslint-disable-next-line prefer-const
81+
let material: THREE.MeshBasicMaterial
82+
8083
const texture = loader.load(join('background', file), () => {
8184
// Start fade-in when texture is loaded
82-
startTimes.set(material, Date.now())
85+
this.startTimes.set(material, Date.now())
8386
})
8487

8588
// Instead of using repeat/offset to flip, we'll use the texture matrix
@@ -93,7 +96,7 @@ export class PanoramaRenderer {
9396
texture.minFilter = THREE.LinearFilter
9497
texture.magFilter = THREE.LinearFilter
9598

96-
const material = new THREE.MeshBasicMaterial({
99+
material = new THREE.MeshBasicMaterial({
97100
map: texture,
98101
transparent: true,
99102
side: THREE.DoubleSide,
@@ -111,7 +114,7 @@ export class PanoramaRenderer {
111114

112115
// Time-based fade in animation for each material
113116
for (const material of panorMaterials) {
114-
const startTime = startTimes.get(material)
117+
const startTime = this.startTimes.get(material)
115118
if (startTime) {
116119
const elapsed = Date.now() - startTime
117120
const progress = Math.min(1, elapsed / fadeInDuration)

0 commit comments

Comments
 (0)