Skip to content

Commit e728074

Browse files
committed
Ambient Occlusion FaceVertexColor
1 parent 29bcc7f commit e728074

File tree

790 files changed

+121
-8820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

790 files changed

+121
-8820
lines changed

coffee/client/module/RandomNick.coffee

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@ RandomNick=->
33
finalName = ""
44
finalName = nameList[Math.floor( Math.random() * nameList.length )]
55
finalName += nameList[Math.floor( Math.random() * nameList.length )]
6-
if Math.random() > 0.5
7-
finalName += nameList[Math.floor( Math.random() * nameList.length )]
86
return finalName
97
export {RandomNick}

coffee/client/module/World/chunk.worker.coffee

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,65 @@ class TerrainManager
1919
normals=[]
2020
uvs=[]
2121
colors=[]
22+
aoColor=(type)->
23+
if type is 0
24+
return [0.9,0.9,0.9]
25+
else if type is 1
26+
return [0.7,0.7,0.7]
27+
else if type is 2
28+
return [0.5,0.5,0.5]
29+
else
30+
return [0.3,0.3,0.3]
2231
addFace=(type,pos)->
2332
faceVertex=_this.BlockGeo.genBlockFace type,_this.cellTerrain.getBlock(pos...),pos
2433
positions.push faceVertex.pos...
2534
normals.push faceVertex.norm...
2635
uvs.push faceVertex.uv...
27-
colors.push(0.5,0.5,0.5,0.5,0.5,0.5,1,1,1,1,1,1,0.5,0.5,0.5,0.5,0.5,0.5)
36+
# _this.cellTerrain.getBlock(pos[0],pos[1],pos[2])
37+
loaded={}
38+
for x in [-1..1]
39+
for y in [-1..1]
40+
for z in [-1..1]
41+
if (_this.cellTerrain.getBlock(pos[0]+x, pos[1]+y,pos[2]+z).boundingBox is "block")
42+
loaded["#{x}:#{y}:#{z}"]=1
43+
else
44+
loaded["#{x}:#{y}:#{z}"]=0
45+
col1=aoColor(0)
46+
col2=aoColor(0)
47+
col3=aoColor(0)
48+
col4=aoColor(0)
49+
if type is "py"
50+
col1=aoColor(loaded["1:1:-1"]+loaded["0:1:-1"]+loaded["1:1:0"])
51+
col2=aoColor(loaded["1:1:1"]+loaded["0:1:1"]+loaded["1:1:0"])
52+
col3=aoColor(loaded["-1:1:-1"]+loaded["0:1:-1"]+loaded["-1:1:0"])
53+
col4=aoColor(loaded["-1:1:1"]+loaded["0:1:1"]+loaded["-1:1:0"])
54+
if type is "ny"
55+
col2=aoColor(loaded["1:-1:-1"]+loaded["0:-1:-1"]+loaded["1:-1:0"])
56+
col1=aoColor(loaded["1:-1:1"]+loaded["0:-1:1"]+loaded["1:-1:0"])
57+
col4=aoColor(loaded["-1:-1:-1"]+loaded["0:-1:-1"]+loaded["-1:-1:0"])
58+
col3=aoColor(loaded["-1:-1:1"]+loaded["0:-1:1"]+loaded["-1:-1:0"])
59+
if type is "px"
60+
col1=aoColor(loaded["-1:-1:0"]+loaded["-1:-1:-1"]+loaded["-1:0:-1"])
61+
col2=aoColor(loaded["-1:1:0"]+loaded["-1:1:-1"]+loaded["-1:0:-1"])
62+
col3=aoColor(loaded["-1:-1:0"]+loaded["-1:-1:1"]+loaded["-1:0:1"])
63+
col4=aoColor(loaded["-1:1:0"]+loaded["-1:1:1"]+loaded["-1:0:1"])
64+
if type is "nx"
65+
col3=aoColor(loaded["1:-1:0"]+loaded["1:-1:-1"]+loaded["1:0:-1"])
66+
col4=aoColor(loaded["1:1:0"]+loaded["1:1:-1"]+loaded["1:0:-1"])
67+
col1=aoColor(loaded["1:-1:0"]+loaded["1:-1:1"]+loaded["1:0:1"])
68+
col2=aoColor(loaded["1:1:0"]+loaded["1:1:1"]+loaded["1:0:1"])
69+
if type is "pz"
70+
col1=aoColor(loaded["0:-1:1"]+loaded["-1:-1:1"]+loaded["-1:0:1"])
71+
col2=aoColor(loaded["0:1:1"]+loaded["-1:1:1"]+loaded["-1:0:1"])
72+
col3=aoColor(loaded["0:-1:1"]+loaded["1:-1:1"]+loaded["1:0:1"])
73+
col4=aoColor(loaded["0:1:1"]+loaded["1:1:1"]+loaded["1:0:1"])
74+
if type is "nz"
75+
col3=aoColor(loaded["0:-1:-1"]+loaded["-1:-1:-1"]+loaded["-1:0:-1"])
76+
col4=aoColor(loaded["0:1:-1"]+loaded["-1:1:-1"]+loaded["-1:0:-1"])
77+
col1=aoColor(loaded["0:-1:-1"]+loaded["1:-1:-1"]+loaded["1:0:-1"])
78+
col2=aoColor(loaded["0:1:-1"]+loaded["1:1:-1"]+loaded["1:0:-1"])
79+
80+
colors.push col1...,col3...,col2...,col2...,col3...,col4...
2881
return
2982
for i in [0..@cellSize-1]
3083
for j in [0..@cellSize-1]

src/client/module/RandomNick.js

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

src/client/module/World/chunk.worker.js

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

src/dist/assets/assetLoader.json

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/dist/assets/blocks/blocks.json

Lines changed: 0 additions & 107 deletions
This file was deleted.
-393 KB
Binary file not shown.

0 commit comments

Comments
 (0)