stone order
This commit is contained in:
parent
8da4ab64a8
commit
fb68cfbd18
|
@ -28,6 +28,7 @@ class Pos
|
||||||
if Number.isNaN @x
|
if Number.isNaN @x
|
||||||
throw new Error
|
throw new Error
|
||||||
|
|
||||||
|
length: -> Math.sqrt @x*@x + @y*@y + @z*@z
|
||||||
vector: -> new Vector @x, @y, @z
|
vector: -> new Vector @x, @y, @z
|
||||||
minus: (p) -> new Pos @x-p.x, @y-p.y, @z-p.z
|
minus: (p) -> new Pos @x-p.x, @y-p.y, @z-p.z
|
||||||
plus: (p) -> new Pos @x+p.x, @y+p.y, @z+p.z
|
plus: (p) -> new Pos @x+p.x, @y+p.y, @z+p.z
|
||||||
|
|
|
@ -678,6 +678,17 @@ class World extends Actor
|
||||||
|
|
||||||
@player.setOpacity clamp 0, 1, @player.camera.getPosition().minus(@player.current_position).length()-0.4
|
@player.setOpacity clamp 0, 1, @player.camera.getPosition().minus(@player.current_position).length()-0.4
|
||||||
|
|
||||||
|
stones = []
|
||||||
|
for o in @objects
|
||||||
|
if o instanceof Stone
|
||||||
|
stones.push o
|
||||||
|
stones.sort (a,b) => b.getPos().minus(@player.camera.getPosition()).length() - a.getPos().minus(@player.camera.getPosition()).length()
|
||||||
|
|
||||||
|
order = 100
|
||||||
|
for stone in stones
|
||||||
|
stone.mesh.renderOrder = order
|
||||||
|
order += 1
|
||||||
|
|
||||||
@sun.position.copy camera.position
|
@sun.position.copy camera.position
|
||||||
@renderer.render @scene, camera
|
@renderer.render @scene, camera
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user