Skip to content

Commit 45eec33

Browse files
committed
Dimension background change
1 parent 2aed295 commit 45eec33

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

coffee/client/js/index.coffee

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ class Game
4040
canvas:@canvas
4141
PixelRatio:window.devicePixelRatio
4242
@scene=new THREE.Scene
43-
@scene.background = new THREE.Color "#adc8ff"
43+
@dimBg=
44+
"minecraft:overworld":new THREE.Color "#adc8ff"
45+
"minecraft:the_end":new THREE.Color "#011433"
46+
"minecraft:the_nether":new THREE.Color "#85280f"
4447
@camera = new THREE.PerspectiveCamera @fov, 2, 0.1, 1000
4548
@camera.rotation.order = "YXZ"
4649
@camera.position.set 26, 26, 26
@@ -91,6 +94,8 @@ class Game
9194
_this.dimension=dim
9295
console.log "Player dimension has been changed: #{dim}"
9396
_this.world.resetWorld()
97+
_this.scene.background=_this.dimBg[dim]
98+
_this.scene.fog.color=_this.dimBg[dim]
9499
return
95100
"mapChunk":(sections,x,z,biomes,dim)->
96101
_this.world._computeSections sections,x,z,biomes,dim
@@ -148,7 +153,7 @@ class Game
148153
chunkdist:3
149154
gui.add( @params, "fog" ).name( "Enable fog" ).listen().onChange ()->
150155
if _this.params.fog
151-
_this.scene.fog = new THREE.Fog (new THREE.Color "#adc8ff"), (_this.params.chunkdist-2.5)*16, (_this.params.chunkdist-0.5)*16
156+
_this.scene.fog = new THREE.Fog _this.dimBg[_this.dimension], (_this.params.chunkdist-2.5)*16, (_this.params.chunkdist-0.5)*16
152157
else
153158
_this.scene.fog = null
154159
gui.add( @world.material, "wireframe" ).name( "Wireframe" ).listen()

src/client/js/index.js

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)