Skip to content

Commit 23defe0

Browse files
committed
render chunks in distance order (transparent fix)
1 parent 9ec279e commit 23defe0

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/client/scripts/World/AnimatedTextureAtlas.coffee

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class AnimatedTextureAtlas
7474
map:null
7575
vertexColors:true
7676
transparent:true
77-
depthTest:true
7877
})
7978
@uni=
8079
view:new THREE.Vector3

src/client/scripts/World/World.coffee

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as THREE from 'three'
22
import {CellTerrain} from './CellTerrain.coffee'
33
import {AnimatedTextureAtlas} from './AnimatedTextureAtlas.coffee'
44
import {SectionComputer} from "./SectionComputer.coffee"
5+
import vec3 from "vec3"
56
import chunkWorker from "./chunk.worker.coffee"
67

78
class World
@@ -43,6 +44,12 @@ class World
4344
return
4445
updateRenderOrder: (cell)->
4546
#Here will be ordering meshes
47+
c=new vec3 cell...
48+
for i of @cellMesh
49+
n=i.split ":"
50+
x=new vec3 parseInt(n[0]),parseInt(n[1]),parseInt(n[2])
51+
@cellMesh[i].renderOrder=-c.distanceTo x
52+
@game.renderer.clearDepth()
4653
return
4754
setCell: (cellX,cellY,cellZ,buffer)->
4855
@_setCell cellX,cellY,cellZ,buffer

src/client/scripts/index.coffee

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Game
3939
@renderer=new THREE.WebGLRenderer
4040
canvas:@canvas
4141
PixelRatio:window.devicePixelRatio
42-
@renderer.sortObjects=false
42+
@renderer.sortObjects=true
4343
@scene=new THREE.Scene
4444
@dimBg=
4545
"minecraft:overworld":[173/255, 200/255, 255/255]
@@ -49,9 +49,6 @@ class Game
4949
@camera.rotation.order = "YXZ"
5050
@camera.position.set 26, 26, 26
5151
@scene.add new THREE.AmbientLight 0xffffff
52-
# directionalLight = new THREE.DirectionalLight 0x333333, 2
53-
# directionalLight.position.set(1, 1, 0.5).normalize()
54-
# @scene.add directionalLight
5552
console.warn gpuInfo()
5653

5754
@nick=document.location.hash.substring 1,document.location.hash.length

0 commit comments

Comments
 (0)